maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Troubleshooting (https://talk.maemo.org/forumdisplay.php?f=6)
-   -   How to boot from USB HD? (https://talk.maemo.org/showthread.php?t=23039)

qole 2008-08-23 00:07

Re: How to boot from USB HD?
 
Ok, connected my HD, opened two terminals, and then when the flasher was waiting at the dropbear prompt, I went to the second terminal (as root, in the directory above my initfs_flasher dir) and did:
Code:

cp /dev/sda2 initfs_flasher/initfs/dev/sda2
I now have /mnt/initfs/dev/sda2 but I still can't boot to that partition. So now I need some guidance on workaround #2, the "simple sleep" command at the end of bootmenu.sh.

An interesting side effect: When I boot to internal flash or to an SD partition with the HD connected, my home screen comes up with the USB symbol in the tray and the drive already mounted. When I attempt to boot to the HD, and it fails and then boots to the internal flash, there's no USB symbol, nor is the HD attached (nothing showing under /dev)... An unplug-replug gets the drive online again... I wonder why? (EDIT: This is not the case, after all)

Benson 2008-08-23 00:25

Re: How to boot from USB HD?
 
Quote:

Originally Posted by qole (Post 216596)
I don't have an initfs_flasher folder under /mnt either. I have an initfs folder, but fanoush wrote initfs_flasher. :confused:

Can I copy the file from /mnt/initfs/dev and drop it into the initfs_flasher folder somewhere and get it to copy over when I flash the initfs?

EDIT: AAHHH I think I get it. When the initfs_flasher process gets to the part where it is waiting for an answer from the user about dropbear, I open a second terminal window and "touch .../initfs_flasher/dev/sda2" ? Or maybe "cp .../initfs_flasher/dev/sda1 .../initfs_flasher/dev/sda2"? Then carry on with the install in the first window. Theoretically, this file will get copied over to the initfs.

Close, but no. the names of devices are merely conventional; the actual determination of what gets accessed through the file is from the major and minor numbers (you can see these with ls -l, where the size of an ordinary file would be), so touch will make a regular file, and cp will make a block special file named sda2 and accessing sda1.

Either copy the one from the root filesystem (and maybe chmod to match the others in the initfs?) or use mknod.

qole 2008-08-23 04:41

Re: How to boot from USB HD?
 
Quote:

Originally Posted by Benson (Post 216609)
Either copy the one from the root filesystem (and maybe chmod to match the others in the initfs?) or use mknod.

As you can see from the post above, this is what I did; I connected the drive and then copied the /dev/sda2 ... I will check the permissions in /mnt/initfs/dev/... hm, slightly different! sda1 (like all of the other partitions) is brw------- and sda2 is brw-r-----. Would that make a difference?

Also, the major and minor numbers of sda, sda1 and sda2 look correct;
sda: 8, 0
sda1: 8, 1
sda2: 8, 2

I would love some guidance on fanoush's second idea...

Quote:

Originally Posted by fanoush (Post 216330)
2 can be solved by hacking end of bootmenu.sh, there is case for special ids so you may need to add similar one to the end after line that sets usb mode to host. Simple sleep should be enough.


qole 2008-08-23 05:23

Re: How to boot from USB HD?
 
OK. So, I set the permissions after copying sda2 (chmod g-r initfs_flasher/initfs/dev/sda2) and I added a new section "usb2)" (which matches my current MENU_5_ID) to the special cases at the bottom of the bootmenu.sh file:
Code:

case "$default_root" in
        off)
                ${T2S} -c
                poweroff
        ;;
        usb2)
                sleep 5
        ;;
esac

There is a noticeable pause after pressing the button on the HD menu choice, but it still fails to boot. Very frustrating.

Is there any kind of diagnostic message I can print on the screen to see exactly what part of the boot attempt is failing? The vague failure message, so typical of this device, is extremely unhelpful...

EDIT: Hmmm, I wonder if I put the special usb2 case at the very end... I think that's what fanoush meant... okay trying again...

EDIT2: Still no dice... interesting note, the HD shows no activity during the boot process, but after the boot failure, there is some activity as OS2008 mounts it.

fanoush 2008-08-23 08:02

Re: How to boot from USB HD?
 
you got it, so maybe the sleep timeout is still too short? you can boot system, as root run 'cat /proc/kmsg' and measure time between switching to host mode or attaching cable and final message with disk partitions detected

I'll try it this evening, usb card reader with my regular bootable card should be enough for such test.

fanoush 2008-08-23 21:00

Re: How to boot from USB HD?
 
OK, got it to boot. There is one more gotcha. The host mode is not enabled until any usb client (!!) module is inserted. So you need to add e.g. 'g_ether' to list of modules. Also for me the device scan took more than 5 seconds. Worked with sleep 7.

