bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« on: August 01, 2011, 09:28:59 PM » |
|
I installed the latest DENX U-Boot, U-Boot 2011.06 (Jul 03 2011 - 02:54:01), compiled for SheevaPlug. I have had no problems with it, other than my ignorance. I can now boot from a ubifs partition on MTD NAND. The commands in this version more closely match those in the DULG manual, http://www.denx.de/wiki/DULG/Manual, than those in Marvell U-Boot. There are still some gaps, notably for the ubi commands: ubi - ubi commands ubifsload- load file from an UBIFS filesystem ubifsls - list files in a directory ubifsmount- mount UBIFS volume ubifsumount- unmount UBIFS volume
Marvell>> ? ubi ubi - ubi commands
Usage: ubi part [part] [offset] - Show or set current partition (with optional VID header offset) ubi info [l[ayout]] - Display volume and ubi layout information ubi create[vol] volume [size] [type] - create volume name with size ubi write[vol] address volume size - Write volume from address with size ubi read[vol] address volume [size] - Read volume to address with size ubi remove[vol] volume - Remove volume [Legends] volume: character name size: specified in bytes type: s[tatic] or d[ynamic] (default=dynamic)
Marvell>> ? ubifsmount ubifsmount - mount UBIFS volume
Usage: ubifsmount <volume-name> - mount 'volume-name' volume
I tried to find clues in the source code, but I founf the following by trial and error: Marvell>> ubi part nand0,2 Creating 1 MTD partitions on "nand0": 0x000000500000-0x000020000000 : "mtd=2" UBI: attaching mtd1 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 mtd1 to ubi0 UBI: MTD device name: "mtd=2" UBI: MTD device size: 507 MiB UBI: number of good PEBs: 4053 UBI: number of bad PEBs: 3 UBI: max. allowed volumes: 128 UBI: wear-leveling threshold: 4096 UBI: number of internal volumes: 1 UBI: number of user volumes: 1 UBI: available PEBs: 0 UBI: total number of reserved PEBs: 4053 UBI: number of PEBs reserved for bad PEB handling: 40 UBI: max/mean erase counter: 25/10 Marvell>> ubifsmount rootfs UBIFS: mounted UBI device 0, volume 1, name "rootfs" UBIFS: mounted read-only UBIFS: file system size: 515837952 bytes (503748 KiB, 491 MiB, 3998 LEBs) UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: LZO UBIFS: reserved for root: 0 bytes (0 KiB) Marvell>> ubifsload 0x800000 /boot/uImage Loading file '/boot/uImage' to addr 0x00800000 with size 1579576 (0x00181a38)... Done Marvell>> iminfo 0x800000
## Checking Image at 00800000 ... Legacy image found Image Name: Debian kernel Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1579512 Bytes = 1.5 MiB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #1 on: August 02, 2011, 03:47:10 PM » |
|
I can now boot from a ubifs partition on MTD NAND. I don't suppose anyone has any details on how to create/setup a file-system on NAND? In particular, how to create (say) 100MB and 400MB ubifs partitions, put /boot onto the former and leave the latter as and empty but mountable (writeable) file-system?
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #2 on: August 02, 2011, 04:31:01 PM » |
|
U-Boot 2011.06 (Jul 03 2011 - 02:54:01) I mentioned in another thread that I could not get this u-boot to boot from USB (usb stick(s) or harddrives). It works when booting from NAND or MMC. I perservered for a week and gave up and went back to using the pingtoo u-boot.
|
|
|
|
|
Logged
|
|
|
|
|
sfzhi
Jr. Member

Karma: 1
Posts: 83
|
 |
