5.1. Khởi động trình cài đặt trên 32-bit soft-float ARM

5.1.1. Boot image formats

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 are image formats designed for the U-Boot firmware that is used on many ARM-based systems (mostly 32-bit ones). Older U-Boot versions can only boot files in uImage/uInitrd format, so these are often used on older armel systems. Newer U-Boot versions can - besides booting uImages/uInitrds - also boot standard Linux kernels and ramdisk images, but the command syntax to do that is slightly different from that for booting 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.

5.1.2. Khởi động từ TFTP

Booting from the network requires that you have a network connection and a TFTP network boot server (and probably also a DHCP, RARP, or BOOTP server for automatic network configuration).

The server-side setup to support network booting is described in Phần 4.3, “Chuẩn bị tập tin để khởi động qua mạng TFTP”. TFTP-booting in U-Boot

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

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


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 follwing values:

setenv kernel_addr_r 0x46000000
setenv fdt_addr_r 0x47000000
setenv ramdisk_addr_r 0x48000000

When the load addresses are defined, you can load the images into memory from the previously defined tftp server with

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 Phần 5.3.1, “Boot console”) or preseeding options (see Phần 5.3.2, “Tham số trình cài đặt Debian” and Phụ lục B, Tự động hoá việc cài đặt bằng chèn sẵn) - 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.

5.1.3. Booting from a USB stick in U-Boot

Many modern U-Boot versions have USB support and allow booting from USB mass storage devices such as USB sticks. Unfortunately the exact steps required to do that can vary quite a bit from device to device.

U-Boot v2014.10 has introduced a common commandline handling and autoboot framework. This allows building generic boot images that work on any system implementing this framework. The debian-installer supports installation from a USB stick on such systems, but unfortunately not all platforms have adopted this new framework yet.

To build a bootable USB stick for installing Debian, unpack the hd-media tarball (see Phần 4.2.1, “Tìm ảnh cài đặt ở đâu”) onto a USB stick formatted with a filesystem supported by the U-Boot version on your device. For modern U-Boot versions, any of FAT16 / FAT32 / ext2 / ext3 / ext4 usually works. Then copy the ISO image file of the first Debian installation CD or DVD onto the stick.

The autoboot framework in modern U-Boot versions works similar to the boot ordering options in a PC BIOS, i.e. it checks a list of possible boot devices for a valid boot image and starts the first one it finds. If there is no operating system installed, plugging in the USB stick and powering up the system should result in starting the installer. You can also initiate the USB-boot process any time from the U-Boot prompt by entering the run bootcmd_usb0 command.

One problem that can come up when booting from a USB stick while using a serial console can be a console baudrate mismatch. If a console variable is defined in U-Boot, the debian-installer boot script automatically passes it to the kernel to set the primary console device and, if applicable, the console baudrate. Unfortunately the handling of the console variable varies from platform to platform - on some platforms, the console variable includes the baudrate (as in console=ttyS0,115200), while on other platforms the console variable contains only the device (as in console=ttyS0). The latter case leads to a garbled console output when the default baudrate differs between U-Boot and the kernel. Modern U-Boot versions often use 115200 baud while the kernel still defaults to the traditional 9600 baud. If this happens, you should manually set the console variable to contain the correct baudrate for your system and then start the installer with the run bootcmd_usb0 command.