Hello everyone,
A few months ago I had the idea to automatically calculate fdt- and
ramdisk load addresses based on their actual sizes. On IRC agraf then
suggested to just guess offsets that will always hold true, and that is
what I now implemented:
The user now only has to specify kerneladdr. dtb and ramdisk will be put
somewhere after that address.
I assume that a kernel will be smaller than 63MB, and a device tree
binary smaller than 1MB.
The calculated addresses are then the following:
fdtaddr=kerneladdr+63MB
ramdiskaddr=fdtaddr+1MB
I have created a submit request SR239214 implementing this automatic
calculation and using it for the cubox-i. I have also attached the
relevant diff so you can look at it easily.
If you approve of this automatic calculation I'd encourage you to make
use of it in the future!
kind regards
Josua Mayer
Index: uboot-image-setup.in
===================================================================
--- uboot-image-setup.in (revision 554bb233fa71baf7fee2c9a136072b7f)
+++ uboot-image-setup.in (working copy)
@@ -204,8 +204,8 @@
;;
cuboxi)
kerneladdr=0x10800100
- fdtaddr=0x18000000
- ramdiskaddr=0x18100000
+ fdtaddr=calculate
+ ramdiskaddr=calculate
should_load_fdt=0
should_use_fdt=0
fdtfile=call_autodetectfdt
@@ -218,6 +218,19 @@
kernel=zImage
fi
+# calculate fdt- and ramdiskaddr from kerneladdr
+# kernel needs maximum 63MB
+# fdt maximum 1MB
+# ramdisk can be placed anywhere after that
+if [ "x$fdtaddr" = "xcalculate" ]; then
+ fdtaddr=$(( $kerneladdr + 0x03F00000 )) # kernel + 63M
+ fdtaddr=`printf '0x%X' $fdtaddr` # convert back to hexadecimal
+fi
+if [ "x$ramdiskaddr" = "xcalculate" ]; then
+ ramdiskaddr=$(( $fdtaddr + 0x00100000 )) # fdt + 1M
+ ramdiskaddr=`printf '0x%X' $ramdiskaddr` # convert back to hexadecimal
+fi
+
initrd_high=0xffffffff
fdt_high=0xffffffff