« Reply #3 on: August 03, 2011, 11:25:17 AM » |
|
I don't suppose anyone has any details on how to create/setup a file-system on NAND?
If I were you I would just create a UBI image on another Linux computer and then flash it to the plug with plain "nand write". You don't really need all those advanced ubifs features of u-boot. I'm curious, why do you need a separate ubifs partition for /boot? How is that better than having the kernel on a separate raw MTD partition?
|
|
|
|
|
Logged
|
Lack of knowledge is not such a big problem, unwillingness to learn is.
|
|
|
|
bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #4 on: August 03, 2011, 01:19:32 PM » |
|
I used Martin Michlmayr's instructions on http://www.cyrius.com/debian/kirkwood/sheevaplug/install.html to upgrade U-Boot and install the testing version of Debian Linux. I got there from the Debian page in the Plug Wiki, http://plugcomputer.org/plugwiki/index.php?title=Main_Page. Ubifs is recommended on another Plug Wiki page, http://plugcomputer.org/plugwiki/index.php/Installing_Debian_To_Flash. That page refers to http://www.linux-mtd.infradead.org/doc/ubifs.html#L_overview for more information. With a recent Debian kernel, ubifs is built in. Still, it is tricky to get Linux to mount it as root. You have to pass the right arguments to the kernel by setting bootargs in U-Boot. In my case, "console=ttyS0,115200n8 root=ubi!rootfs rw rootfstype=ubifs rootflags=noatime,rw mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs)" are the ones I used. To read the kernel and Initrd from ubifs, you have to mount it first: "ubi part nand0,2; ubifsmount rootfs; ubifsload 0x1100000 /boot/uInitrd; ubifsload 0x800000 /boot/uImage". Note, uInitrd and Uimage are in the boot directory on the root ubi filesystem. In order to create, format and mount ubifs volumes, you need to install the mtd-utils. As a bonus, you get some flash tools including fw_printenv and fw_setenv.
|
|
|
|
|
Logged
|
|
|
|
|
bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #5 on: August 03, 2011, 01:48:25 PM » |
|
I should add that it didn't work until I changed the root= argument to ubi!rootfs. The exclamation point. '!' is mentioned in the UBI FAQ, http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs, for situations where the kernel boot loader gets "confused". I went through several iterations of this before I got it to work. I had a working system on an 8 GB SD flash that I copied to make the ubifs image. I modified etc/fstab on the copy, but that by itself is not enough. Root has to be mounted before fstab can be read.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #6 on: August 03, 2011, 05:14:08 PM » |
|
I'm curious, why do you need a separate ubifs partition for /boot? Everything else is on an external USB drive, but there are/were/could be problems trying to boot from USB (which is through a hub), so at the moment I have /boot left on the SDHC card. But that seems a bit of a waste of a 16GB SDHC card (which also juts out from the box), so if I were able to use the NAND instead (with ubifs - not jffs2) I'd free up the SDHC card and make some use of the internal NAND.
|
|
|
|
|
Logged
|
|
|
|
|
bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #7 on: August 03, 2011, 10:51:42 PM » |
|
You don't need a separate filesystem for /boot. I have the whole Debian base running on one ubifs partition. The SheevaPlug came with three partitions defined on the MTD NAND:
# cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 "u-boot" mtd1: 00400000 00020000 "uImage" mtd2: 1fb00000 00020000 "root"
u-boot is 1 MB, uImage is 4 MB and root is the remaining 507 MB. It came with a basic linux using jffs2 on root. It was only using about 10% of root. My base Debian install took about half of it, reformatted as ubifs. It is now about 75% full after I installed x11vnc and xrfb. I am thinking I will set it up to mount /usr/local from a USB or SD drive. Then I can put most applications there. I am also thinking that with DENX U-Boot working so well there really is no need for the 4 MB NAND partition for uImage. It seems to load quicker from ubifs.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #8 on: August 04, 2011, 05:34:07 PM » |
|
You don't need a separate filesystem for /boot. I do if I want the rest of the files to be on an external USB drive through a hub. And I don't want things like /var to be on a solid-state device that can wear out (I've had an SDHC card get to the read-only state, which is why I moved to the USB drive). It seems to load quicker from ubifs. Yes, ubifs is quicker the jffs2 (apparently) but the older U-boots don't have any ubiload command.
|
|
|
|
|
Logged
|
|
|
|
|
bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #9 on: August 04, 2011, 06:21:11 PM » |
|
I see your point. Make a separate /boot partition and don't change it very often.
You could try re-defining the mtd partitions. This is done in uboot when the mtdparts environment variable is set. On my SheevaPlug it is "mtdparts=mtdparts=orion_nand:512k(uboot),4m@1m(kernel),507m@5m(rootfs)".
Maybe "mtdparts=mtdparts=orion_nand:512k(uboot),100m@1m(boot),407m@105m(extra)" or "mtdparts=mtdparts=orion_nand:512k(uboot),4m@1m(kernel),100m@5m(boot),403m@105m(extra)" if you want to keep a uboot image in the default location. Note, my math might be wrong, it needs to be verified.
I don't remember if I had to set mtdids first or if uboot took care of it: "mtdids=nand0=orion_nand". Then in my boot sequence, I run "ubi part nand0,2; ubifsmount rootfs; ubifsload 0x1100000 /boot/uInitrd; ubifsload 0x800000 /boot/uImage". After a ubifs is mounted, you can run ubifsls to list files on the file system.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #10 on: August 05, 2011, 11:02:02 AM » |
|
After a ubifs is mounted... ...but first it needs to be created as a file system. I don't think I can just create the device then run "mkfs -t ubi".
|
|
|
|
|
Logged
|
|
|
|
|
bnborg
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #11 on: August 06, 2011, 04:43:14 PM » |
|
No, you have to install first to USB or SD. Then use "apt-get install mtd-utils" to get the ubi utilities. In order to boot with root on ubifs, it has to be compiled into the kernel instead of loaded as a module. Debian kernels 2.6.25 and later should include it. I changed the layout on my SheevaPlug for a separate boot partition. It is now: root@debian:~# cat /proc/mtd dev: size erasesize name mtd0: 00080000 00020000 "uboot" mtd1: 02800000 00020000 "boot" mtd2: 1d700000 00020000 "rootfs" root@debian:~#
U-Boot 2011.06 (Jul 03 2011 - 02:54:01) Marvell>> mtdparts
device nand0 <orion_nand>, # parts = 3 #: name size offset mask_flags 0: uboot 0x00080000 0x00000000 0 1: boot 0x02800000 0x00100000 0 2: rootfs 0x1d700000 0x02900000 0
active partition: nand0,1 - (boot) 0x02800000 @ 0x00100000
defaults: mtdids : none mtdparts: none Marvell>> I intend to boot SD most of the time and save my NAND from too many writes.
|
|
|
|
|
Logged
|
|
|
|
|
|