U-Boot

From Openmoko

Revision as of 11:07, 7 August 2006 by HaraldWelte (Talk | contribs)

Jump to: navigation, search

Contents

General

The GTA01 uses the u-boot bootloader.

More information on u-boot can be found at [1] and [2].

However, the vanilla u-boot doesn't support many of the features that GTA01 needs, such as

  • Support for boot from NAND flahs using S3C2410 Steppingstone
  • Support for reading kernel/initrd from SD/Transflash
  • Support for S3C2410 NAND flash
  • Support for downloading programs via S3C2410 USB Device Controller
  • Support to display bootup logo / status on S3C2410 Framebuffer

User:HaraldWelte is working on those issues, and in fact most of them have already been implemented.


Bootloader source code

The current bootloader source code can be found at [3]. You will need the original tar.bz2 archive as well as the u-boot-qt2410.patch.

Untar the sources, apply the patch. run "make qt2410_config", run "make". You will get a resulting "u-boot.bin" image, which you can directly flash (either using existing bootloader or sjf2410-linux) into NAND.


Bootloader binary

The latest bootloader binary (for NAND) can be found at [4]. It should be written to the NAND flash address 0x00000000 (size 0x30000)

Bootloader development

If you want to do bootloader development on the QT2410, it's easier to work with a bootloader image that can be downloaded via USB into RAM instead of flashing.

To do so, you need to edit the u-boot/include/configs/qt2410.h file, and change the "if 0" in Line 32 into a "if 1", then recompile with "make".

The resulting "u-boot.bin" is _NOT SUITABLE_ for NAND flash, but only for direct execution from within ram, e.g. by using the s3c2410_boot_usb program.

Creating bootable images

u-boot needs bootable images (such as kernels, but also initrd and others) in form of a so-called uImage. In order to create a uImage from e.g. a vmlinux kernel image, you can proceed as follows:

objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
gzip -9 linux.bin
u-boot/tools/mkimage -A arm -O linux -T kernel -C gzip -a 30008000 -e 30008000 -n "Kernel Image QT2410" -d linux.bin.gz uImage

Bootloader prompt

The bootloader is currently configured to waid for three seconds. If a key press on the serial port is received within those three seconds, auto-boot is aborted.

U-Boot 1.1.4-ga2c95a72-dirty (Aug  6 2006 - 22:05:48)

DRAM:  64 MB
Flash: 512 kB
NAND:  64 MiB
In:    serial
Out:   serial
Err:   serial

cs8900a chipid 0x630e
Hit any key to stop autoboot:  0 
QT2410 #

Auto-boot

Auto-boot executes the command[s] specified in the bootcmd environment variable. The default configuration is:

QT2410 # printenv
bootcmd=mmcinit; ext2load mmc 0 0x32000000 uImage; bootm 0x32000000

This basically tells us that it will copy a file called "uImage" from the SD-Card to memory address 0x32000000 and then try to boot it.

Environment

u-boot is configured to manage a non-volatile environment that is stored in NAND flash. You can use the commands to read/alter/store the environment in the following example:

QT2410 # printenv
bootcmd=mmcinit; ext2load mmc 0 0x32000000 uImage; bootm 0x32000000
bootdelay=3
baudrate=115200
ipaddr=10.0.0.110
serverip=10.0.0.1
netmask=255.255.255.0
bootargs=root=/dev/mmcblk0p1 console=ttySAC0,115200 loglevel=8 rootdelay=10
stdin=serial
stdout=serial
stderr=serial

Environment size: 271/16380 bytes
QT2410 # setenv bootdelay 10
QT2410 # printenv bootdelay
bootdelay=10
QT2410 # saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
QT2410 # 
Personal tools

General

The GTA01 uses the u-boot bootloader.

More information on u-boot can be found at [1] and [2].

However, the vanilla u-boot doesn't support many of the features that GTA01 needs, such as

  • Support for boot from NAND flahs using S3C2410 Steppingstone
  • Support for reading kernel/initrd from SD/Transflash
  • Support for S3C2410 NAND flash
  • Support for downloading programs via S3C2410 USB Device Controller
  • Support to display bootup logo / status on S3C2410 Framebuffer

User:HaraldWelte is working on those issues, and in fact most of them have already been implemented.


Bootloader source code

The current bootloader source code can be found at [3]. You will need the original tar.bz2 archive as well as the u-boot-qt2410.patch.

Untar the sources, apply the patch. run "make qt2410_config", run "make". You will get a resulting "u-boot.bin" image, which you can directly flash (either using existing bootloader or sjf2410-linux) into NAND.


Bootloader binary

The latest bootloader binary (for NAND) can be found at [4]. It should be written to the NAND flash address 0x00000000 (size 0x30000)

Bootloader development

If you want to do bootloader development on the QT2410, it's easier to work with a bootloader image that can be downloaded via USB into RAM instead of flashing.

To do so, you need to edit the u-boot/include/configs/qt2410.h file, and change the "if 0" in Line 32 into a "if 1", then recompile with "make".

The resulting "u-boot.bin" is _NOT SUITABLE_ for NAND flash, but only for direct execution from within ram, e.g. by using the s3c2410_boot_usb program.

Creating bootable images

u-boot needs bootable images (such as kernels, but also initrd and others) in form of a so-called uImage. In order to create a uImage from e.g. a vmlinux kernel image, you can proceed as follows:

objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
gzip -9 linux.bin
u-boot/tools/mkimage -A arm -O linux -T kernel -C gzip -a 30008000 -e 30008000 -n "Kernel Image QT2410" -d linux.bin.gz uImage

Bootloader prompt

The bootloader is currently configured to waid for three seconds. If a key press on the serial port is received within those three seconds, auto-boot is aborted.

U-Boot 1.1.4-ga2c95a72-dirty (Aug  6 2006 - 22:05:48)

DRAM:  64 MB
Flash: 512 kB
NAND:  64 MiB
In:    serial
Out:   serial
Err:   serial

cs8900a chipid 0x630e
Hit any key to stop autoboot:  0 
QT2410 #

Auto-boot

Auto-boot executes the command[s] specified in the bootcmd environment variable. The default configuration is:

QT2410 # printenv
bootcmd=mmcinit; ext2load mmc 0 0x32000000 uImage; bootm 0x32000000

This basically tells us that it will copy a file called "uImage" from the SD-Card to memory address 0x32000000 and then try to boot it.

Environment

u-boot is configured to manage a non-volatile environment that is stored in NAND flash. You can use the commands to read/alter/store the environment in the following example:

QT2410 # printenv
bootcmd=mmcinit; ext2load mmc 0 0x32000000 uImage; bootm 0x32000000
bootdelay=3
baudrate=115200
ipaddr=10.0.0.110
serverip=10.0.0.1
netmask=255.255.255.0
bootargs=root=/dev/mmcblk0p1 console=ttySAC0,115200 loglevel=8 rootdelay=10
stdin=serial
stdout=serial
stderr=serial

Environment size: 271/16380 bytes
QT2410 # setenv bootdelay 10
QT2410 # printenv bootdelay
bootdelay=10
QT2410 # saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
QT2410 #