For most people this would not matter in any event. U-boot works as shipped to boot linux and requires no fiddling with. However, for my purposes, I interrupt U-boot, change some enviroment variables, then do a saveenv to preserve my changes.
One option would be to rebuild U-boot from source and make any necessary changes. A person could change how saveenv works, or they could modify the initial values of the env variables. For me, this encounters other problems. Dealing with bl31 for one, and simply getting a scratch built U-boot onto an SD card for another. These are both things I intend to learn about -- some fine day, but right now I am looking for a quick way to get the U-boot setup I want onto an SD card soI can get busy with other things.
The snag comes when I install the image. Apparently there is some kind of header with a checksum, and my patched image gets rejected. So the game now becomes figuring out how to redo that header.
cat u-boot-nodtb.bin dts/dt.dtb > u-boot-dtb.bin cp u-boot-dtb.bin u-boot.binThe mkimage tool is run with a list of options, as follows:
./tools/mkimage -f auto -A arm -T firmware -C none -O u-boot -a 0x00200000 -e 0x00200000 -p 0x0 -n "U-Boot 2022.01""-00450-g25711b07ca-dirty for evb_rk3399 board" -E -b arch/arm/dts/rk3399-orangepi.dtb -d u-boot-nodtb.bin u-boot-dtb.imgI see the following file sizes:
-rw-rw-r-- 1 tom tom 711376 Jan 23 22:50 u-boot-dtb.bin -rw-rw-r-- 1 tom tom 712392 Jan 23 22:50 u-boot-dtb.imgThe "img" file adds 1016 bytes. Examination of the files indicate this is all at the start of the file, so indeed simply a header is prepended. It is apparently only coincidence that it is nearly 1024 bytes. As just a note, the header can be removed as follows:
dd if=u-boot-dtb.img of=zzz bs=1 skip=1016This was done, file sizes verified and cmp used to compare the contents.
-f auto - input filename for FIT source -A arm -- specify architecture -T firmware -- set image type -C none -- set compression -O u-boot -- set operating system -a 0x00200000 -- load address -e 0x00200000 -- entry point -p 0 -- place external data at static position -n "..." -- set image name -E -- place data outside the FIT structure -b path -- ?? something involving the dtb -d file -- use image data from fileAn interesting note is the claim that "-l" will list header information from an existing image. Doing this on an image generated by the mainline u-boot sources yields a full screen of information. Doing this on the debian U-boot image yields only one line:
GP Header: Size 4c4f4144 LoadAddr 45522020This, as it turns out, is simply the first 8 bytes of the file, which is the string "LOADER ". So, the debian u-boot image is something entirely different.
Tom's electronics pages / tom@mmto.org