- JTAG dongle, i.e. amontec, amontec2, ..
- Serial cable Male to Female straight through
- A to B USB cable
- Balloon programming board
- Power adapter
Setup your build system
Follow the instructions at SoftwareBuilding Build your software
$ cd <checkout directory> $ make $ make dist
Connect the JTAG dongle to your host pc using the supplied connecter and check it has been detected using lsusb as shown in the highlighted section below
$ lsusb Bus 004 Device 012: ID 0403:cff8 Future Technology Devices International, Ltd Bus 002 Device 013: ID 049f:505a Compaq Computer Corp. Linux-USB "CDC Subset" Device, or Itsy (experimental)
Connect the programming board to the host PC using serial and usb, and the JTAG dongle to the programming board. Make sure port enable is correctly bridged using a jumperlink.
Connect the programming dongle to loon board JTAG connector. Make sure the config file specified with the -f switch matches the dongle you are using. WARNING: Before you issue your programming command you must make sure you are in the directory in which you checked out and built your distribution.
$ cd distro/binaries/ $ openocd -s utils/openocd -f balloon3-amontec2.cfg -f init.cfg -f loadloon.cfg -f loadcpld.cfg -f shutdown.cfg Open On-Chip Debugger 0.4.0 (2010-11-03-18:18) Licensed under GNU GPL v2 For bug reports, read http://openocd.berlios.de/doc/doxygen/bugs.html 6000 kHz jtag_nsrst_delay: 260 jtag_ntrst_delay: 250 Info : pxa270.cpu: hardware has 2 breakpoints and 2 watchpoints trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain Warn : use 'pxa270.cpu' as target identifier, not '0' Info : max TCK change to: 30000 kHz Info : clock speed 6000 kHz Info : JTAG tap: xcr.tap tap/device found: 0x0494c093 (mfg: 0x049, part: 0x494c, ver: 0x0) Info : JTAG tap: pxa270.cpu tap/device found: 0x49265013 (mfg: 0x009, part: 0x9265, ver: 0x4) TapName Enabled IdCode Expected IrLen IrCap IrMask -- ------------------- -------- ---------- ---------- ----- ----- ------ 0 xcr.tap Y 0x0494c093 0x0494c093 5 0x01 0x1f 1 pxa270.cpu Y 0x49265013 0x49265013 7 0x01 0x7f 0x79265013 0x79265013 Info : JTAG tap: xcr.tap tap/device found: 0x0494c093 (mfg: 0x049, part: 0x494c, ver: 0x0) Info : JTAG tap: pxa270.cpu tap/device found: 0x49265013 (mfg: 0x009, part: 0x9265, ver: 0x4) Warn : Bad value '00' captured during DR or IR scan: Warn : check_value: 0x02 Warn : check_mask: 0x07 Error: JTAG error while writing DCSR target state: halted target halted in ARM state due to debug-request, current mode: Supervisor cpsr: 0xc00000d3 pc: 0x00000000 MMU: disabled, D-Cache: disabled, I-Cache: disabled (processor reset) Info : Flash Manufacturer/Device: 0x0001 0x227e flash 'cfi' found at 0x00000000 Writing bootloader into NOR flash - takes about 10 seconds auto erase enabled wrote 262144 bytes from file bootldr/bootldrpxa.fast in 9.230907s (27.733 kb/s) Writing installer/rescue image into NOR flash - takes about 2.5 minutes auto erase enabled wrote 2621440 bytes from file kernel/zImageInitrd in 95.993401s (26.669 kb/s) TapName Enabled IdCode Expected IrLen IrCap IrMask -- ------------------- -------- ---------- ---------- ----- ----- ------ 0 xcr.tap Y 0x0494c093 0x0494c093 5 0x01 0x1f 1 pxa270.cpu Y 0x49265013 0x49265013 7 0x01 0x7f 0x79265013 0x79265013 Programming CPLD - takes about 30 seconds xsvf processing file: "vhdl/cpld/l3cpld.xsvf" XSVF file programmed successfully shutdown command invoked The highlighted lines in the above output illustrate a successful program of the NOR and cpld. The target halted line is necessary to do anything else and if it fails indicates either a cabling problem or a port problem. See the troubleshooting section for details. The wrote lines indicate the initrd and bootloader have been successfully programmed and the XSVF file programmed line indicates the CPLD has been successfully programmed.
Erase Previous Root
If the board has ever had a root previously installed using bbl to overwrite the rootfs will take a while, it can be speed up if you erase the rootfs from bootloader but this will require you to load a new nand kernel. First start minicom
$ minicom -o
Check that it's pointing at the correct serial port ( ctrl-A ctrl-O) then select serial port setup and change it to point at the correct serial port and set baud rate to 115200 8 bit no stop bit and flow control off. Save as default and quit minicom with ctrl-a ctrl-q and restart it reset the board by pressing the reset button on the programming board and interrupt booting by repeatedly pressing space. you should see the following prompt at which you can issue the nand erasechip command.
boot> nand erasechip
Install new NOR Kernel
As described in Erase Previous Root enter bootloader via minicom and issue
boot> load kernel
ctrl-a ctrl-s select xmodem and then navigate to the kernel zImageInitrd which should be in distro/binaries/kernel/ directory, select it with space and press enter to start programming.
Install NAND Kernel (yaffs2)
From minicom, boot into NOR Kernel, login as user root
cd /mnt/ mount boot
From minicom, ctrl-a ctrl-s select zmodem and navigate to the zImage under distro/binaries/kernel/ directory, select it with space and press enter to start getting the image, then create compatibility symlinks:
cd /mnt/boot ln -s zImage vmlinuz
If this is a fresh install of a NAND kernel, for example after clearing the NAND. Then it is important to execute the following commands in bootloader to setup the kernel parameters correctly for booting from a yaffs kernel partition.
boot> yaffs2 boot> params save
NOTE: The following instruction relates to loading the NAND kernel from a bootloader with inbuilt yaffs support. Current bootloaders no longer support yaffs.
Alternatively, you can install that kernel from bootloader, As described in Erase Previous Root enter bootloader via minicom and issue
boot> yaffs write zImage
ctrl-a ctrl-s select xmodem and then navigate to the kernel which should be in distro/binaries/kernel/ directory, select it with space and press enter to start programming.
Install NAND Kernel modules
From minicom, boot into NOR Kernel, login as user root
cd /mnt/ mount root
From minicom, ctrl-a ctrl-s select zmodem and navigate to the modules.tgz tarball under distro/binaries/kernel/ directory, select it with space and press enter to start getting the tarball, then unpack the tarball:
tar xvzf modules.tgz -C /mnt/root/
Installing A New Root FS (using bbl)
bbl is a tool provided in the utils/ directory of the balloonboard checkout. At the host PC command prompt in th checkout directory, having made sure to first close any open minicom sessions issue:
$ utils/bbl --root Look for Uploading rootfs - may take up to 15 minutes Uploaded rootfs OK Elapsed time: 9m23s **Balloon board programming completed** Command completed OK
User and password for new root filesystem is root:rootme
Installing A New Root FS (yaffs2)
What you need:
- a configured rootfs in a tar.gz
- a serial cable
- a nor kernel, cpld and bootloader
- a usb cable
Stop bootloader and boot into NOR initrd
Insert user: root, should not need password.
Mount rootfs, under /mnt/root (assumes yaffs2)
cd /mnt mount root rm -rf /mnt/root/*
Get networking going, follow instructions to get DHCP server at host side and IP configuration (default to 10.1.1.0/24)
ifdown usb0 ifup usb0
Start netcat daemon on the SL40
cd /mnt/root netcat -w 10 -l -p 7000 | tar -x
Push new tarball from your host machine
zcat emdebianrootstrap.tgz | nc -w 15 10.1.1.2 7000
Installing A New Root FS (ubifs)
Installing a new root filesystem on top of ubifs is possible using ChainBooting techniques.
WARNING: If you accidentally mount ubifs root without proper flags set, system will think you are using yaffs2 and filesystem will be corrupted, having to erase it and reinstalled.
Set bootloader to use ubifs parameters with:
boot> nand erasechip boot> set bootscript=ubisetup boot> boot
You should get up to NOR kernel with Initrd, insert user root and log into the system
( /!\ Do not mount root or you'll corrupt the filesystem and you'll have to start over again) cd /mnt/root
Then transfer your root filesystem as explained above by any of the techniques explained, unpack it and configure it.
Reboot your system and get into bootloader by pressing space bar, set parameters to chainboot into new system:
boot> set bootscript=chainboot boot> params save boot> reset
Enjoy your new system, just remember user root and password rootme.
If you ever want to boot into NOR Kernel, stop bootloader stage by pressing space bar and set bootscript=exit, but remember if you mount root, it'll take it as a yaffs2 root and destroy current filesystem.
boot> set bootscript=exit boot> boot
Post Root FS configuration
You can use a script to do automate the configuration:
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true export LC_ALL=C LANGUAGE=C LANG=C /var/lib/dpkg/info/dash.preinst install dpkg --configure -a mount proc -t proc /proc dpkg --configure -a
(The mounting of /proc can be omitted if your rootfs does not contain an X server and it's dependencies.) The script is in balloonboard SVN for the SPECS variant.
Alternatively, you can configure your new root filesystem manually by doing:
/var/lib/dpkg/info/dash.preinst install dpkg --configure -a || dpkg --configure -a
and answer any question that might arise. You might have to do twice the previous step as some packages might not be configured properly (i.e. ifupdown)
You can omit the call to dash.preinst if using Lenny.
User and password for new root filesystem will only be set to root:rootme if using Lenny or older.
Remember to set your own root password when inside the chroot for Squeeze or later or you are likely to end up with a random root password.