Specifying kernel image name in uEnv.iniemmc_autoscript
shipped with Armbian hardcoded the kernel image as zImage
.
That can be convenient for users who do not compile their own kernel. But for those who want to compile the kernel themself and preserve the name of the image (vmlinuz-x.y.z
), it could be annoying.
To be fair, Armbiam’s emmc_autoscript
has already separated some “configuration”s from the script. Things such as dtb_name
, bootargs
are already put into uEnv.ini
.
It’s possible to put kernel’s image name into that file as well. Here’s the script to read kernel’s image name from uEnv.ini
:
123456 setenv env_addr "0x10400000"setenv kernel_addr "0x11000000"setenv initrd_addr "0x13000000"setenv dtb_mem_addr "0x1000000"setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_mem_addr}if fatload mmc 1 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize}; if fatload mmc 1 ${kernel_addr} ${kernel_name}; then if fatload mmc 1 ${initrd_addr} uInitrd; then if fatload mmc 1 ${dtb_mem_addr} ${dtb_name}; then run boot_start;fi;fi;fi;fi;
To generate emmc_autoscript
from this script, use this:
1 mkimage -C none -A arm64 -T script -d emmc_autoscript.cmd emmc_autoscript
Now uEnv.ini
looks this way:
123 kernel_name=vmlinuz-4.20.3dtb_name=/dtb/meson-gxl-s905d-phicomm-n1.dtbbootargs=...
… and the kernel image is at /boot/vmlinuz-4.20.3
.
emmc_autoscript
shipped with Armbian hardcoded the kernel image as zImage
.
That can be convenient for users who do not compile their own kernel. But for those who want to compile the kernel themself and preserve the name of the image (vmlinuz-x.y.z
), it could be annoying.
To be fair, Armbiam’s emmc_autoscript
has already separated some “configuration”s from the script. Things such as dtb_name
, bootargs
are already put into uEnv.ini
.
It’s possible to put kernel’s image name into that file as well. Here’s the script to read kernel’s image name from uEnv.ini
:
1 2 3 4 5 6 | setenv env_addr "0x10400000" setenv kernel_addr "0x11000000" setenv initrd_addr "0x13000000" setenv dtb_mem_addr "0x1000000" setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_mem_addr} if fatload mmc 1 ${env_addr} uEnv.ini; then env import -t ${env_addr} ${filesize}; if fatload mmc 1 ${kernel_addr} ${kernel_name}; then if fatload mmc 1 ${initrd_addr} uInitrd; then if fatload mmc 1 ${dtb_mem_addr} ${dtb_name}; then run boot_start;fi;fi;fi;fi; |
To generate emmc_autoscript
from this script, use this:
1 | mkimage -C none -A arm64 -T script -d emmc_autoscript.cmd emmc_autoscript |
Now uEnv.ini
looks this way:
1 2 3 | kernel_name=vmlinuz-4.20.3 dtb_name=/dtb/meson-gxl-s905d-phicomm-n1.dtb bootargs=... |
… and the kernel image is at /boot/vmlinuz-4.20.3
.