Installing Debian To Flash
Contents |
Options, options everywhere
It can be quite confusing trying to compare the various install guides and forum posts simply due to the sheer number of combinations of boot loader versions (both Marvell and upstream), kernel versions (both Marvell and mainline), root filesystem types, storage types, and more. Throw in the myriad "helper" scripts such as the SheevaPlug Installer, and the fact that some boot loader versions and/or SD and USB cards are not up to scratch, and you've got a recipe for getting lost. This guide assumes you want the latest known-good/best versions of everything, you want a minimal number of steps/dependancies, and you are happy to use the "bare" tools (which aren't much more work than figuring out how to use the helper scripts, anyhow, and of course: "Give a man a fish; you have fed him for today. Teach a man to fish and you have fed him for a lifetime").
Specifically, as of early late 2011 this guide will result in:
- boot loader: DENX U-Boot
- kernel: sheeva-with-linux's kernel
- rootfs type: UBIFS
- Debian Squeeze
If you're wondering about the whys and wherefores of the above list, read the next bits. If not, skip ahead to #Overall Process.
The Installer, the Boot Loader and SD cards / USB disks
(or How I Learned to Stop Worrying and Love TFTP)
The Debian installer is a standalone boot image, the most reliable means to boot this image is via TFTP. With late 2009 boot loader versions (U-Boot 3.4.19 on) the plug supports booting from the SD (aka MMC) card in addition to USB disk and via TFTP. However, like others on the forum I found highly variable results with SD and USB booting: things like timing issues, filesystem formats / partition schemes, etc, all can conspire to frustrate the process. Basically, the boot loader's low level SD and USB and/or VFAT/EXT2 filesystem support is not quite there yet. Contrast with TFTP, which has worked every time including with the factory u-boot (v3.4.16). The DENX loader may be better, untested at the time of writing.
If a working uboot is available, and/or you want to have a go bootstrapping from SD card or USB disk, you should be able to directly substitute the approriate MMC or USB boot loader (U-Boot) commands for the TFTP ones, keeping load addresses the same. Ref. U-Boot_Quick_Reference.
Debian vs. Sheeva-with-Linux Kernels
Kernel development for the Marvell Kirkwood platform (i.e. the Sheevaplug) is bounding ahead. Sheeva-with-Linux pumps out a new kernel uImage almost as soon as the upstream stable kernel is available. In early 2010 Debian didn't support installing the kernel to flash, requiring the kernel (and initrd) to be manually burned to flash on every update; which is basically the same work required to use the SwL kernel. The feather in SwL's cap is its README script that makes even that task trivial!
As of ~2011, Debian supports the 'plug.
Oh, and if you are really fond of the plug's existing Marvell kernel, you can simply continue to use that - BUT you will need to stick with the JFFS2 root filesystem, as Marvell's 2.6.22.18 kernel doesn't include UBIFS support.
If with-linux.com is down there is a mirror at http://plugapps.com/mirror/with-linux/.
UBIFS vs. JFFS2
Journalled. Faster. Newer. Free steak knives. What more could you want?
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_overview
Overall Process
- fetch the parts
- update boot loader (u-boot)
- update kernel, part 1
- load the Debian installer via TFTP and install to USB drive
- boot from USB drive
- upgrade filesystem on flash root partition
- clone USB rootfs to internal flash
- update kernel, part 2
Parts Required
- sheevaplug
- SD card or USB disk, 512 MB or larger
- host with FTDI USB serial driver (for console)
- a TFTP server (can be same as console host)
- a recent u-boot image (see below)
- a recent kernel uImage from http://sheeva.with-linux.com/sheeva
- Internet connectivity (both the plug and host)
Optional: a host with openocd installed, in case you need to de-brick the device (if the boot loader update goes bad) (on a Debian squeeze host: 'sudo aptitude install openocd' does the trick)
TFTP server suggestions:
- Win32: http://tftpd32.jounin.net/
- Linux: apt-get install atftpd
- OS X: sudo /sbin/service tftp start (put files in /private/tftpboot/)
- OS X w/ MacPorts: sudo /opt/local/sbin/tftpd -L -c -v -s /tmp/tftp/
- OS X the easy way. Download TFTPServer from http://ww2.unime.it/flr/tftpserver/
Ok, connect your console and off we go:
Fetch the bits
On the TFTP host, save the following to your TFTP directory (see below for where to get these files, your corner shop might be out):
- a recent u-boot image
- a recent Debian installer (uImage and uInitrd files)
- a recent kernel
Don't forget to make sure they are readable by the TFTP server.
U-Boot Images
DENX U-Boot is recommended over the old, buggy Marvell version. Instructions re. upgrading are below.
Debian Installer
The latest installer images should be available at:
http://d-i.debian.org/daily-images/armel/daily/kirkwood/netboot/marvell/sheevaplug/
however, if the automated build fails, the above may not exist; in which case look for the last successful build in
http://d-i.debian.org/daily-images/armel/
For example, if at the time of writing (2011-06-02) the current build was missing, the last successful image could be:
http://d-i.debian.org/daily-images/armel/20110527-16:34/kirkwood/netboot/marvell/sheevaplug/
The above are the daily images, used for testing; if you prefer, you can find the latest stable images here:
You want both the uImage and uInitrd files. Into the TFTP directory they go.
Kernel
http://sheeva.with-linux.com/sheeva/ - what more is there to say? Oh, except that you probably want the latest, and you definitely want the sheeva-2.6.XX-uImage and sheeva-2.6.XX-Modules.tar.gz files. The config file might be good too, if you want to see what kernel config you're running with. Put 'em all in the TFTP directory.
Update the Boot Loader
Not much new here, ref. http://www.cyrius.com/debian/kirkwood/sheevaplug/uboot-upgrade.html
- reset the plug (e.g. issue 'shutdown -r now' or press the reset button or power cycle)
- interrupt the boot process at the "Hit any key to stop autoboot:" countdown
- start TFTP server on the host; configure IP+TFTP address on the plug, load and burn the new uboot image and reset
setenv ipaddr 169.254.1.1 setenv serverip 169.254.78.185 tftpboot 0x0800000 uboot.bin nand erase 0x0 0xa0000 nand write 0x0800000 0x0 0xa0000 reset
Burn a New Kernel
As per #Update the Boot Loader, but for the kernel uImage. Update the boot loader environment to reflect the fact we'll now be using a mainline kernel. Don't quite need this kernel yet, but it'll be handy later...
setenv ipaddr 169.254.1.1 setenv serverip 169.254.78.185 tftpboot 0x2000000 sheeva-2.6.32.2-uImage iminfo nand erase 0x100000 0x400000 nand write 0x2000000 0x100000 0x400000 setenv mainlineLinux yes setenv arcNumber 2097 saveenv reset
Run the Debian Installer
Gettin' into the groove now. Remember to connect the USB drive you'll be installing to.
setenv ipaddr 169.254.1.1 setenv serverip 169.254.78.185 tftpboot 0x0400000 uImage tftpboot 0x0800000 uInitrd setenv bootargs console=ttyS0,115200 base-installer/initramfs-tools/driver-policy=most bootm 0x0400000 0x0800000
Should be more or less a standard install process. The installer raises a few errors (one about partitioning, another (related?) about an unclean install target); be valient and soldier on! (i.e. hit the "ok, sure, just keep going" button).
Answers to Questions
- partition scheme: default
- kernel: none
- user:plug/nosoup4u
As a consequence of not installing a kernel, the "Make the system bootable" step will fail, this is ok (deep breath...); select "Continue without boot loader".
If the "Download release file" step fails, it means that there are some network issues. To check, select "Go Back" and "Execute a shell" in the debian installer main menu.
Run the command "wget http://www.google/com" to check that your plug can reach the internet. If not, edit the file "/etc/resolv.conf" to add the address of your router (worked for me) :
nameserver 192.168.1.1
Boot with USB rootfs
Following assumes you used the default Debian installer partioning scheme; if not amend 'root=/dev/sdaX' as appropriate. That bootargs bit is all one one line. XXX The plain "boot" command does not work because the uboot environment overwrites the root= setting; I had to use bootm instead
setenv bootargs console=ttyS0,115200 mtdparts=nand_mtd:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) root=/dev/sda2 rootwait rw boot <login> dhclient apt-get install mtd-utils ln -fs /proc/mounts /etc/mtab # prevent a stale mtab from confusing things later on...
Using an SD card and rather than sda2 above you may have to use mmcblk0p2 giving
setenv bootargs console=ttyS0,115200 mtdparts=nand_mtd:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) root=/dev/mmcblk0p2 rootwait rw
Convert internal flash root partition to UBIFS
See above re. why this is a very good idea.
You will need to install the mtd-utils package to get the tools needed to do this
apt-get install mtd-utils
ubiformat /dev/mtd2 -s 512 ubiattach /dev/ubi_ctrl -m 2 ubimkvol /dev/ubi0 -N rootfs -m mount -t ubifs ubi0:rootfs /mnt
Clone USB rootfs to internal flash
When we make the copy, we don't want mounted filesystems (dev, tmpfs and so on), though do want anything under any mount points (e.g. /dev/console is always handy), so bind-mount / somewhere, and copy that.
mkdir /tmp/rootfs mount -o bind / /tmp/rootfs/ cd /tmp/rootfs sync cp -a . /mnt/
Fix fstab, or forever suffer the ignominy of a failed mount:
cat <<EOF > /mnt/etc/fstab /dev/root / ubifs defaults,noatime,rw 0 0 tmpfs /var/run tmpfs size=1M,rw,nosuid,mode=0755 0 0 tmpfs /var/lock tmpfs size=1M,rw,noexec,nosuid,nodev,mode=1777 0 0 tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0 EOF
shutdown -r now # cross fingers... nah, it'll work, what could go wrong?
Interrupt the boot loader and update the kernel arguments to reflect the new rootfs:
setenv bootargs 'console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs' saveenv reset
Rejoice, for now you have shown the plug who's boss.
Updating the Kernel
Ok, enough with the rejoicing. You forgot one thing, this new Debian box is missing its kernel modules. May as well use the README scripts at http://sheeva.with-linux.com/sheeva to (re)install the kernel and modules. Ignore the comments in the README script re. boot env - they don't apply to UBIFS.
wget http://sheeva.with-linux.com/sheeva/README-... bash ./README-... --nandkernel
Terminal Log
From whoa to more or less go.
__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__|
** MARVELL BOARD: SHEEVA PLUG LE
U-Boot 1.1.4 (Sep 14 2009 - 15:36:37) Marvell version: 3.4.19
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00
Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz
DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 256MB
DRAM CS[1] base 0x10000000 size 256MB
DRAM Total size 512MB 16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash: 0 kB
CPU : Marvell Feroceon (Rev 1)
Streaming disabled
Write allocate disabled
USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 0
Marvell>>
Marvell>>
Marvell>> setenv ipaddr 169.254.1.1
Marvell>> setenv serverip 169.254.78.185
Marvell>> tftpboot 0x2000000 sheeva-2.6.32.2-uImage
Using egiga0 device
TFTP from server 169.254.78.185; our IP address is 169.254.1.1
Filename 'sheeva-2.6.32.2-uImage'.
Load address: 0x2000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#######################################
done
Bytes transferred = 2861324 (2ba90c hex)
Marvell>> iminfo
## Checking Image at 02000000 ...
Image Name: Linux-2.6.32.2
Created: 2009-12-19 5:54:34 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2861260 Bytes = 2.7 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Marvell>> nand erase 0x100000 0x400000
NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete.
OK
Marvell>> nand write 0x2000000 0x100000 0x400000
NAND write: device 0 offset 0x100000, size 0x400000
4194304 bytes written: OK
Marvell>>
Marvell>> setenv mainlineLinux yes
Marvell>> setenv arcNumber 2097
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>>
------
Marvell>> tftpboot 0x0400000 /uImage
Using egiga0 device
TFTP from server 169.254.78.185; our IP address is 169.254.1.1
Filename '/uImage'.
Load address: 0x400000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#############################
done
Bytes transferred = 1811960 (1ba5f8 hex)
Marvell>> tftpboot 0x0800000 /uInitrd
Using egiga0 device
TFTP from server 169.254.78.185; our IP address is 169.254.1.1
Filename '/uInitrd'.
Load address: 0x800000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###########
done
Bytes transferred = 2714944 (296d40 hex)
Marvell>> setenv bootargs console=ttyS0,115200 base-installer/initramfs-tools/driver-policy=most
Marvell>> bootm 0x0400000 0x0800000
## Booting image at 00400000 ...
Image Name: Debian kernel
Created: 2009-12-31 12:08:11 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1811896 Bytes = 1.7 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 00800000 ...
Image Name: debian-installer ramdisk
Created: 2009-12-31 12:08:12 UTC
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 2714880 Bytes = 2.6 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Starting kernel ...
Uncompressing Linux.................................................................................................................... done, booting the kernel.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.30-2-kirkwood (Debian 2.6.30-8) (waldi@debian.org) (gcc version 4.3.4 (Debian 4.3.4-3) ) #1 Sun Sep 27 22:57:55 UTC 2009
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: Marvell SheevaPlug Reference Board
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
[ 0.000000] Kernel command line: console=ttyS0,115200 base-installer/initramfs-tools/driver-policy=most
...
debian:~# dhclient
Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:50:43:01:6e:6a
Sending on LPF/eth0/00:50:43:01:6e:6a
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
DHCPOFFER from 169.254.78.185
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 169.254.78.185
bound to 192.168.2.3 -- renewal in 1541 seconds.
debian:~#
debian:~# ln -fs /proc/mounts /etc/mtab
debian:~#
debian:~# apt-get install mtd-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
liblzo2-2
The following NEW packages will be installed:
liblzo2-2 mtd-utils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 440kB of archives.
After this operation, 1,217kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.iinet.net.au squeeze/main liblzo2-2 2.03-2 [55.3kB]
Get:2 http://ftp.iinet.net.au squeeze/main mtd-utils 20090606-1 [385kB]
Fetched 440kB in 1s (396kB/s)
Selecting previously deselected package liblzo2-2.
(Reading database ... 17645 files and directories currently installed.)
Unpacking liblzo2-2 (from .../liblzo2-2_2.03-2_armel.deb) ...
Selecting previously deselected package mtd-utils.
Unpacking mtd-utils (from .../mtd-utils_20090606-1_armel.deb) ...
Processing triggers for man-db ...
Setting up liblzo2-2 (2.03-2) ...
Setting up mtd-utils (20090606-1) ...
debian:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 1fb00000 00020000 "root"
debian:~# mtdinfo /dev/mtd2
mtd2
Name: root
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 4056 (531628032 bytes, 507.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:4
Bad blocks are allowed: true
Device is writable: true
debian:~# ubiformat /dev/mtd2 -s 512
ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete
ubiformat: 2950 eraseblocks are supposedly empty
ubiformat: warning!: 1106 of 4056 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete
ubiformat: 2950 eraseblocks are supposedly empty
ubiformat: warning!: 1106 of 4056 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
debian:~# ubiformat /dev/mtd2 -s 512
ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete
ubiformat: 2950 eraseblocks are supposedly empty
ubiformat: warning!: 1106 of 4056 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~#
debian:~# ubiformat /dev/mtd2 -s 512
ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete
ubiformat: 2950 eraseblocks are supposedly empty
ubiformat: warning!: 1106 of 4056 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
Device is writable: true
debian:~# ubiformat /dev/mtd2 -s 512
ubiformat: mtd2 (nand), size 531628032 bytes (507.0 MiB), 4056 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4055 -- 100 % complete
ubiformat: 2950 eraseblocks are supposedly empty
ubiformat: warning!: 1106 of 4056 eraseblocks contain non-ubifs data
ubiformat: continue? (yes/no) yes
ubiformat: warning!: only 0 of 4056 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (yes/no) yes
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 4055 -- 100 % complete
debian:~# ubiattach /dev/ubi_ctrl -m 2
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4056
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 4012
UBI: total number of reserved PEBs: 44
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 0/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 1406
UBI device number 0, total 4056 LEBs (523321344 bytes, 499.1 MiB), available 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB)
debian:~# ubimkvol /dev/ubi0 -N rootfs -m
Set volume size to 517644288
Volume ID 0, size 4012 LEBs (517644288 bytes, 493.7 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "rootfs", alignment 1
debian:~# mount -t ubifs ubi0:rootfs /mnt
UBIFS: default file-system created
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 515708928 bytes (503622 KiB, 491 MiB, 3997 LEBs)
UBIFS: journal size: 25804800 bytes (25200 KiB, 24 MiB, 200 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 4952683 bytes (4836 KiB)
debian:~# mkdir /tmp/rootfs
debian:~# mount -o bind / /tmp/rootfs/
debian:~# cd /tmp/rootfs
debian:/tmp/rootfs# sync
debian:/tmp/rootfs# cp -ar . /mnt/
debian:/tmp/rootfs# ls /mnt/
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
debian:/tmp/rootfs# cat <<EOF > /mnt/etc/fstab
/dev/root / ubifs defaults,noatime,rw 0 0
tmpfs /var/run tmpfs size=1M,rw,nosuid,mode=0755 0 0
tmpfs /var/lock tmpfs size=1M,rw,noexec,nosuid,nodev,mode=1777 0 0
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
EOF
debian:~#
debian:/tmp/rootfs# shutdown -r now
Broadcast message from root@debian (ttyS0) (Wed Jan 6 09:27:39 2010):
The system is going down for reboot NOW!
...
debian:~# wget http://sheeva.with-linux.com/sheeva/README-2.6.32.2
--2010-01-06 09:52:59-- http://sheeva.with-linux.com/sheeva/README-2.6.32.2
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3106 (3.0K) [text/plain]
Saving to: `README-2.6.32.2'
100%[======================================>] 3,106 --.-K/s in 0.04s
2010-01-06 09:53:00 (76.3 KB/s) - `README-2.6.32.2' saved [3106/3106]
debian:~# less README-2.6.32.2
...
debian:~# bash ./README-2.6.32.2 --nandkernel
Downloading files
--2010-01-06 09:53:53-- http://sheeva.with-linux.com/sheeva/2.6.32.2/sheeva-2.6.32.2-Modules.tar.gz
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4315068 (4.1M) [application/x-gzip]
Saving to: `sheeva-2.6.32.2-Modules.tar.gz'
100%[======================================>] 4,315,068 53.0K/s in 80s
2010-01-06 09:55:14 (52.6 KB/s) - `sheeva-2.6.32.2-Modules.tar.gz' saved [4315068/4315068]
--2010-01-06 09:55:14-- http://sheeva.with-linux.com/sheeva/2.6.32.2/sheeva-2.6.32.2-Modules.tar.gz.md5
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 65 [application/x-gzip]
Saving to: `sheeva-2.6.32.2-Modules.tar.gz.md5'
100%[======================================>] 65 --.-K/s in 0s
2010-01-06 09:55:15 (2.00 MB/s) - `sheeva-2.6.32.2-Modules.tar.gz.md5' saved [65/65]
--2010-01-06 09:55:15-- http://sheeva.with-linux.com/sheeva/2.6.32.2/sheeva-2.6.32.2-uImage
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2861324 (2.7M) [text/plain]
Saving to: `sheeva-2.6.32.2-uImage'
100%[======================================>] 2,861,324 52.9K/s in 53s
2010-01-06 09:56:08 (52.7 KB/s) - `sheeva-2.6.32.2-uImage' saved [2861324/2861324]
--2010-01-06 09:56:08-- http://sheeva.with-linux.com/sheeva/2.6.32.2/sheeva-2.6.32.2-uImage.md5
Resolving sheeva.with-linux.com... 216.146.103.100
Connecting to sheeva.with-linux.com|216.146.103.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 57 [text/plain]
Saving to: `sheeva-2.6.32.2-uImage.md5'
100%[======================================>] 57 --.-K/s in 0s
2010-01-06 09:56:09 (1.83 MB/s) - `sheeva-2.6.32.2-uImage.md5' saved [57/57]
Extracting modules
Flashing kernel to NAND
Erasing 128 Kibyte @ 400000 -- 100 % complete.Cleanmarker written at 3e0000.
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
Writing data to block 3 at offset 0x60000
Writing data to block 4 at offset 0x80000
Writing data to block 5 at offset 0xa0000
Writing data to block 6 at offset 0xc0000
Writing data to block 7 at offset 0xe0000
Writing data to block 8 at offset 0x100000
Writing data to block 9 at offset 0x120000
Writing data to block 10 at offset 0x140000
Writing data to block 11 at offset 0x160000
Writing data to block 12 at offset 0x180000
Writing data to block 13 at offset 0x1a0000
Writing data to block 14 at offset 0x1c0000
Writing data to block 15 at offset 0x1e0000
Writing data to block 16 at offset 0x200000
Writing data to block 17 at offset 0x220000
Writing data to block 18 at offset 0x240000
Writing data to block 19 at offset 0x260000
Writing data to block 20 at offset 0x280000
Writing data to block 21 at offset 0x2a0000
debian:~#
debian:~# shutdown -r now
Broadcast message from root@debian (ttyS0) (Wed Jan 6 09:57:08 2010):
The system is going down for reboot NOW!
...
Debian GNU/Linux squeeze/sid debian ttyS0
debian login: root
Password:
Last login: Wed Jan 6 09:51:41 EST 2010 on ttyS0
Linux debian 2.6.32.2 #1 PREEMPT Fri Dec 18 22:54:28 MST 2009 armv5tel
...
debian:~# cat /proc/cpuinfo
Processor : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS : 1192.75
Features : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant : 0x2
CPU part : 0x131
CPU revision : 1
Hardware : Marvell SheevaPlug Reference Board
Revision : 0000
Serial : 0000000000000000
debian:~#