
Hi,
On 08/10/2014 11:00 PM, Karsten Merker wrote:
Hello,
in the following email you can find a patch to populate the default environment for sunxi-based systems about which I would apprechiate your opinion.
With the current progress in mainlining sunxi platform support, mainline u-boot will probably soon be able to replace u-boot-sunxi (https://github.com/linux-sunxi/u-boot-sunxi) for many use cases. Currently the default environment in mainline u-boot for sunxi-based systems is rather bare; the only predefined variable is bootm_size (which is required for proper initrd- and dtb-relocation). U-boot-sunxi predefines a set of environment variables which are commonly used by existing boot scripts and also offers a predefined bootcmd for automatic search and execution of bootscripts. I think that to facilitate using mainline u-boot as a drop-in replacement for u-boot-sunxi, mainline u-boot should provide similar defaults.
The original environment in u-boot-sunxi was written for an older u-boot release and does not make use of modern u-boot features (e.g. it uses hardcoded filesystem-specific load commands), so just copying the environment 1:1 to mainline u-boot does not make sense IMHO. My patch tries to implement the minimum required for autobooting existing boot scripts with more modern u-boot functions.
In addition to that, the patch defines some standard environment variables which are commonly defined on other u-boot platforms, but which have not been defined by u-boot-sunxi, in particular kernel_addr_r, ramdisk_addr_r and fdt_addr_r. Debian supports a wide range of armhf system and tries to unify support for the different platforms as good as possible. Having the same predefined variables with (platform-specific) load addresses on all platforms would help us a lot with regard to generic boot scripts and simplified user documentation.
Regarding the actual values for the various load addresses I am not in all cases perfectly sure about the best variant. Following is the reasoning for my choices:
fdt_addr_r
U-boot-sunxi loads the FEX binary (Allwinner's proprietary hardware description format for their android kernels, i.e. a file functionally roughly equivalent to a dtb) to address 0x43000000, so I guess using the same for the dtb makes sense.
scriptaddr
has historically been expected to be 0x44000000; some old boot scripts assume this address.
kernel_addr_r and ramdisk_addr_r
Allwinner has historically loaded their kernels to 0x48000000 (system specific kernels with all drivers compiled in, no initrd).
Debian has been using 0x46000000 for the kernel and 0x48000000 for the initrd. These values work well in practice, so I have used them in the patch, but if there are reasons to change them, I am happy to do so.
Comments welcome :-).
Thanks for this patch, but this does the same as a series I've already pending, see:
https://github.com/jwrdegoede/u-boot-sunxi/commits/next
I've not yet send a pull-request for this because it uses the new generic $bootcmd support: https://github.com/jwrdegoede/u-boot-sunxi/commit/34e421a155c83c52f6e6edb259...
This commit has just been merged by Tom Rini, so right now these patches are good to go. I'll send a pull-request for them soon.
Let me know if somehow these patches won't work for Debian. One of the goals of the generic $bootcmd support is that distributions can just drop an extlinux.conf in the boot partition, and then u-boot will automatically find it and do the right thing.
Regards,
Hans