mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* barebox environment raw partition on beaglebone black
@ 2024-02-15 13:01 Lars Pedersen
  2024-02-15 13:47 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Pedersen @ 2024-02-15 13:01 UTC (permalink / raw)
  To: barebox

Hi.

I'm trying to create a barebox environment by using af emmc a raw
partition offset on the beaglebone black.

For testing I appended the following into am33x-boneblack.dts.

/ {
    chosen {
        environment {
            compatible = "barebox,environment";
            device-path = &environment_emmc;
        };
    };

    aliases {
        state = &state_emmc;
    };

    state_emmc: state {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "barebox,state";
        magic = <0x4b414d31>;
        backend-type = "raw";
        backend = <&backend_state_emmc>;
        backend-stridesize = <0x200>;

        bootstate {
            #address-cells = <1>;
            #size-cells = <1>;

            system0 {
                #address-cells = <1>;
                #size-cells = <1>;

                remaining_attempts@0 {
                    reg = <0x0 0x4>;
                    type = "uint32";
                    default = <10>;
                };

                priority@4 {
                    reg = <0x4 0x4>;
                    type = "uint32";
                    default = <21>;
                };
            };

            system1 {
                #address-cells = <1>;
                #size-cells = <1>;

                remaining_attempts@8 {
                    reg = <0x8 0x4>;
                    type = "uint32";
                    default = <0>;
                };

                priority@c {
                    reg = <0xc 0x4>;
                    type = "uint32";
                    default = <20>;
                };
            };

            last_chosen@10 {
                reg = <0x10 0x4>;
                type = "uint32";
            };
        };
    };
};

/* eMMC */
&mmc2 {
    partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;

        environment_emmc: partition@100000 {
            label = "barebox-environment";
            reg = <0x100000 0x100000>;
        };

        backend_state_emmc: partition@200000 {
            label = "barebox-state";
            reg = <0x200000 0x100000>;
        };
    };
};

Afterwards I get the following console output:

-------------------------------------------------
barebox 2024.01.0 #1 2024-01-01T00:00:00+00:00

Board: TI AM335x BeagleBone black
detected 'BeagleBone Black'
cpsw-mdio 4a101000.mdio@1000.of: detected phy mask 0x1
mdio_bus: miibus0: probed
eth0: got preset MAC address: 18:2c:65:2a:81:1d
i2c-omap 44e0b000.i2c@0.of: bus 0 rev0.11 at 400 kHz
i2c-omap 4819c000.i2c@0.of: bus 1 rev0.11 at 100 kHz
omap-hsmmc 48060000.mmc@0.of: registered as mmc0
omap-hsmmc 481d8000.mmc@0.of: registered as mmc1
mmc1: detected MMC card version 5.0
mmc1: registered mmc1
state: New state registered 'state'
state state.of: Fresh state detected, continuing with defaults
omap_wdt 44e35000.wdt@0.of: OMAP Watchdog Timer Rev 0x01
netconsole: registered as netconsole-1
malloc space: 0x8fefe3c0 -> 0x9fdfc77f (size 255 MiB)
am335x-phy-driver 47401b00.usb-phy@1b00.of: am_usbphy 8fff21a4 enabled
am335x-phy-driver 47401300.usb-phy@1300.of: am_usbphy 8fff225c enabled
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk
split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk
split, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
environment load /mnt/mmc1.0/barebox.env: No such file or directory
Maybe you have to create the partition.
changing USB current limit to 1300 mA... done

Hit m for menu or any to stop autoboot:    1
---------------------------------------------------

Why does it try to read the env on a partition on
/mnt/mmc1.0/barebox.env? Is it because barebox.bin also is read from
this partition?

Thanks.

/Lars



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: barebox environment raw partition on beaglebone black
  2024-02-15 13:01 barebox environment raw partition on beaglebone black Lars Pedersen
@ 2024-02-15 13:47 ` Ahmad Fatoum
  2024-02-15 14:29   ` Lars Pedersen
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2024-02-15 13:47 UTC (permalink / raw)
  To: Lars Pedersen, barebox

Hi Lars,