The bug/feature of host mode not working with no gadget driver loaded is known, I was already bitten by this in OS2007 days.

bunanson 2008-08-23 21:36

Re: How to boot from USB HD?
 
Quote:

Originally Posted by fanoush (Post 216821)
OK, got it to boot....

Hey, how about me, the totally uninitiated......, please, some instructions pleeeeeeease?

TIA,

bun

qole 2008-08-23 21:51

Re: How to boot from USB HD?
 
C'mon, bun, you know me. When I figure it out, I'll post a how-to.

qole 2008-08-24 00:18

Re: How to boot from USB HD?
 
OK, got it booting.

First: it was a disappointment. Not really any noticeable speed difference, and difficult to use because your entire system is running over a wiggly little USB cable connected to the HD. Perhaps an advantage to this is being able to load your system up with huge apps. But who does that anyway? If you really needs lots of system space, just get a 16GB flash card instead. Perhaps another advantage is being able to boot any computer from a single drive; you can install boot partitions for linux, Mac, Windows, NIT etc.... Hmm, still dubious.

After I've said all that, here's what I did (thanks fanoush, Benson et al!) to get it working. This of course assumes that you've got multiboot, and you've got an external usb storage device that mounts as "sda" on the tablet (you can determine this by looking at /media/usb when you plug in the device). This device could be a USB key or a flash card inserted in a supported flash reader instead of an HD, of course.

1. Use a partitioning app to create a second partition on your HD, formatted as ext2 or ext3 (I used ext3, so the howto assumes this). I used Debian QTParted to shrink my fat32 partition and create a new ext3 partition. It is just not a good idea to make the first partition of any removable device into a linux partition. Windows computers will have difficulty mounting it, and the tablet will do weird things, too, if you boot to it.

http://farm4.static.flickr.com/3014/...714792.jpg?v=0

2. I cloned my OS2008 to my new partition. First I mounted my my new HD partition as /opt. As root:
Code:

insmod /mnt/initfs/lib/modules/2.6.21-omap1/mbcache.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/jbd.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext3.ko
mount -t ext3 /dev/sda2

(note that one or more of the first three commands may fail with "file exists", that's OK)

...and then I used Milhouse's nupgrade.sh script (steps 2-4) to do the cloning.

3. I edited my initfs_flasher/bootmenu.conf file to have the following entry:
Code:

MENU_5_USBMODE=host
MENU_5_NAME="External USB HDD"
MENU_5_ID="usb2"
MENU_5_DEVICE="sda2"
MENU_5_MODULES="g_ether mbcache jbd ext3"
MENU_5_FSTYPE="ext3"
MENU_5_FSOPTIONS="noatime"

4. I added the following to the very end of my initfs_flasher/bootmenu.sh file:

Code:

case "$default_root" in
        usb2)
                sleep 7
        ;;
esac

5a. I started the initfs_flash script to set up the bootmenu. I worked my way through the script, answering yes or no, until the "dropbear ssh" question. I stopped here and ...

5b. ...I opened a second terminal window. I gained root in the second terminal and, in the directory above the initfs_flasher dir (in my case, this is /root), I made sure that the drive was plugged in and working and then issued the following commands:

Code:

cp /dev/sda2 initfs_flasher/initfs/dev
chmod g-r initfs_flasher/initfs/dev/sda2

5c. I then went back to the initfs_flash screen and finished the flashing process.

DONE.

When the system reboots, your tablet should be able to boot to partition 2 on the external usb storage device.

So, fanoush, any possibility of adding some stuff to your initfs_flasher package to eliminate the need to do those hacks?

computerfreek 2008-09-05 20:32

Re: How to boot from USB HD?
 
Quote:

Originally Posted by qole (Post 216853)
OK, got it booting.
3. I edited my initfs_flasher/bootmenu.conf file to have the following entry:
Code:

MENU_5_USBMODE=host
MENU_5_NAME="External USB HDD"
MENU_5_ID="usb2"
MENU_5_DEVICE="sda2"
MENU_5_MODULES="g_ether mbcache jbd ext3"
MENU_5_FSTYPE="ext3"
MENU_5_FSOPTIONS="noatime"

4. I added the following to the very end of my initfs_flasher/bootmenu.sh file:

Code:

case "$default_root" in
        usb2)
                sleep 7
        ;;
esac

?

Can you send me your bootmenu.conf and bootmenu.sh .. I edited mine over and over .. it seems like my usb starts working but then i can not boot to my exteral flash card on my n810.

I need a boot menu setup
like this

internal flash
external mmc card partition 2 ext 2
And the one you made for USB2 !

Hope u can help .

Thank you
Compuerfreek


All times are GMT. The time now is 15:09.

vBulletin® Version 3.8.8