wiki:default_boot

Make hackable:1 the default boot

In order to boot your SD card by default, we need to change a few things in u-boot.

To do that you need to connect to the bootloader prompt via USB or via serial console (with the debug board).

We will do it via USB.

First, you need to prepare the FR to receive order for uboot via usb :

  • press the power button
  • press and hold the AUX button
  • keep power and AUX pressed until menu is up
  • choose the third entry with AUX button and press power

(for the record, when you do that you see the NAND memory, the one we will change; to access NOR or NAND see  http://wiki.openmoko.org/wiki/Booting_the_Neo_FreeRunner#Log_into_U-Boot_in_the_NAND_Flash)

Then, you need to prepare your Linux box. To connect to the bootloader prompt you need a terminal. cu is often used. Werner Almesberger's "neocon" serial console utility otherwise supports rate limiting of the data sent to the device, allowing copy/paste.

We will use it.

# svn co http://svn.openmoko.org/developers/werner/neocon/
# cd neocon
# make

Now boot the Neo on NAND menu (like the previous time) It will declare a new tty device called /dev/ttyACM0.

To connect :

# ./neocon -t 30 /dev/ttyACM0 

and here we go. You've got the bootloader prompt.

If you type :

GTA02v5 # printenv

It'll answer :

  boot_menu_timeout=60
  bootargs_base=rootfstype=jffs2 root=/dev/mtdblock6 console=ttySAC2,115200 console=tty0 loglevel=4 regular_boot
  bootcmd=setenv bootargs ${bootargs_base} ${mtdparts}; nand read.e 0x32000000 kernel 0x200000; bootm 0x32000000
  bootdelay=5
  menu_1=Boot from microSD (FAT+ext2): setenv bootargs ${bootargs_base} rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5 ${mtdparts} ro; mmcinit; fatload mmc 1 0x32000000 
${sd_image_name}; bootm 0x32000000
  menu_4=Set console to USB: setenv stdin usbtty; setenv stdout usbtty; setenv stderr usbtty
  menu_5=Set console to serial: setenv stdin serial; setenv stdout serial; setenv stderr serial
  menu_6=Reboot: reset
  menu_8=Power off: neo1973 power-off
  sd_image_name=uImage.bin
  stderr=usbtty
  stdin=usbtty
  stdout=usbtty
  usbtty=cdc_acm
  mtdids=nor0=physmap-flash,nand0=neo1973-nand
  pcb_rev=0x000
  pcf50633_int1=0x80
  pcf50633_int2=0x02
  mtdparts=mtdparts=physmap-flash:-(nor);neo1973-nand:0x00040000(u-boot),0x00040000(u-boot_env),0x00800000(kernel),0x000a0000(splash),0x00040000(factory),0x0f6a0000(rootfs)
  partition=nor0,0
  mtddevnum=0
  mtddevname=nor

  Environment size: 1093/262140 bytes

What interests us is to change bootcmd, which is the default boot command. to do that we type (if you use neocon I recomand to copy/paste):

GTA02v5 # setenv bootcmd setenv bootargs ${bootargs_base} rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5 ro\; mmcinit\; fatload mmc 1 0x32000000 ${sd_image_name}\; bootm 0x32000000

now we add an entry to be able to boot our flash memory (just in case) .

GTA02v5 # setenv menu_1 Boot from flash memory : setenv bootargs ${bootargs_base} ${mtdparts}\; nand read.e 0x32000000 kernel 0x200000\; bootm 0x32000000

Verify that everything is all right with :

  GTA02v5 # printenv  

and now save the nand memory :

  GTA02v5 # saveenv

You can now shutdown your FR and boot normally: it should be H:1 !

Remember, the NOR bootloader was not touched. So if your NAND bootloader is harmed, you can use the NOR one.