Xburst-tools

From Qi-Hardware
Revision as of 03:19, 26 December 2011 by Xiangfu (Talk | contribs)
Jump to: navigation, search

If you are here, you might want information on Updating Ben NanoNote software

The xburst-tools package gives the usbboot and xbboot commands for working with the NAND.


Contents

Installing xburst-tools

The wget URLs below might not be the latest. Use the latest from here

For Debian-based distributions

$ cd /tmp/

for 32-bit processors:
$ wget http://projects.qi-hardware.com/media/upload/xburst-tools/files/xburst-tools_0.0+201004-0.1_i386.deb

for 64-bit processors:
$ wget http://projects.qi-hardware.com/media/upload/xburst-tools/files/xburst-tools_0.0+201004-0.1_amd64.deb

$ sudo apt-get install --no-install-recommends libconfuse0
$ sudo dpkg -i xburst-tools_0.0+201004-0.1_i386.deb
$ dpkg -L xburst-tools | grep bin/
/usr/bin/usbboot
/usr/bin/xbboot

For Arch Users

Xburst-tools is in the AUR. If you have the Clyde package manager:

$ su -c 'clyde -S xburst-tools'

should install the package with all dependencies. If you have the yaourt package manager:

$ sudo yaourt xburst-tools

should install the package with all dependencies.

If you don't have Clyde or yaourt:

$ mkdir xburst-tools
$ cd xburst-tools
$ wget http://aur.archlinux.org/packages/xburst-tools/xburst-tools/PKGBUILD
$ makepkg
$ su -c 'pacman -U xburst-tools_201012.tar.xz'

To install a tarball

Ensure that the confuse library is installed. Note that if you install it from source, it doesn't build any shared libraries by default. You can fix that by issuing:

$ ./configure --enable-shared

Before actually compiling it by:

$ make
$ sudo make install
$ sudo ldconfig

Then you can continue installing the Xburst-tools:

$ cd /tmp/
$ wget http://projects.qi-hardware.com/media/upload/xburst-tools/files/xburst-tools_0.0+201002-1_i386.bin.tar.bz2
$ sudo tar jxvf xburst-tools_0.0+201002-1_i386.bin.tar.bz2 -C /

usbboot

Should be run as root.

usbboot [options] ...
 -h --help            Print this help message
 -v --version         Print the version number
 -c --command         Direct run the commands, split by ';'
 -f --configure       configure file path
 <run without options to enter commands via usbboot prompt>

Typical usage:

sudo usbboot -c "sub-command-1; sub-command-2"

Sub-commands:

  • boot
  • nerase
  • nprog

boot

Uploads xburst_stage1 and xburst_stage2 to the device. This command must be given to a freshly booted device before the other commands will work.

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

NOTICE

Execute command: boot
CPU data: Boot4740
Already booted.
Execute command: nerase 16 4080 0 0
CPU data: Boot4740
Erasing No.0 device No.0 flash (start_blk 16 blk_num 4080)......
Finish! Return: 00 08 02 00 00 00 00 00 (position 4096)
Force erase, no bad block infomation!

if the position > 4096, the nerase will erase the block 0 which is the bootloader. then you may need flash the bootloader again. which also mean you need the new version xburst-tools 201012, for more info checkout this email


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.

jzboot

Uninstalling xburst-tools

For Debian-based distributions:

$ sudo aptitude remove xburst-tools

..or for the old-schoolers:

$ sudo dpkg -P xburst-tools

If installed from a tarball:

$  sudo rm -f  /usr/local/bin/usbboot
$  sudo rm -f  /usr/local/man/man1/usbboot.1.gz
$  sudo rm -f  /usr/local/bin/xbboot
$  sudo rm -f  /usr/local/man/man1/xbboot.1.gz
$  sudo rm -rf /usr/local/etc/xburst-tools/
$  sudo rm -rf /usr/local/share/xburst-tools/


build

$ git clone git://projects.qi-hardware.com/xburst-tools.git
$ cd xburst-tools
$ ./autogen.sh 
$ ./configure #there are two options: --disable-firmware --with-readline
$ make
Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export