* fixed partitions issue
@ 2025-07-30 10:45 Stefano Manni
2025-07-30 12:40 ` Ahmad Fatoum
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Manni @ 2025-07-30 10:45 UTC (permalink / raw)
To: barebox
Dear all,
I'm encountering an issue with fixed-partitions on spinor with
v2025.07.0 that
was not there in v2025.01.0.
The partitions are configured as follows:
partitions {
compatible = "fixed-partitions";
#size-cells = <1>;
#address-cells = <1>;
barebox: partition@0 {
label = "barebox";
reg = <0x0 0x0100000>;
};
barebox_env: partition@100000 {
label = "barebox-env";
reg = <0x0100000 0x100000>;
};
barebox_state: partition@200000 {
label = "barebox-state";
reg = <0x0100000 0x100000>;
};
};
It seems to me the partition offsets (0, 0x100000, 0x200000) are not
taken into account
so the results is that all the partitions point to the same piece of
memory. That's how I tested it:
############
# v2025.01.0
barebox@mk8:/ md5sum /dev/nor0.barebox
937e462b306c7295096fb9446a97645f /dev/nor0.barebox
barebox@mk8:/ md5sum /dev/nor0.barebox-env
2fdd6851b32ae931637d4845c037b550 /dev/nor0.barebox-env
barebox@mk8:/ md5sum /dev/nor0.barebox-state
2fdd6851b32ae931637d4845c037b550 /dev/nor0.barebox-state
barebox@mk8:/ nv a=a
nv variable modified, will save nv variables on shutdown
barebox@mk8:/ nv -s
envfs: no envfs (magic mismatch) - envfs never written?
barebox@mk8:/ md5sum /dev/nor0.barebox
937e462b306c7295096fb9446a97645f /dev/nor0.barebox
barebox@mk8:/ md5sum /dev/nor0.barebox-env
392559d1b391d7fe69e36d068998983c /dev/nor0.barebox-env -> it is
expected to change
barebox@mk8:/ md5sum /dev/nor0.barebox-state
2fdd6851b32ae931637d4845c037b550 /dev/nor0.barebox-state
############
# v2025.07.0
barebox@mk8:/ md5sum /dev/nor0.barebox
01b367b04e57af6f4153b0043da594bc /dev/nor0.barebox
barebox@mk8:/ md5sum /dev/nor0.barebox-env
01b367b04e57af6f4153b0043da594bc /dev/nor0.barebox-env
barebox@mk8:/ md5sum /dev/nor0.barebox-state
01b367b04e57af6f4153b0043da594bc /dev/nor0.barebox-state
barebox@mk8:/ nv a=a
nv variable modified, will save nv variables on shutdown
barebox@mk8:/ nv -s
envfs: no envfs (magic mismatch) - envfs never written?
barebox@mk8:/ md5sum /dev/nor0.barebox
d41d8cd98f00b204e9800998ecf8427e /dev/nor0.barebox -> it is
NOT expected to change
barebox@mk8:/ md5sum /dev/nor0.barebox-env
d41d8cd98f00b204e9800998ecf8427e /dev/nor0.barebox-env -> it is
expected to change
barebox@mk8:/ md5sum /dev/nor0.barebox-state
d41d8cd98f00b204e9800998ecf8427e /dev/nor0.barebox-state -> it is
NOT expected to change
Do you have any hint? After the changes on drivers/of/partition.c
between v2025.01.0 and v2025.07.0
shall I need to change something in my dts?
Best,
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fixed partitions issue
2025-07-30 10:45 fixed partitions issue Stefano Manni
@ 2025-07-30 12:40 ` Ahmad Fatoum
2025-07-31 17:43 ` Stefano Manni
0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2025-07-30 12:40 UTC (permalink / raw)
To: Stefano Manni, barebox
Hi Stefano,
On 7/30/25 12:45, Stefano Manni wrote:
> Dear all,
>
> I'm encountering an issue with fixed-partitions on spinor with
> v2025.07.0 that
> was not there in v2025.01.0.
>
> The partitions are configured as follows:
>
> partitions {
> compatible = "fixed-partitions";
> #size-cells = <1>;
> #address-cells = <1>;
>
> barebox: partition@0 {
> label = "barebox";
> reg = <0x0 0x0100000>;
> };
>
> barebox_env: partition@100000 {
> label = "barebox-env";
> reg = <0x0100000 0x100000>;
> };
>
> barebox_state: partition@200000 {
> label = "barebox-state";
> reg = <0x0100000 0x100000>;
The first cell is the start address, so this should be 0x200000, not
0x0100000.
> };
> };
>
> It seems to me the partition offsets (0, 0x100000, 0x200000) are not
> taken into account
The unit address in the node name is never parsed as address, neither in
barebox or in Linux. What's in reg is what matters.
> so the results is that all the partitions point to the same piece of
> memory. That's how I tested it:
The devinfo command without arguments will show you the start/end
address of all partitions.
> Do you have any hint? After the changes on drivers/of/partition.c
> between v2025.01.0 and v2025.07.0
I don't know how it worked before, but that DT description is buggy.
What changed is that barebox doesn't refuse identical partitions, it
just makes the dupes a link to the first registered.
Do you maybe have board code that calls devfs_add_partition()?
The output of devinfo in both versions would be useful as well to
understand this.
> shall I need to change something in my dts?
It should work after fixing the reg properties. There has been changes
around the partition handling stuff, but they affected only fixed
partitions in eMMC/EEPROM. The MTD binding is an upstream binding and no
intentional changes happened here.
Cheers,
Ahmad
>
> Best,
> Stefano
>
>
>
>
>
>
>
>
>
>
>
>
--
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] 4+ messages in thread
* Re: fixed partitions issue
2025-07-30 12:40 ` Ahmad Fatoum
@ 2025-07-31 17:43 ` Stefano Manni
2025-08-05 5:24 ` Ahmad Fatoum
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Manni @ 2025-07-31 17:43 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
Hi Ahmad,
On mer, lug 30 2025 at 14:40:20 +02:00:00, Ahmad Fatoum
<a.fatoum@pengutronix.de> wrote:
>>
>> barebox_state: partition@200000 {
>> label = "barebox-state";
>> reg = <0x0100000 0x100000>;
>
> The first cell is the start address, so this should be 0x200000, not
> 0x0100000.
you are right I was in the mid of a change to resize partitions. Now
the dts looks like:
barebox: partition@0 {
label = "barebox";
reg = <0x0 0x0200000>;
};
barebox_env: partition@200000 {
label = "barebox-env";
reg = <0x0200000 0x040000>;
};
barebox_state: partition@240000 {
label = "barebox-state";
reg = <0x0240000 0x040000>;
};
>
> Do you maybe have board code that calls devfs_add_partition()?
no
>
> The output of devinfo in both versions would be useful as well to
> understand this.
unfortunately devinfo reports the same information on both v2025.01.0
and v2025.07.0
`-- 2008000.spi@2008000.of
`-- flash@00
`-- nor0
`-- 0x00000000-0x00ffffff ( 16 MiB): /dev/nor0
`-- nor0.barebox
`-- 0x00000000-0x001fffff ( 2 MiB): /dev/nor0.barebox
`-- nor0.barebox-env
`-- 0x00000000-0x0003ffff ( 256 KiB): /dev/nor0.barebox-env
`-- nor0.barebox-state
`-- 0x00000000-0x0003ffff ( 256 KiB): /dev/nor0.barebox-state
On v2025.07.0 every time I write barebox-env part (e.g. with nv
command) also barebox
part is written. This on v2025.01.0 does not happen.
I supposed the problem was in the fixed-partition bindings but maybe it
is somewhere
else, for example in the spinor driver.
Is that something I may test to understand more?
Best,
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fixed partitions issue
2025-07-31 17:43 ` Stefano Manni
@ 2025-08-05 5:24 ` Ahmad Fatoum
0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-08-05 5:24 UTC (permalink / raw)
To: Stefano Manni; +Cc: barebox
Hello Stefano,
On 31.07.25 19:43, Stefano Manni wrote:
> On v2025.07.0 every time I write barebox-env part (e.g. with nv command) also barebox
> part is written. This on v2025.01.0 does not happen.
>
> I supposed the problem was in the fixed-partition bindings but maybe it is somewhere
> else, for example in the spinor driver.
>
> Is that something I may test to understand more?
The issue was easily reproducible in QEMU with the virt platform or vexpress platform,
e.g. for multi_v8_defconfig:
pytest --lg-env test/arm/multi_v8_defconfig.yaml --interactive
and then
barebox@ARM QEMU virt64:/ md -s /dev/nor0.initramfs 0+16 ; md -s /dev/nor0.barebox-environment 0+16
00000000: 00000000 00000000 00000000 00000000 ................
00000000: 00000000 00000000 00000000 00000000 ................
barebox@ARM QEMU virt64:/ saveenv
saving environment to /dev/nor0.barebox-environment
barebox@ARM QEMU virt64:/ md -s /dev/nor0.initramfs 0+16 ; md -s /dev/nor0.barebox-environment 0+16
00000000: 798fba79 00000000 00000000 00000000 y..y............
00000000: 798fba79 00000000 00000000 00000000 y..y............
I ran a git bisect and found the issue to be introduced by Sascha's commit
6d2b6f399c07 ("cdev: pass master cdev to cdev ops").
This was first included in v2025.07.0.
@Sascha, can you look into this?
Thanks,
Ahmad
>
> Best,
> Stefano
>
>
>
>
>
>
>
>
--
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] 4+ messages in thread
end of thread, other threads:[~2025-08-05 5:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-30 10:45 fixed partitions issue Stefano Manni
2025-07-30 12:40 ` Ahmad Fatoum
2025-07-31 17:43 ` Stefano Manni
2025-08-05 5:24 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox