U-Boot/Configuration

From linux-sunxi.org
Jump to navigation Jump to search

This article provides a collection of various scenarios for booting with U-Boot.

Boot

For getting these bits loaded onto the hardware, please refer to the respective howto:

For booting from sd with mainline u-boot, the recommended way is:

  • create a file boot.cmd on the first partition (also check Kernel arguments for extra 'bootargs' options):
mainline kernel sunxi-3.4 kernel
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10
load mmc 0:1 0x43000000 ${fdtfile} || load mmc 0:1 0x43000000 boot/${fdtfile}
load mmc 0:1 0x42000000 uImage || load mmc 0:1 0x42000000 boot/uImage
bootm 0x42000000 - 0x43000000
setenv bootm_boot_mode sec
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10
load mmc 0:1 0x43000000 script.bin || load mmc 0:1 0x43000000 boot/script.bin
load mmc 0:1 0x42000000 uImage || load mmc 0:1 0x42000000 boot/uImage
bootm 0x42000000
Information.png If you're wondering why setting bootm_boot_mode might be necessary for older kernels, have a look at the details of PSCI.
Sticky-note-pin.png Note: Directly using a zImage is also supported by U-Boot for the sunxi platform. Substitute zImage in place of uImage in the commands above, and then use the bootz command instead of bootm.

Setting u-boot environment variables

There is a difference in setting environment variables between the boot script and the U-Boot shell.

Inside the shell you would set, for instance:

setenv root /dev/sda1

But in the script you would use:

root=/dev/sda1

SD Card (legacy kernel)

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
ext2load mmc 0 0x43000000 script.bin
ext2load mmc 0 0x48000000 uImage
bootm 0x48000000

NAND

Example U-Boot environment, as found in uEnv.txt from a stock android U-Boot environment partition

bootdelay=0
bootcmd=run setargs boot_normal
console=ttyS0,115200
nand_root=/dev/nandc
mmc_root=/dev/mmcblk0p4
init=/init
loglevel=8
setargs=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel}
boot_normal=nand read 40007800 boot;boota 40007800
boot_recovery=nand read 40007800 recovery;boota 40007800
boot_fastboot=fastboot

NFS

Recent version of U-Boot are able to boot from NFS as well as TFTP, but you have to get rid of the automatic setup of FTP. Check Ethernet for more information.

Sticky-note-pin.png Note: on the A20 based cubieboards, this only seems to work on the stable kernel, not on stage.

FB console

To get U-Boot output shown on the built-in framebuffer driver (currently, HDMI only at 1024x768), add the following to your boot.cmd:

setenv stdout=serial,vga
setenv stderr=serial,vga

The default environment has these values set as well.

LCD Settings

There is a separate wiki page about configuring LCD in U-Boot.