You are viewing outdated content for BUG. If you have a BUG Y.T. edition or 2.0 series device, please visit our updated wiki: http://wiki.buglabs.net



BUG2.0 bootloader programming

From BUG Wiki

Jump to: navigation, search

Contents

Overview

The stock bootloader on the preliminary 2.0 BUGs is xloader, which expects to boot from a FAT16 partition on the SD. To make it more BUG-like, follow the steps below to have xloader load uboot from NAND, which in turn loads the kernel/rootfs from the system microSD.

The way it works is:

  1. Boot BUG, xloader will boot uboot on FAT16 partition on SD image.
  2. Break out of uboot
  3. Send over/reprogram new xloader in NAND that will boot uboot from NAND
  4. Send over and program NAND with uboot.
  5. Set uboot environment.


Procedure

Follow the steps below using the serial terminal for 2.0.

Prepare SD card

  • Grab omap3-mkcard.sh script from OpenEmbedded.
  • Prepare microSD card - it will be repartitioned and formatted so do not keep important data on it!
  • Run (as root) (replace "/dev/sdc" with proper name):
omap3-mkcard.sh /dev/sdc
  • Mount first partition:
pmount sdc1
pumount sdc1
  • Put card in BUG 2.0 and reboot it. You should land in U-Boot. Press a key to break automatic boot.

Upgrade bootloader

  • Initialize microSD card:
mmc init
  • Set ecc to type hardware:
nandecc hw
  • Erase old X-Loader:
nand erase 0x0 0x80000
  • Load new X-Loader from microSD card:
fatload mmc 0:1 0x82000000 x-load.bin.ift
  • Write xloader from memory to NAND:
nand write 0x82000000 0x0 0x80000

Now for U-Boot.

  • Set ECC to software:
nandecc sw
  • Erase whatever was in NAND where uboot should go:
nand erase 0x80000 0x160000
  • Load new U-Boot from microSD card:
fatload mmc 0:1 0x82000000 u-boot.bin
  • Write the uboot image from memory to NAND:
nand write 0x82000000 0x80000 0x160000
  • After that, you're good with the binary images. Reset to load the new uboot image from NAND and set the environment.
reset

Environment

Note that you'll want to send it over slowly, in 2 or 3 lines at a time, otherwise minicom/picocom screws up the buffer and you'll get truncated values, which is not good.

setenv androidargs 'setenv bootargs androidboot.console=ttyS2 console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw init=/init rootwait omapfb.video_mode=640x480MR-16@60 kgdboc=${console}'
setenv baudrate '115200'
setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p1 rw rootwait rootdelay=1 kgdboc=ttyS2,115200n8 usbcore.autosuspend=-1 8250.nr_uarts=6 printk.time=1'
setenv bootcmd 'run mmcboot'
setenv bootdelay '3'
setenv console 'ttyS2,115200n8'
setenv ethaddr 'aa:bb:cc:dd:ee:ff'
setenv gatewayip '192.168.1.1'
setenv ipaddr '192.168.1.10'
setenv mmcargs 'setenv bootargs smsc95xx.mac=${ethaddr} console=${console} root=/dev/mmcblk0p1 rw rootwait rootdelay=1 kgdboc=${console} usbcore.autosuspend=-1'
setenv mmcboot 'mmc init;ext2load mmc 0:1 0x80000000 /boot/uImage;run mmcargs;bootm 0x80000000'
setenv netmask '255.255.255.0'
setenv preboot ''
setenv serverip '192.168.1.20'
setenv stderr 'serial'
setenv stdin 'serial'
setenv stdout 'serial'
  • Erase the old values:
setenv loadaddr
setenv usbtty 
setenv vram 
setenv dvimode 
setenv defaultdisplay 
setenv mmcroot 
setenv mmcrootfstype 
setenv nandroot 
setenv nandrootfstype 
setenv nandargs 
setenv loadbootscript
setenv bootscript
setenv loaduimage
setenv nandboot
setenv bootkernel
setenv bootkernel_1
  • Save everything:
saveenv