Xburst-tools

From Qi-Hardware
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

[edit] Installing xburst-tools

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

[edit] For Debian-based distributions

The tools are available in Debian and will eventually become installable through the packaging system as follows:

apt-get install xburst-tools

[edit] Building your own package from sources

To build your own package, perform the following steps:

  1. Make sure you have Debian package building tools installed:
    apt-get install devscripts pbuilder
  2. If you did not already have pbuilder installed and set up, make a suitable build chroot:
    sudo pbuilder --create
  3. Change into a suitable directory.
  4. Obtain the source package from Debian. The .dsc file can be obtained as follows:
    dget http://ftp.de.debian.org/debian/pool/main/x/xburst-tools/xburst-tools_201206-1.dsc
  5. If all went well, the sources will be unpacked in a directory called something like xburst-tools-201206. Otherwise, try the following on any downloaded file:
    dpkg-source -x xburst-tools_201206-1.dsc
  6. Change into the source directory and try and build the package:
    pdebuild
  7. If successful, the package will reside in /var/cache/pbuilder/result. It can be installed as follows:
    dpkg -i /var/cache/pbuilder/result/xburst-tools_201206-1_i386.deb

Note that the filenames and URLs in the above will obviously need changing according to the package versions and locations appropriate at the time these steps are attempted.

[edit] Binary packages

To use binary packages from Qi-Hardware, follow these steps:

$ 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

[edit] 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/PKGBUILD
$ makepkg
$ su -c 'pacman -U xburst-tools_201012.tar.xz'

[edit] 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 /

[edit] 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

[edit] 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.

[edit] 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


[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


[edit] usbboot.cfg

/etc/xburst-tools/usbboot.cfg has the correct settings for the Ben NanoNote:

# [PLL]
EXTCLK = 12	#Define the external crystal in MHz
CPUSPEED = 252	#Define the PLL output frequency
PHMDIV = 3	#Define the frequency divider ratio of PLL=CCLK:PCLK=HCLK=MCLK
BOUDRATE = 57600	#Define the uart boudrate
USEUART = 0	#Use which uart, 0/1 for jz4740,0/1/2/3 for jz4750

# [SDRAM]
BUSWIDTH = 16	#The bus width of the SDRAM in bits (16|32)
BANKS = 4	#The bank number (2|4)
ROWADDR = 13	#Row address width in bits (11-13)
COLADDR = 9	#Column address width in bits (8-12)
ISMOBILE = 0	#Define whether SDRAM is mobile SDRAM, this only valid for Jz4750 ,1:yes 0:no
ISBUSSHARE = 1	#Define whether SDRAM bus share with NAND 1:shared 0:unshared
DEBUGOPS = 0

# [NAND]
NAND_BUSWIDTH = 8	#The width of the NAND flash chip in bits (8|16|32)
NAND_ROWCYCLES = 3	#The row address cycles (2|3)
NAND_PAGESIZE = 4096	#The page size of the NAND chip in bytes(512|2048|4096)
NAND_PAGEPERBLOCK = 128	#The page number per block
NAND_FORCEERASE = 1	#The force to erase flag (0|1)
NAND_OOBSIZE = 128	#oob size in byte
NAND_ECCPOS = 12	#Specify the ECC offset inside the oob data (0-[oobsize-1])
NAND_BADBLOCKPOS = 0	#Specify the badblock flag offset inside the oob (0-[oobsize-1])
NAND_BADBLOCKPAGE = 127	#Specify the page number of badblock flag inside a block(0-[PAGEPERBLOCK-1])
NAND_PLANENUM = 1	#The planes number of target nand flash
NAND_BCHBIT = 4		#Specify the hardware BCH algorithm for 4750 (4|8)
NAND_WPPIN = 0		#Specify the write protect pin number
NAND_BLOCKPERCHIP = 0	#Specify the block number per chip,0 means ignore

[edit] 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"

[edit] 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.

[edit] jzboot

[edit] 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/


[edit] 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