Updating Ben with an SD

From Qi-Hardware
Jump to: navigation, search

Contents

[edit] How to update the built-in software on the Ben NanoNote using an SD card

  1. Read Updating_Ben_NanoNote_software first
  2. Update u-boot ( if required) using usbboot
  3. Create an OpenWRT installation on your SD card along with a copy of the rootfs
  4. Boot the OpenWRT installed on the SD card
  5. Use the OpenWRT commands to re-flash your NanoNote


[edit] Updating u-boot using usbboot

Boot your NanoNote in USB_BOOT_mode then on your workstation:

$ sudo usbboot
:> boot
:> nerase 0 8 0 0
:> nprog 0 openwrt-xburst-qi_lb60-u-boot.bin 0 0 -n
...
Error - can't read bulk data from Ingenic device
...
:> exit

Note the nerase command above erasing 8 blocks, each 512 KB in size, so a total of 4 MB starting a block "0", i.e. the first block on the NAND.


[edit] Creating an OpenWRT installation on your SD card

uboot has bugs when dealing with very large partitions. Large MicroSD cards won't boot. When creating the ext2 partition, make sure it is <=2GB. this bug have been fixed in this commit

Some of the parameters (such as the path to the SD card device) may need adjusting for your workstation before you run these commands.

$ sudo mkfs -t ext2 /dev/mmcblk0p1
$ sudo mount /dev/mmcblk0p1 /mnt
$ cd /mnt/
$ wget http://downloads.qi-hardware.com/software/images/Ben_NanoNote_2GB_NAND/latest/openwrt-xburst-qi_lb60-rootfs.tar.gz -O - | sudo tar xz
$ mkdir boot
$ wget http://downloads.qi-hardware.com/software/images/Ben_NanoNote_2GB_NAND/latest/openwrt-xburst-qi_lb60-uImage.bin -O boot/uImage
$ wget http://downloads.qi-hardware.com/software/images/Ben_NanoNote_2GB_NAND/latest/openwrt-xburst-qi_lb60-root.ubi.bz2
$ bunzip2 openwrt-xburst-qi_lb60-root.ubi.bz2
$ cd
$ sudo umount /mnt/

[edit] Use OpenWRT on the SD card to re-flash your NanoNote

Insert the SD card into the NanoNote, hold down the [M] key and power on.

[edit] To see the configuration of your NAND

root@ben:~# mtdinfo
Count of MTD devices:           4
Present MTD devices:            mtd0, mtd1, mtd2, mtd3
Sysfs interface supported:      yes

root@ben:~# mtdinfo -m 1
mtd1
Name:                           NAND KERNEL partition
Type:                           nand
Eraseblock size:                524288 bytes, 512.0 KiB
Amount of eraseblocks:          8 (4194304 bytes, 4.0 MiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  4096 bytes
OOB size:                       128 bytes
Character device major/minor:   90:2
Bad blocks are allowed:         true
Device is writable:             true

# ..or if you have ruby installed:

cat <<EOF >/root/lsmtd
#!/usr/bin/env ruby
File.open '/proc/mtd' do |file|
  file.each_line do |line|
    if line.match %r'(mtd\d): ([0-9a-f]{8}) [0-9a-f]{8} "([^"]+)"'
      device, size, name = $1, $2, $3
      puts '%s:% 5iMB "%s"'% [ device, size.to_i( 16) / 1_048_576, name]
    end
  end
end
EOF

chmod +x /root/lsmtd
/root/lsmtd
mtd0:    4MB "NAND BOOT partition"
mtd1:    4MB "NAND KERNEL partition"
mtd2:  256MB "NAND ROOTFS partition"
mtd3: 1784MB "NAND DATA partition"

[edit] To re-flash the kernel

$ flash_eraseall /dev/mtd1
$ nandwrite -p /dev/mtd1 /boot/uImage

[edit] To re-flash the rootfs

$ ubiformat /dev/mtd2 -f openwrt-xburst-qi_lb60-root.ubi

Any changes made to the rootfs ( such as new packages installed) will be lost. Please keep a diary of changes you make to your rootfs so they can be re-applied after you upgrade.

[edit] To format your data partition

WARNING: these commands destroy all data in your data partition

Clearly you only want this if you're upgrading from a stock NanoNote that only has 3 partitions. The kernel and rootfs steps can be used without this step to upgrade your NanoNote without affecting your data.

$ ubiformat /dev/mtd3

[edit] To finish

$ poweroff

Remove the SD card and ( if everything worked) boot the NanoNote into the latest system. If not, please ask on IRC.

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export