nanonixos

Documentation
Login

From the ben

Script mtd.nn

usbboot

source

You can install the xburt-stools by nix using

  nix-env -i xburst-tools

For the flashing programs to work, you have to start the nanonote in usbboot mode. To do so, you can either:

Notes on the flashing software:

nerase

nerase  block_offset  block_count  device  chip
 block_offset: the index of the first block to erase
 block_count:  the number of blocks to erase
 device:       device index number
 chip:         flash chip index number

[edit] nprog

nprog  page_offset  path_to_image  device chip  image_type
 page_offset:    the index of the page at which the image should start
 path_to_image:  the file system path to the image
 device:         device index number
 chip:           flash chip index number
 image_type:     -n:  no oob
                 -o:  with oob no ecc
                 -e:  with oob and ecc

Examples

To Erase the whole NAND:

$ sudo usbboot -c "boot;nerase 0 4096 0 0"

To re-flash just the u-boot:

$ sudo usbboot -c "boot;nprog 0 openwrt-xburst-u-boot.bin 0 0 -n"

To re-flash just the kernel partition:

$ sudo usbboot -c "boot;nprog 1024 openwrt-xburst-uImage 0 0 -n"

To re-flash just the rootfs partition:

$ sudo usbboot -c "boot;nprog 2048 openwrt-xburst-qi_lb60.ubi 0 0 -n"


xbboot

xbboot [vendor_request] ... (must run as root)

 -h --help                                 print this help message
 -v --version                              print the version number
 [-u | --upload] <address> <path>          upload file at <path> to <address>
then jump to <address>

 bulk_read <len>                           read len bulk bytes from USB, write
to stdout
 bulk_write <path>                         write file at <path> to USB
 [get_info | VR_GET_CPU_INFO]              read 8-byte CPU info and write to
stdout
 [set_addr | VR_SET_DATA_ADDRESS] <addr>   send memory address
 [set_len | VR_SET_DATA_LENGTH] <len>      send data length
 [flush_cache | VR_FLUSH_CACHES]           flush I-Cache and D-Cache
 [start1 | VR_PROGRAM_START1] <addr>       transfer data from D-Cache to I-Cache
and branch to I-Cache
 [start2 | VR_PROGRAM_START2] <addr>       branch to <addr> directly

-u will upload the /usr/share/xburst-tools/stage1 to nanonote. then run the
stage1. it will init gpio, serial, pll, sdram, nand. then xbboot will load the
<path> file to sdram at <address> then jump to <address>. for example:

 sudo xbboot -u 0x80600000 /PATH/TO/zImage.bin 

will upload kernel zImage to NanoNote 0x80600000. then run the zImage.

-u can be expressed as series vendor_request like:

#!/bin/bash
xbboot set_addr 0x80002000
xbboot bulk_write /usr/share/xburst-tools/stage1.bin
xbboot start1 0x80002000
xbboot get_info
xbboot flush_cache
xbboot set_addr 0x80600000
xbboot bulk_write /PATH/TO/zImage.bin
xbboot flush_cache
xbboot start2 0x80600000

since the 0x80002000 is the D-Cache address. so we upload the stage1.bin to
0x80002000.