• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1] 2
Author Topic: Trouble following "Boot USB" wiki  (Read 4972 times)
bfmorgan
Guest
« on: April 29, 2009, 06:36:35 PM »

I'm following the "Boot entirely off an external USB device" at http://www.computingplugs.com/index.php/Booting_entirely_off_an_external_USB_device . I'm getting an error when trying to mount /dev/mtdblock1:

Code:
mount /dev/mtdblock1 /mnt/mtd1
mount: /dev/mtdblock1: can't read superblock

My fdisk -l (which matches the wiki article is:
Code:
Disk /dev/sda: 129.2 GB, 129234894848 bytes
255 heads, 63 sectors/track, 15711 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1e9b4b0c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           4       32098+   6  FAT16
/dev/sda2               5       15500   124471620   83  Linux
/dev/sda3           15501       15711     1694857+  82  Linux swap / Solaris

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@SheevaPlug:/mnt/mtd1# mount /dev/mtdblock1 /mnt/mtd1
mount: /dev/mtdblock1: can't read superblock

I can mount /dev/sda2 /media/ssd, so, there is something going on with /dev/mtdblock1. I read a forum that linked this with a flash_nand issue but, that is beyond my pay grade.
« Last Edit: April 29, 2009, 08:10:43 PM by bfmorgan » Logged

bfmorgan
Guest
« Reply #1 on: April 29, 2009, 08:30:38 PM »

I found the issue that is causing the error trying to mount the root.

During the USB recovery process an additional mtd is created for the uImage needed for the recovery process. (see below)

# cat /proc/mtd This should list all the 3 mtd partitions for the u-boot, uImage
and rootfs as shown below.
-sh-3.2# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 1fc00000 00020000 "rootfs"

The wiki needs to be modified to account for those who have recovered the uboot via a USB
Logged

bfmorgan
Guest
« Reply #2 on: April 29, 2009, 08:50:06 PM »

Got another problem following the wiki.

The instructions say:
Code:
mount /dev/sda1 /mnt/sda1

I got an error:

Code:
mount /dev/sda1 /mnt/sda1
mount: unknown filesystem type 'vfat'

So I tried:
Code:
mount -t vfat /dev/sda1 /mnt/sda1
mount: unknown filesystem type 'vfat'

Any thoughts?
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #3 on: April 29, 2009, 09:14:58 PM »

The mtd is the internal flash.  The number of partitions the kernel shows will match the number you specify in your bootargs.  If you don't specify the partitions in your bootargs the kernel will assume the defaults.  Be careful with this because the defaults may not match the partitions you used when your kernel and file system was written to the flash.

If you specify all three partitions the kernel will enumerate them mtd0 for u-boot, mtd1 for uImage, and mtd2 for rootsf.  If you leave out the u-boot partition in the bootargs the kernel will enumerate them mtd0 for uImage, and mtd1 for rootfs.  mtdblock1 is the same partition as mtd1 but accessible as a block device verses a character device.

You need to adjust any instructions you find to what you are specifying in your bootargs.

you should specify the filesystem type when you mount your flash file system.

use:
mkdir /mnt/mtd2
mount -t jffs2 /dev/mtdblock2 /mnt/mtd2


As far as your /dev/sda1 mount error did you format the partition /dev/sda1 as vfat?  You need to 'mkfs.vfat /dev/sda1' after you finish your partitioning with fdisk.  You will also need to initialize the other partitions with the appropriate file systems. So if you didn't do it 'mksf.ext3 /dev/sda2' and 'mkswap /dev/sda3'.
« Last Edit: April 29, 2009, 09:24:14 PM by kilowatt » Logged

bfmorgan
Guest
« Reply #4 on: April 29, 2009, 09:25:21 PM »

I did:
Code:
root@SheevaPlug:/# mkfs.vfat /dev/sda1
mkfs.vfat 3.0.1 (23 Nov 2008)

then:
Code:
mount /dev/sda1 /mnt/sda1
mount: unknown filesystem type 'vfat'

And again the fdisk -l:
Code:
root@SheevaPlug:/# fdisk -l

Disk /dev/sda: 129.2 GB, 129234894848 bytes
255 heads, 63 sectors/track, 15711 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1e9b4b0c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           4       32098+   6  FAT16
/dev/sda2               5       15500   124471620   83  Linux
/dev/sda3           15501       15711     1694857+  82  Linux swap / Solaris
Logged

lamestllama
Newbie
*

Karma: 0
Posts: 14


View Profile
« Reply #5 on: April 30, 2009, 04:00:46 AM »

did you ever discover how to fix this ? I have the same problem now.
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #6 on: April 30, 2009, 05:16:56 AM »

Are you sure you want to use mkfs.vfat? If you do so, you obvioulsy need to have a VFAT-Module for your Kernel. I used mkfs.msdos and did not have any problems at all.
Logged

bfmorgan
Guest
« Reply #7 on: April 30, 2009, 09:43:21 AM »

I'll try mkfs.msdos later today. My intention is to walk through the wiki and add any clarifying statements  to it. This effort will help the group.

Thanks,
Logged

pushbx
Newbie
*

Karma: 0
Posts: 35


View Profile
« Reply #8 on: May 01, 2009, 11:55:49 AM »

bfmorgan,

I will update the wiki so that the mtd mount points shown a bit more clear. 

As far as /dev/sda1.  I checked the kernel tree that came with the sheeva plug and saw that vfat and fat is NOT compiled in as part of the kernel but as a kernel module.  That would explain why it tries to insmod vfat.ko in rc.local.  The stupid thing is that fat.ko and vfat.ko that came with the filesystem does not work with the supplied kernel.

So, I guess it comes down to:

compile your own kernel and make sure vfat is compiled into the kernel instead of a module (this is what I did)
compile the kernel module to match the running kernel.
change /dev/sda1 so that it uses ext2 instead of vfat.  Ext2 is already available to the kernel.  Running ext2 is not a bad idea considering what happened to tomtom.
boot the kernel from NAND flash, and boot the filesystem from /dev/sda2.

That's a lot of choices, I would *like* to add them all to the wiki but will definitely take some time.....
Logged

bfmorgan
Guest
« Reply #9 on: May 01, 2009, 12:16:02 PM »

Pushbx,
  Thanks for the clarifications. I have changed /dev/sda1 to ext2. I have not had a chance to finish the entire process. Tonight I will finish and report my progress.

Thanks again for your excellent wiki and for making the effort to follow my questions. Great job.
Logged

bfmorgan
Guest
« Reply #10 on: May 02, 2009, 05:51:01 PM »

Ok, I got it booting from the USB ssd drive. I'll recap the issues I had.

I'm going to walk down the wiki http://www.computingplugs.com/index.php/Booting_entirely_off_an_external_USB_device. This is created and maintained by our own Pushbx.

1. I had to partion/format my USB drive on another machine because vfat(msdos) was not available in the Marvel kernel release. I created a fat partion (sda1), a ext3 partition (sda2) and a swap partition (sda3).

2. I tried formatting the /dev/sda1 with ext2 instead of fat16 and the uboot ext2load didn't work.

3. My mtdblock2 was my root not the mtdblock1 because I recovered using the Marvel "SheevaPlug Development Kit - USB Flash Recovery from U-Boot-Rev1.2.pdf". It creates

mtd0: "u-boot
mtd1: "uImage
mdt2: "rootfs"

4. "mount /dev/mtdblock1 /mnt/mtd1" had to be changed because of 3 above to "mount /dev/mtdblock2 /mnt/mtd2". This also require the change in mkdir for this mount point.

5. When I executed "cp -av /mnt/mtd2 /mnt/sda2" is created /mnt/sda2/mtd2/ stuff. I had to move that dir up one to /mnt/sda2.

6. While changing the bootargs I used my "mtdparts=nand_mtd" entries for uImage and rootfs. This again was required because of the recover from usb issue above.

mtdparts=nand_mtd:0x300000@0x100000(uImage)ro,0x1fc00000@0x400000(rootfs)rw

Hope this helps,
« Last Edit: May 02, 2009, 06:04:44 PM by bfmorgan » Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #11 on: May 02, 2009, 06:31:01 PM »

if your bootargs only define 2 partitions.
Quote
mtdparts=nand_mtd:0x300000@0x100000(uImage)ro,0x1fc00000@0x400000(rootfs)
Then when this is passed to the kernel as it's command line args

uImage will be /dev/mtd0 and /dev/mtdblock0
rootfs will be /dev/mtd1 and /dev/mtdblock1

if your bootargs define all 3 partitions.
mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x300000@0x100000(uImage)ro,0x1fc00000@0x400000(rootfs)
Then when this is passed to the kernel as it's command line args

u-boot will be /dev/mtd0 and /dev/mtdblock0
uImage will be /dev/mtd1 and /dev/mtdblock1
rootfs will be /dev/mtd2 and /dev/mtdblock2

It's up to you how you want to define the partitions of your flash. But you must be consistent with what you pass to the kernel. And make sure you set all references ie root=/dev/mtdblock2 or which device you write your kernel or files system to accordingly.

ro following the (name) sets the partition to read only
rw following the name is actually an error and will show up as such in dmesg if you look close.
« Last Edit: May 02, 2009, 06:40:55 PM by kilowatt » Logged

pushbx
Newbie
*

Karma: 0
Posts: 35


View Profile
« Reply #12 on: May 04, 2009, 02:17:14 AM »

I've changed the wiki to include the new steps, so hopfully it'll be more clear now.

So did you manage to get ext2 to work correctly?  I've just changed my sda1 partition to ext2 and documented how I did it.
Logged

bfmorgan
Guest
« Reply #13 on: May 04, 2009, 07:22:47 AM »

Thanks for the clarifications to the wiki. I have my plug booting and running off of my usb ssd.

> df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2            123300760    965432 116071988   1% /
tmpfs                   257864         0    257864   0% /lib/init/rw
varrun                  257864       496    257368   1% /var/run
varlock                 257864         0    257864   0% /var/lock
udev                    257864       100    257764   1% /dev
tmpfs                   257864         0    257864   0% /dev/shm
> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00300000 00020000 "uImage"
mtd1: 1fc00000 00020000 "rootfs"

Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #14 on: May 04, 2009, 09:39:13 AM »

pushbx,

With ext2 you don't need the extra partition.  I just put the kernel in /boot of my files system partition and then use.
 
Code:
set bootcmd 'usb start; ext2load usb 0:1 0x800000 /boot/uImage; bootm 0x800000; reset'
set bootargs 'console=ttyS0,115200 mtdparts=orion_nand:0x100000@0x000000(u-boot)ro,0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/sda1 rootdelay=10'

Actually I create a link in /boot/uImage that points to the kernel I want to use so I can switch it easily.

Code:
root@server:~# ls -l /boot
total 8244
lrwxrwxrwx 1 root root      17 May  4 11:14 uImage -> uImage-2.6.30-rc4
-rw-r--r-- 1 root root 2113572 May  4 11:10 uImage-2.6.30-rc4
-rw-r--r-- 1 root root 2094736 May  3 13:01 uImage-2.6.30-rc4-optware-build-2
-rw-r--r-- 1 root root 2098736 May  4 09:03 uImage-2.6.30-rc4.sav
-rw-r--r-- 1 root root 2106760 Mar 19 15:05 uImage.sheeva.20090319

Make it seem like a more normal Linux system setup that way.
« Last Edit: May 04, 2009, 09:43:42 AM by kilowatt » Logged

Pages: [1] 2
Print
Jump to: