U-boot-gena2x
From Openmoko
(→How to setup) |
(→List of changes: + (Solved problem?: )) |
||
(34 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | I decided to put my version of | + | {{Bootloader}} |
+ | I decided to put '''U-boot-gena2x''' - my version of [[U-Boot]] [[bootloader]] here, along with a short FAQ and list of known bugs. Please feel free to add your bugs or questions here. | ||
− | + | The current version of U-Boot ([[U-Boot]] or U-boot-gena2x?) fully supports uploading and downloading via dfu, booting any known distro, is fully configurable, and has no known grave bugs. | |
== List of changes == | == List of changes == | ||
− | This version of | + | This version of U-Boot is based on openmoko's stable branch of U-Boot. Git can be viewed [http://www.bsdmn.com/cgit/cgit/u-boot/ here]. |
Significant patches are: | Significant patches are: | ||
Version 2: | Version 2: | ||
− | *GPS is not powered up on boot | + | * + (Solved problem?: ) [[GPS]] is not powered up on boot |
− | *Leave all serial ports setup to kernel | + | * + Leave all serial ports setup to kernel |
Version 1: | Version 1: | ||
− | *2-4-2 timings | + | * + [[Smedia_Glamo_3362#Timing_settings|2-4-2 timings]] |
− | *GPS should work after resume | + | * + GPS should work after resume |
== Binaries == | == Binaries == | ||
− | Public freerunners should have same bootloader (board v5 and later). | + | Public freerunners should have the same bootloader (board v5 and later). |
− | Latest binary version is here | + | Latest binary version is here: |
+ | * http://www.bsdmn.com/openmoko/uboot/binary/ | ||
− | to use | + | to use U-Boot as NAND bootloader, you should flash the binary to the special partition: |
sudo dfu-util -a u-boot -D u-boot_g2x_2.udfu | sudo dfu-util -a u-boot -D u-boot_g2x_2.udfu | ||
== How to setup == | == How to setup == | ||
− | NAND | + | NAND U-Boot occupies 2 partitions on NAND, one partition for U-Boot itself and one for it's configuration. |
− | To setup | + | To setup U-Boot, the easiest way is to edit the simple text file on your computer and then upload it to your phone with dfu-util. |
− | Sample text config may be found [http://www.bsdmn.com/openmoko/uboot/config/environment.in here]. This version | + | Sample text config may be found [http://www.bsdmn.com/openmoko/uboot/config/environment.in here]. This version supports various kinds of boot options in the menu. You may use it as a sample for your config. |
− | If you switching from | + | If you are switching from bootloader [[Qi]], just boot your distro with Qi, then do <code>cat /proc/cmdline</code> and compare/update the parameters in your config file. |
− | Then you | + | Then you can edit the config file to fit your needs, you should prepare it (this adds crc): |
− | get envedit.pl from [http://svn.openmoko.org/trunk/src/host/devirginator/] and run: | + | get envedit.pl and crc32.pl from [http://svn.openmoko.org/trunk/src/host/devirginator/] and run: |
− | ./envedit.pl -s | + | ./envedit.pl -s 262144 -f environment.in > u-boot_env.in |
− | then flash resulting file: | + | then flash resulting file to configuration partition: |
sudo dfu-util -a u-boot_env -D u-boot_env.in | sudo dfu-util -a u-boot_env -D u-boot_env.in | ||
Line 48: | Line 50: | ||
|root=/dev/mtdblock6|| rootfs is on usual location on NAND | |root=/dev/mtdblock6|| rootfs is on usual location on NAND | ||
|- | |- | ||
− | |rootwait|| | + | |rootwait|| needed for booting from SD. force kernel to delay boot until sd card is ready. better than older rootdelay= |
|- | |- | ||
|panic=20|| on kernel crash, reboot automatically after 20 second delay. useful for lindi's ramconsole patch | |panic=20|| on kernel crash, reboot automatically after 20 second delay. useful for lindi's ramconsole patch | ||
|- | |- | ||
− | |hardware_ecc=1|| use hardware ecc support for NAND, this is not | + | |hardware_ecc=1|| use hardware ecc support for NAND, this is not default option use only if your rootfs NAND is flashed not with dfu-util, but with direct copy from sd. this speeds up NAND read on zlib-compressed ubi by 8%. |
|- | |- | ||
− | |rootfstype=XX|| | + | |rootfstype=XX|| needed if your rootfs is ext2 to force kernel to use ext2 driver not ext3. use if kernel can't detect partition type |
|- | |- | ||
|ubi.mtd=6,2048|| claim 6th mtd partition as ubi layer with 2048 page align | |ubi.mtd=6,2048|| claim 6th mtd partition as ubi layer with 2048 page align | ||
Line 65: | Line 67: | ||
== How to use == | == How to use == | ||
− | By default if you press 'power' button the "bootcmd" from your config is executed, so | + | By default, if you press the 'power' button, the "bootcmd" from your config is executed, so set it up accordingly for your default distribution. |
− | To see boot menu and select | + | To see the boot menu and select desired boot method, hold 'power', wait 1 second and then hold 'aux', wait 1 more second and release both. |
== Known bugs == | == Known bugs == | ||
− | I am working to fix | + | I am working to fix these bugs now: |
*sd reads correct data only 50% of times, so sd boot | *sd reads correct data only 50% of times, so sd boot | ||
*NAND hw ecc is not supported | *NAND hw ecc is not supported | ||
− | + | *U-Boot can't boot system if battery is fully discharged (workaround exist) | |
− | * | + | |
+ | == Booting without battery/with completely discharged battery == | ||
+ | |||
+ | To workaround the bug that it's not possible boot with discharged/without battery, use following 'trick': insert charger cable and in same moment press 'power' button, add up 'aux' later for menu. | ||
+ | |||
+ | |||
+ | == Some setup examples == | ||
+ | ==== qtmoko v31 on NAND (ubifs) ==== | ||
+ | <pre> | ||
+ | menu_3= | ||
+ | Boot NAND/ubi-zlib: | ||
+ | setenv bootargs ${bootargs_base} ${mtdparts} rootfstype=ubifs | ||
+ | ubi.mtd=6,2048 ubi.comp root=ubi0:om-gta02-rootfs | ||
+ | rootflags=compr=zlib,no_chk_data_crc; | ||
+ | nand read.e 0x32000000 kernel 0x300000; | ||
+ | bootm 0x32000000 | ||
+ | </pre> | ||
+ | ==== µSD (FAT+ext2) ==== | ||
+ | <pre> | ||
+ | menu_2= | ||
+ | Boot from microSD (FAT+ext2): | ||
+ | setenv bootargs | ||
+ | ${bootargs_base} | ||
+ | root=/dev/mmcblk0p1 rootwait | ||
+ | ${mtdparts} ro; | ||
+ | mmcinit; | ||
+ | fatload mmc MMC_NUM 0x32000000 ${sd_image_name} 0x300000; | ||
+ | bootm 0x32000000 | ||
+ | </pre> | ||
+ | |||
+ | ==== µSD (ext2+ext3) ==== | ||
+ | <pre> | ||
+ | menu_2= | ||
+ | Boot from microSD (ext2+ext3): | ||
+ | setenv bootargs | ||
+ | ${bootargs_base} | ||
+ | root=/dev/mmcblk0p1 rootwait | ||
+ | ${mtdparts} ro; | ||
+ | mmcinit; | ||
+ | ext2load mmc MMC_NUM 0x32000000 ${sd_image_name} 0x300000; | ||
+ | bootm 0x32000000 | ||
+ | </pre> | ||
[[Category:Bootloaders]] | [[Category:Bootloaders]] |
Latest revision as of 07:33, 23 February 2012
Bootloaders |
---|
I decided to put U-boot-gena2x - my version of U-Boot bootloader here, along with a short FAQ and list of known bugs. Please feel free to add your bugs or questions here.
The current version of U-Boot (U-Boot or U-boot-gena2x?) fully supports uploading and downloading via dfu, booting any known distro, is fully configurable, and has no known grave bugs.
Contents |
[edit] List of changes
This version of U-Boot is based on openmoko's stable branch of U-Boot. Git can be viewed here.
Significant patches are:
Version 2:
- + (Solved problem?: ) GPS is not powered up on boot
- + Leave all serial ports setup to kernel
Version 1:
- + 2-4-2 timings
- + GPS should work after resume
[edit] Binaries
Public freerunners should have the same bootloader (board v5 and later). Latest binary version is here:
to use U-Boot as NAND bootloader, you should flash the binary to the special partition:
sudo dfu-util -a u-boot -D u-boot_g2x_2.udfu
[edit] How to setup
NAND U-Boot occupies 2 partitions on NAND, one partition for U-Boot itself and one for it's configuration.
To setup U-Boot, the easiest way is to edit the simple text file on your computer and then upload it to your phone with dfu-util.
Sample text config may be found here. This version supports various kinds of boot options in the menu. You may use it as a sample for your config.
If you are switching from bootloader Qi, just boot your distro with Qi, then do cat /proc/cmdline
and compare/update the parameters in your config file.
Then you can edit the config file to fit your needs, you should prepare it (this adds crc):
get envedit.pl and crc32.pl from [1] and run:
./envedit.pl -s 262144 -f environment.in > u-boot_env.in
then flash resulting file to configuration partition:
sudo dfu-util -a u-boot_env -D u-boot_env.in
[edit] Useful kernel options
option | description |
---|---|
root=/dev/mmcblk0p2 | rootfs is second partition on SD card |
root=/dev/mtdblock6 | rootfs is on usual location on NAND |
rootwait | needed for booting from SD. force kernel to delay boot until sd card is ready. better than older rootdelay= |
panic=20 | on kernel crash, reboot automatically after 20 second delay. useful for lindi's ramconsole patch |
hardware_ecc=1 | use hardware ecc support for NAND, this is not default option use only if your rootfs NAND is flashed not with dfu-util, but with direct copy from sd. this speeds up NAND read on zlib-compressed ubi by 8%. |
rootfstype=XX | needed if your rootfs is ext2 to force kernel to use ext2 driver not ext3. use if kernel can't detect partition type |
ubi.mtd=6,2048 | claim 6th mtd partition as ubi layer with 2048 page align |
rootflags=compr=zlib,no_chk_data_crc | mount options of rootfs, use no_chk_data_crc to speed up ubifs by 8% |
mem=127M | reserve 1Mb if you using lindi's ramcomsole patch |
[edit] How to use
By default, if you press the 'power' button, the "bootcmd" from your config is executed, so set it up accordingly for your default distribution.
To see the boot menu and select desired boot method, hold 'power', wait 1 second and then hold 'aux', wait 1 more second and release both.
[edit] Known bugs
I am working to fix these bugs now:
- sd reads correct data only 50% of times, so sd boot
- NAND hw ecc is not supported
- U-Boot can't boot system if battery is fully discharged (workaround exist)
[edit] Booting without battery/with completely discharged battery
To workaround the bug that it's not possible boot with discharged/without battery, use following 'trick': insert charger cable and in same moment press 'power' button, add up 'aux' later for menu.
[edit] Some setup examples
[edit] qtmoko v31 on NAND (ubifs)
menu_3= Boot NAND/ubi-zlib: setenv bootargs ${bootargs_base} ${mtdparts} rootfstype=ubifs ubi.mtd=6,2048 ubi.comp root=ubi0:om-gta02-rootfs rootflags=compr=zlib,no_chk_data_crc; nand read.e 0x32000000 kernel 0x300000; bootm 0x32000000
[edit] µSD (FAT+ext2)
menu_2= Boot from microSD (FAT+ext2): setenv bootargs ${bootargs_base} root=/dev/mmcblk0p1 rootwait ${mtdparts} ro; mmcinit; fatload mmc MMC_NUM 0x32000000 ${sd_image_name} 0x300000; bootm 0x32000000
[edit] µSD (ext2+ext3)
menu_2= Boot from microSD (ext2+ext3): setenv bootargs ${bootargs_base} root=/dev/mmcblk0p1 rootwait ${mtdparts} ro; mmcinit; ext2load mmc MMC_NUM 0x32000000 ${sd_image_name} 0x300000; bootm 0x32000000