Contents[hide]
|
Fastboot is the method android uses to flash the android build onto the target. If you really want the details, the fastboot protocol specification is found in the android source fastboot_protocol.txt
What's with the name 'fastboot' or how are you booting faster ? This feature should be renamed 'making-the-bootloader-simple-to-use'. Fastboot speeds up your development NOT the time it takes to boot.
The biggest benifit of fastboot is that it automates the manual steps of flashing nand. Look back on the manual steps here. As an example In fastboot all you need to do to flash the kernel is from your host machine.
The fastboot client is built as part of a normal android build, it is located ./out/host/linux-x86/bin/fastboot'
# sudo fastboot flash kernel path-to-kernel/uImage
Similarly for the rootfs
# sudo fastboot flash system path-to-system/system.img
The general form to flash is
# sudo fastboot flash <partition name> <file>
That is it, all the details are taken care of for you. You do not have to know to unlock the NAND, which flavor of ECC to use, which method of writing to NAND or even where the flash happens. Its all done for you.
The fastboot client is part of Android. It is built when you build Android. You wil find fastboot in out/host/linux-x86/bin/fastboot.
Regions in NAND are given names. Their offsets and sizes are set in U-boot. To run most fastboot client commands, you need to know what partition name corresponds to which file.
NAND partition names | ||
name | offset | size |
xloader | 0x00000000 | 0x00080000 |
bootloader | 0x00080000 | 0x00180000 |
environment | 0x001C0000 | 0x00040000 |
kernel | 0x00200000 | 0x01D00000 |
system | 0x02000000 | 0x0A000000 |
userdata | 0x0C000000 | 0x02000000 |
cache | 0x0E000000 | 0x02000000 |
NAND partition input files | ||
name | type of file | usual file |
xloader | xloader binary | MLO |
bootloader | uboot binary | u-boot.bin |
environment | text file | list of variables to set |
kernel | kernel or kernel + ramdisk | uImage, uMulti |
system | yaffs2 | system.img |
userdata | yaffs2 | userdata.img |
cache | yaffs2 | ? |
Instead of setting the environment manually, a text file is used set and unset environment variables. The text file is list of variable / value pairs. One variable per line. The setting and unsetting are similar to the u-boot setenv command.
variable value
variable
bootdelay 10 bootargs console=ttyS3,115200n8 bootcmd nand unlock; nand read.i 81000000 ${kernel_nand_offset} ${kernel_nand_size}; bootm 81000000
The comments in environment files are now similar to bash. The '#' is the comment character. The limitation is that the '#' must be in used before any other non-whitespace character. This is valid: # Use this one This is not valid: bootcmd bootm 81000000 # My boot command
In general when fastboot flashes a partition, it saves the nand offset and size of the image as enviroment variables. The format of the names are
As and example when the kernel is flashed, you can view the u-boot environment and see that
The benifit of these variables is that you can write general environment files.
Connect the board to allow for USBOTG to work y as described here. On u-boot prompt, enter command fastboot. (this can also be done automatically in u-boot through setenv bootcmd 'fastboot') During usb setup, the large LED in the top left of the Zoom II binks red and blue. When the setup is complete, the blue LED should be on.
# lsusb Bus 008 Device 030: ID 0451:cafe Texas Instruments, Inc. <----- fastboot Bus 008 Device 005: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter Bus 008 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 008 Device 003: ID 2001:3c05 D-Link Corp. [hex] DUB-E100 Fast Ethernet [asix]
For more detail, look in proc fs.
# cat /proc/bus/usb/devices T: Bus=01 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#= 85 Spd=480 MxCh= 0 D: Ver= 1.10 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs= 1 P: Vendor=0451 ProdID=cafe Rev= 3.11 S: Manufacturer=Texas Instruments S: Product=Zoom2 S: SerialNumber=00123 C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=03 Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
If you fail to see the fastboot device on the host or the Zoom II red LED remains on First check the usb cable is connected to Zoom II usb and battery or AC power is connected to Zoom II
If you are connected, then follow these steps:
Verifying if fast boot client recognizes the Zoom2 device:
sudo sudo fastboot devices Output: 00123 fastboot
NOTE: All features of fastboot have been implemented in v1.1 u-boot and x-loader. Please upgrade to v1.1 from here
Flashing Android on NAND
# fastboot
# sudo fastboot flash xloader MLO-Zoom2 # sudo fastboot flash bootloader uboot-Zoom2 # sudo fastboot flash kernel uMulti-Image # sudo fastboot flash system system.img # sudo fastboot flash userdata userdata.img # sudo fastboot erase cache # sudo fastboot flash environment environment_vars.txt
The environment_vars.txt file is
bootdelay 10 bootargs console=ttyS3,115200n8 bootcmd nand unlock; nand read.i 81000000 ${kernel_nand_offset} ${kernel_nand_size}; bootm 81000000
The locations of the images relative to the top of the android source tree is
xloader : bootloader/MLO bootloader : bootloader/u-boot.bin uMulti-Image : See bellow kernel : kernel/arch/arm/boot/zImage ramdisk.img : out/target/product/zoom2/ramdisk.img system : out/target/product/zoom2/system.img userdata : out/target/product/zoom2/userdata.img
uMulti-Image = combine the Android ramdisk with the kernel, use the u-boot utility mkimage
mkimage -A arm -O linux -T multi -C none \ -a 0x80008000 -e 0x80008000 -n 'Name_Of_Your_Release'' \ -d <path-to-kernel>/arch/arm/boot/zImage:<path-to-android-out-dir>/ramdisk.img \ uMulti-2
This usecase assumes you only have a Zoom II and still want to flash your board. To do this you need to put the Zoom II into the fastboot preboot mode by holding down two keys while the board is booting. Follow these steps.
You should see
The continuous red LED means that fastboot command has started. Next you should Connect the USB cable from the host to the Zoom II
You should see:
This means that USB discovery by the host was successful. You are ready to go! If you do not see a continous blue LED, repeat the setup steps. The instructions from the host side are the same as the use case with the debug board.
# fastboot
# sudo fastboot flash kernel uMulti-Image
# fastboot
# sudo fastboot flash system system.img
# fastboot
# sudo fastboot flash bootloader uboot-Zoom2 # sudo fastboot flash environment environment_vars.txt
# fastboot
# sudo fastboot flash xloader MLO-Zoom2 # sudo fastboot flash bootloader uboot-Zoom2 # sudo fastboot flash kernel uImage # sudo fastboot flash system filesystem.yaff2 # sudo fastboot erase userdata # sudo fastboot erase cache # sudo fastboot flash environment Kernel_rootfs
The Kernel_rootfs file is
bootdelay 10 bootargs console=ttyS3,115200n8 root=/dev/mtdblock4 rw rootfstype=yaffs2 init=/sbin/init bootcmd nand unlock; nand read.i 80000000 ${kernel_nand_offset} ${kernel_nand_size}; bootm
# fastboot
# sudo fastboot reboot
# fastboot
# sudo fastboot boot uImage
# fastboot
# sudo fastboot boot u-boot.bin
How do you customize the NAND layout by adding or deleting partitions?
Fastboot reuses the kernel's method of customizing the NAND partitions and most of the partitions are changable. This is the list of the unchangable or static partitions.
Static NAND partition names | ||
name | offset | size |
xloader | 0x00000000 | 0x00080000 |
bootloader | 0x00080000 | 0x00180000 |
environment | 0x001C0000 | 0x00040000 |
The runtime partitions are defined by the u-boot environment variable fbparts. Its format is simlar to the kernel's boot command line variable mtdparts. Here is an example of how the system partition is defined at runtime for fastboot and for the kernel.
For fastboot, 160m@32m(system)yaffs|swecc, means create a partition at 32M with a size of 160M, name it 'system' and use the fastboot flags yaffs and swecc.
For the kernel, omap2-nand.0:160m@32m(system), means for the omap2-nand.0 device, create a partition at 32M with a size of 160M and name it 'system'
Format of fbparts The format is:
<size>@<offset>(<name>)<optional-flags>,
The supported flags control how the data is written into nand they are
i : use nand write.i yaffs : use nand write.yaffs swecc : use nand software ecc hwecc : use nand hardware ecc
Multiple flags can be or-ed together with a '|'
In addition to disconnecting the usb cable, the user can exit fastboot when a user defined timeout expires or when a Ctrl-C is seen from the console.
This is the new fastboot help
# help fastboot fastboot [inactive timeout] - Run as a fastboot usb device. The optional inactive timeout is the decimal seconds before the normal console resumes. <pre> To run fastboot with a timeout of 100 seconds, do <pre> # fastboot 100
The console prints out
Fastboot inactivity timeout 100 seconds Disconnect USB cable to finish fastboot.. Fastboot inactivity detected
You can still do
# fastboot
It will behave as it did before. If you want to stop it, now you can use the Ctrl-C on the console. The timeout happens when inactivity is seen during the fastboot command. The timeout is reset after each command. If the command takes longer than timeout, like reflashing the system image, it will not timeout during the command. Because host discovery of the fastboot device can take a couple of seconds, it is recommended that the timeout be at least 10 seconds.