On ARM-based systems in most cases one of two formats for boot images is used: a) standard Linux zImage-format kernels (”vmlinuz”) in conjunction with standard Linux initial ramdisks (”initrd.gz”) or b) uImage-format kernels (”uImage”) in conjunction with corresponding initial ramdisks (”uInitrd”).
uImage/uInitrd är bildformat som har designats för den inre mjukvaran U-Boot vilket används i många ARM-baserade system (mestadels 32-bitars). Äldre versioner av U-Boot kan endast starta upp filer i formatet uImage/uInitrd-formatet så dessa används oftast i äldre armel-system. Nyare versioner av U-Boot kan - förutom att starta uImages/uInitrd - också starta standard-kärnor för Linux och ramdisk-avbilder, men kommando-syntaxen för att göra det är något annorlunda från att boota uImages.
For systems using a multiplatform kernel, besides kernel and initial ramdisk a so-called device-tree file (or device-tree blob, ”dtb”) is needed. It is specific to each supported system and contains a description of the particular hardware. The dtb should be supplied on the device by the firmware, but in practice a newer one often needs to be loaded.
Uppstart från nätverket kräver att du har en nätverksanslutning och en TFTP-server konfigurerad för uppstarter (och antagligen även en DHCP-, RARP- eller BOOTP-server för automatisk närverkskonfiguration).
The server-side setup to support network booting is described in Avsnitt 4.3, ”Förbered filerna för nätverksuppstart via TFTP”.
Network booting on systems using the U-Boot firmware consists of three steps: a) configuring the network, b) loading the images (kernel/initial ramdisk/dtb) into memory and c) actually executing the previosly loaded code.
First you have to configure the network, either automatically via DHCP by running
setenv autoload no dhcp
or manually by setting several environment variables
setenv ipaddr <ip address of the client> setenv netmask <netmask> setenv serverip <ip address of the tftp server> setenv dnsip <ip address of the nameserver> setenv gatewayip <ip address of the default gateway>
If you prefer, you can make these settings permanent by running
saveenv
Afterwards you need to load the images (kernel/initial ramdisk/dtb) into memory. This is done with the tftpboot command, which has to be provided with the address at which the image shall be stored in memory. Unfortunately the memory map can vary from system to system, so there is no general rule which addresses can be used for this.
On some systems, U-Boot predefines a set of environment variables with suitable load addresses: kernel_addr_r, ramdisk_addr_r and fdt_addr_r. You can check whether they are defined by running
printenv kernel_addr_r ramdisk_addr_r fdt_addr_r
If they are not defined, you have to check your system's documentation for appropriate values and set them manually. For systems based on Allwinner SunXi SOCs (e.g. the Allwinner A10, architecture name ”sun4i” or the Allwinner A20, architecture name ”sun7i”), you can e.g. use the following values:
setenv kernel_addr_r 0x46000000 setenv fdt_addr_r 0x47000000 setenv ramdisk_addr_r 0x48000000
När lastadresserna är definierade kan du ladda avbilderna till minnet från den tidigare definierade tftp-servern med
tftpboot ${kernel_addr_r} <filename of the kernel image> tftpboot ${fdt_addr_r} <filename of the dtb> tftpboot ${ramdisk_addr_r} <filename of the initial ramdisk image>
The third part is setting the kernel commandline and actually executing the loaded code. U-Boot passes the content of the ”bootargs” environment variable as commandline to the kernel, so any parameters for the kernel and the installer - such as the console device (see Avsnitt 5.3.1, ”Startkonsol”) or preseeding options (see Avsnitt 5.3.2, ”Parametrar för Debian Installer” and Appendix B, Automatiserad installation med förinställningar) - can be set with a command like
setenv bootargs console=ttyS0,115200 rootwait panic=10
The exact command to execute the previously loaded code depends on the image format used. With uImage/uInitrd, the command is
bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
and with native Linux images it is
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
Note: When booting standard linux images, it is important to load the initial ramdisk image after the kernel and the dtb as U-Boot sets the filesize variable to the size of the last file loaded and the bootz command requires the size of the ramdisk image to work correctly. In case of booting a platform-specific kernel, i.e. a kernel without device-tree, simply omit the ${fdt_addr_r} parameter.