Help needed, my dtb file got overwritten

Since I tried to base my Arch Linux Image with VisionFive2 Software v2.8.0. Every time I boot the image, the file /boot/boot/dtbs/starfive/jh7110-visionfive-v2.dtb gets overwritten.

Before reboot:

root@starfive:/boot/boot/dtbs
# rm -rf sifive starfive

root@starfive:/boot/boot/dtbs
# cp -a 5.15.2-rt20-cwt9/* .

root@starfive:/boot/boot/dtbs
# md5sum starfive/jh7110-visionfive-v2.dtb *-cwt9/starfive/jh7110-visionfive-v2.dtb
99286979328534c3115fd12bfc0fdecb  starfive/jh7110-visionfive-v2.dtb
99286979328534c3115fd12bfc0fdecb  5.15.2-rt20-cwt9/starfive/jh7110-visionfive-v2.dtb

After reboot:

root@starfive:/boot/boot/dtbs
# md5sum starfive/jh7110-visionfive-v2.dtb *-cwt9/starfive/jh7110-visionfive-v2.dtb
ef0729d3b3678dd89adc8e0865a38ff3  starfive/jh7110-visionfive-v2.dtb
99286979328534c3115fd12bfc0fdecb  5.15.2-rt20-cwt9/starfive/jh7110-visionfive-v2.dtb

And then I tried to see what was changed:

root@starfive:/boot/boot/dtbs
# dtc -I dtb -O dts starfive/jh7110-visionfive-v2.dtb -o /tmp/now.dts 2>/dev/null

root@starfive:/boot/boot/dtbs
# dtc -I dtb -O dts 5.15.2-rt20-cwt9/starfive/jh7110-visionfive-v2.dtb -o /tmp/cwt9.dts 2>/dev/null

root@starfive:/boot/boot/dtbs
# diff -u /tmp/cwt9.dts /tmp/now.dts

And here the diff:

--- /tmp/cwt9.dts       2023-02-08 13:31:29.284983576 +0700
+++ /tmp/now.dts        2023-02-08 13:31:21.567837497 +0700
@@ -1611,10 +1611,10 @@
                        ethernet-phy@0 {
                                rxc_dly_en = <0x01>;
                                tx_delay_sel_fe = <0x05>;
-                               tx_delay_sel = <0x0a>;
-                               tx_inverted_10 = <0x01>;
-                               tx_inverted_100 = <0x01>;
-                               tx_inverted_1000 = <0x01>;
+                               tx_delay_sel = <0x09>;
+                               tx_inverted_10 = <0x00>;
+                               tx_inverted_100 = <0x00>;
+                               tx_inverted_1000 = <0x00>;
                        };
                };

@@ -1651,10 +1651,10 @@

                        ethernet-phy@1 {
                                tx_delay_sel_fe = <0x05>;
-                               tx_delay_sel = <0x00>;
+                               tx_delay_sel = <0x09>;
                                rxc_dly_en = <0x00>;
-                               tx_inverted_10 = <0x01>;
-                               tx_inverted_100 = <0x01>;
+                               tx_inverted_10 = <0x00>;
+                               tx_inverted_100 = <0x00>;
                                tx_inverted_1000 = <0x00>;
                        };
                };
@@ -2395,7 +2395,7 @@

        memory@40000000 {
                device_type = "memory";
-               reg = <0x00 0x40000000 0x01 0x00>;
+               reg = <0x00 0x40000000 0x02 0x00>;
        };

        reserved-memory {

This might be the reason for the recent ethernet issues I’ve been having with my image.

set_fdt_distro=if test ${chip_vision} = A; then if test ${memory_size} = 200000000; then run chipa_gmac_set;run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};else run chipa_gmac_set;run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};fi;else run visionfive2_mem_set;fatwrite mmc ${fatbootpart} ${fdt_addr_r} ${bootdir}/dtbs/${fdtfile} ${filesize};fi;

From uboot’s printenv.

1 Like

Why it wants to do that for the board revision “A”?

Edit: Oh from the script, both revisions got overwritten?

No clue, but from a glance there’s an else, and another fatwrite.

I do not know where these variables are stored either. They’re either hardcoded into u-boot itself, or perhaps that’s what the W25X10CL SPI flash does store.

I had seen a document on the boot process a few days ago, but it’s from early 2022 i.e. a year ago, and very inaccurate from a glance. The page where it was just disappeared.

1 Like

Hmm.

We urgently need a relatively clean u-boot build, now.

1 Like