On 15.02.24 14:01, Lars Pedersen wrote:
> Hi.
> 
> I'm trying to create a barebox environment by using af emmc a raw
> partition offset on the beaglebone black.
> 
> For testing I appended the following into am33x-boneblack.dts.
> 
> / {
>     chosen {
>         environment {
>             compatible = "barebox,environment";
>             device-path = &environment_emmc;
>         };
>     };
> 
>     aliases {
>         state = &state_emmc;
>     };
> 
>     state_emmc: state {

[snip]

Keep in mind that state is unrelated to environment:

 - state: power-fail safe set of predefined variables used for mostly bootstate
 - environment: where you would keep scripts, variables and resources.
    In the field, you'd probably only use the immutable barebox built-in environment
    (+ state), but for development, the mutable environment is very handy.

> state: New state registered 'state'
> state state.of: Fresh state detected, continuing with defaults

State looks ok.

> environment load /mnt/mmc1.0/barebox.env: No such file or directory
> Maybe you have to create the partition.
> changing USB current limit to 1300 mA... done
> 
> Hit m for menu or any to stop autoboot:    1
> ---------------------------------------------------
> 
> Why does it try to read the env on a partition on
> /mnt/mmc1.0/barebox.env? Is it because barebox.bin also is read from
> this partition?

Check out omap_env_init(), which registers the environment if system boots from
SD/MMC. This seems to take precedence over what's in the device tree. Indeed,
upstream AM335x platforms only configure an environment in the DT if it's outside
SD, on NAND or NOR.

I think placing the environment on the FAT makes sense as the MLO is there as well.
Why would you like to move it?

Cheers,
Ahmad

> 
> Thanks.
> 
> /Lars
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: barebox environment raw partition on beaglebone black
  2024-02-15 13:47 ` Ahmad Fatoum
@ 2024-02-15 14:29   ` Lars Pedersen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Pedersen @ 2024-02-15 14:29 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

Hi Ahmad

On Thu, 15 Feb 2024 at 14:47, Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> Hi Lars,
>
> On 15.02.24 14:01, Lars Pedersen wrote:
> > Hi.
> >
> > I'm trying to create a barebox environment by using af emmc a raw
> > partition offset on the beaglebone black.
> >
> > For testing I appended the following into am33x-boneblack.dts.
> >
> > / {
> >     chosen {
> >         environment {
> >             compatible = "barebox,environment";
> >             device-path = &environment_emmc;
> >         };
> >     };
> >
> >     aliases {
> >         state = &state_emmc;
> >     };
> >
> >     state_emmc: state {
>
> [snip]
>
> Keep in mind that state is unrelated to environment:
>
>  - state: power-fail safe set of predefined variables used for mostly bootstate
>  - environment: where you would keep scripts, variables and resources.
>     In the field, you'd probably only use the immutable barebox built-in environment
>     (+ state), but for development, the mutable environment is very handy.
>
> > state: New state registered 'state'
> > state state.of: Fresh state detected, continuing with defaults
>
> State looks ok.
>
> > environment load /mnt/mmc1.0/barebox.env: No such file or directory
> > Maybe you have to create the partition.
> > changing USB current limit to 1300 mA... done
> >
> > Hit m for menu or any to stop autoboot:    1
> > ---------------------------------------------------
> >
> > Why does it try to read the env on a partition on
> > /mnt/mmc1.0/barebox.env? Is it because barebox.bin also is read from
> > this partition?
>
> Check out omap_env_init(), which registers the environment if system boots from
> SD/MMC. This seems to take precedence over what's in the device tree. Indeed,
> upstream AM335x platforms only configure an environment in the DT if it's outside
> SD, on NAND or NOR.
>
> I think placing the environment on the FAT makes sense as the MLO is there as well.
> Why would you like to move it?

I'll check out the omap_env_init. I just trying to understand how it
was set, so I don't want to change anything :)

Thanks for the quick response.

/Lars

>
> Cheers,
> Ahmad
>
> >
> > Thanks.
> >
> > /Lars
> >
> >
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-15 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 13:01 barebox environment raw partition on beaglebone black Lars Pedersen
2024-02-15 13:47 ` Ahmad Fatoum
2024-02-15 14:29   ` Lars Pedersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox