[uboot-sunxi][uboot-*] Add more modularity

Problems with packages? Post here, using [tags] of the package name.

[uboot-sunxi][uboot-*] Add more modularity

Postby nlgranger » Fri Aug 03, 2018 8:56 am

The u-boot bootloader offers some level of configuration after installation, it comes in the form of a boot.scr file which contains a compiled version of a script with a few u-boot specific commands.

Currently, the script which comes by default for most boards seems to assume one root partition containing the kernel and an optional initramfs in the boot folder.

Since the script must be compiled, it is not as easy to modify as one might wish. I also find the documentation of the commands to be a bit confusing.

My suggestion would be to have the script load a set of user defined variables from a text file to alter a few common settings.
Another modification I'd like to see is the support for a separate boot partition: although u-boot cannot read an f2fs formatted partition to look for boot files, the linux kernel can for the root partition, so having them separated would be a plus.

Below is a example of boot.txt script file that implements my proposition, it looks for a uEnv.txt file which can set three variables, bootpart, rootpart and extraargs:

$this->bbcode_second_pass_code('', '
# Compile with:
# mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr

setenv bootpart 1;

if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} uEnv.txt; then
echo Loaded environment from uEnv.txt;
env import -t ${ramdisk_addr_r} ${filesize};
elif load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} boot/uEnv.txt; then
echo Loaded environment from uEnv.txt;
env import -t ${ramdisk_addr_r} ${filesize};
fi;

if test -n ${rootpart}; then
else
setenv rootpart ${bootpart};
fi;

part uuid ${devtype} ${devnum}:${rootpart} root_uuid;

if ${bootpart} -eq ${rootpart}; then
setenv prefix /boot;
else
setenv prefix ;
fi

setenv bootargs console=${console} root=PARTUUID=${root_uuid} rw rootwait panic=10 ${extraargs};

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} ${prefix}/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} ${prefix}/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} ${prefix}/initramfs-linux.img; then
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
bootz ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
')

Any opinion on this?
nlgranger
 
Posts: 1
Joined: Fri Jul 27, 2018 9:15 pm

Return to Packages

Who is online

Users browsing this forum: No registered users and 22 guests