Flashing uBoot and uBoot envs to the PogoMobile from Debian or ArchLinux ARM
Note: This was previously posted in http://forum.doozan.com/read.php?3,7477,10982#msg-10982 but reposted here so it's easier to find)
- Download Davy's uBoot image (April 8th 2012)
uboot.nandpogoV4-MMC-mtdparts-noSATA.kwb
See this thread for uBoot image: http://forum.doozan.com/read.php?3,7477,page=1
- Download Jeff's uBoot envs image
http://download.doozan.com/uboot/files/environment/uboot.environment
- Make sure the tools are in place and the uBoot enviroment definition is at the right place
(I'm using Debian wheezy and the fw_envs tools is available):
- Flash uBoot
- At this point, I believe you can boot with SD card. Because Davy's uBoot is set up for that.
However, for me to get a warm and fuzzy feeling, I'd like to be a little bit more sure, so I flashed the uBoot envs image from Jeff's script.
- Flash uboot.environment to 0xC0000
- Confirm that all envs are shown without error:
- Adjust MTD parts
- Set up netconsole (change serverip and ipaddr to appropriate numbers in your network)
- At this point you can only boot with a USB rootfs, since Jeff's uBoot env image did not have MMC boot.
- To boot with SD card, set uBoot envs:
- If you have a kernel that supportsPogoplug V4 then set arcNumber and machid.
Warning: don't do this if you're not sure, because it won't boot with a vanilla kernel after the arcNumber changed from 2097.
A vanilla Debian or Arch should boot fine with arcNumber 2097.
- Shutdown and cold start with Debian or Arch rootfs
Addendum:
Thanks to dhead for pointing out that the mmc_init does not seem to work the first time, so the work around in mmc_bootcmd is to include it twice:
Note: This was previously posted in http://forum.doozan.com/read.php?3,7477,10982#msg-10982 but reposted here so it's easier to find)
- Download Davy's uBoot image (April 8th 2012)
uboot.nandpogoV4-MMC-mtdparts-noSATA.kwb
See this thread for uBoot image: http://forum.doozan.com/read.php?3,7477,page=1
- Download Jeff's uBoot envs image
http://download.doozan.com/uboot/files/environment/uboot.environment
- Make sure the tools are in place and the uBoot enviroment definition is at the right place
(I'm using Debian wheezy and the fw_envs tools is available):
# which flash_erase /usr/sbin/flash_erase # which nandwrite /usr/sbin/nandwrite # cat /etc/fw_env.config # MTD device name Device offset Env. size Flash sector size Number of sectors /dev/mtd0 0xc0000 0x20000 0x20000
- Flash uBoot
# flash_erase /dev/mtd0 0 4 Erase Total 4 Units Performing Flash Erase of length 131072 at offset 0x60000 done # nandwrite /dev/mtd0 uboot.nandpogoV4-MMC-mtdparts-noSATA.kwb Writing data to block 0 at offset 0x0 Writing data to block 1 at offset 0x20000 Writing data to block 2 at offset 0x40000 Writing data to block 3 at offset 0x60000
- At this point, I believe you can boot with SD card. Because Davy's uBoot is set up for that.
However, for me to get a warm and fuzzy feeling, I'd like to be a little bit more sure, so I flashed the uBoot envs image from Jeff's script.
- Flash uboot.environment to 0xC0000
# /usr/sbin/flash_erase /dev/mtd0 0xc0000 1 Erase Total 1 Units Performing Flash Erase of length 131072 at offset 0xc0000 done # /usr/sbin/nandwrite -s 786432 /dev/mtd0 uboot.environment Writing data to block 6 at offset 0xc0000
- Confirm that all envs are shown without error:
# fw_printenv ethact=egiga0 bootdelay=3 baudrate=115200 arcNumber=2097 mainlineLinux=yes console=ttyS0,115200 led_init=green blinking led_exit=green off led_error=orange blinking mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) mtdids=nand0=orion_nand partition=nand0,2 stdin=serial stdout=serial stderr=serial rescue_installed=0 rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi force_rescue=0 force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi ubifs_mtd=3 ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done usb_scan_list=1 2 3 4 usb_scan_1=usb=0:1 dev=sda1 usb_scan_2=usb=1:1 dev=sdb1 usb_scan_3=usb=2:1 dev=sdc1 usb_scan_4=usb=3:1 dev=sdd1 usb_init=run usb_scan usb_device=0:1 usb_root=/dev/sda1 usb_rootfstype=ext2 usb_rootdelay=10 usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
- Adjust MTD parts
# fw_setenv mtdparts 'mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)' # fw_printenv mtdparts mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
- Set up netconsole (change serverip and ipaddr to appropriate numbers in your network)
# fw_setenv serverip 192.168.0.220 # fw_setenv ipaddr 192.168.0.230 # fw_setenv if_netconsole 'ping $serverip' # fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;' # fw_setenv preboot 'run if_netconsole start_netconsole'
- At this point you can only boot with a USB rootfs, since Jeff's uBoot env image did not have MMC boot.
- To boot with SD card, set uBoot envs:
# fw_setenv bootcmd 'usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run mmc_bootcmd' # fw_setenv mmc_bootcmd 'mmc init; mmc init;ext2load mmc 0:1 0x00800000 /boot/uImage; if ext2load mmc 0:1 0x01100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
- If you have a kernel that supportsPogoplug V4 then set arcNumber and machid.
Warning: don't do this if you're not sure, because it won't boot with a vanilla kernel after the arcNumber changed from 2097.
A vanilla Debian or Arch should boot fine with arcNumber 2097.
# fw_setenv arcNumber 3960 # fw_setenv machid F78
- Shutdown and cold start with Debian or Arch rootfs
Addendum:
Thanks to dhead for pointing out that the mmc_init does not seem to work the first time, so the work around in mmc_bootcmd is to include it twice:
# fw_setenv mmc_bootcmd 'mmc init; mmc init;ext2load mmc 0:1 0x00800000 /boot/uImage; if ext2load mmc 0:1 0x01100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'