View previous topic :: View next topic |
Author |
Message |
qfly n00b

Joined: 13 Feb 2010 Posts: 7
|
Posted: Tue Dec 03, 2013 8:56 am Post subject: How to make a kernel which can boot gentoo on usb disk |
|
|
I want my gentoo in home or office or other place i want to.so I decide to install it on my usb disk.I use kernel and initramfs file from SystemRescue CD to get it work.
I have try a lot kernels like gentoo-sources debian-sources alt-sources sysrescue-std-sources follow this wiki:http://wiki.gentoo.org/wiki/Install_Gentoo_on_a_bootable_USB_stick
but it never get work.
Only sysrescue-std-sources can get boot with some error message.
Can someone help to compile a kernel can get my gentoo,thanks a lot. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3617
|
Posted: Tue Dec 03, 2013 11:06 am Post subject: |
|
|
There is hardly any difference between USB disc and IDE/SATA disc. If you can install gentoo at all, you can also put it on usb drive.
I'd suggest you to follow regular installation manual using your usb drive as target device. http://www.gentoo.org/doc/en/handbook/
On the other hand, "your gentoo" might mean entire laptop as well as your /home directory's content. In latter case you only need /etc/fstab entry (or udev rule) to mount it as /home/user rather than /mnt/user |
|
Back to top |
|
 |
javeree Guru

Joined: 29 Jan 2006 Posts: 459
|
Posted: Tue Dec 03, 2013 12:15 pm Post subject: |
|
|
The kernel is not a problem. The only thing you must take care of is that the USB drivers are built-in (or in an initramfs).
The main issue is getting grub to work. If you want the USB drive to work on multipe PCs, you must assume it will get a 'random' /dev/sdx name. Therefore you cannot simply state the correct drivename in the grub configuration. Instead grub must search for the correct drive with the UUID. I did it once on a USB harddrive (I had to use grub2 for it), but it took me a lot of experimentation to get it right. I forgot to write good documentation, and at the time grub2 was still beta, so a lot may have changed.
Another option - probably an earier one would be using isolinux or similar to boot.
By the way: don't build gentoo on the usb stick itself. I tried it, and because the compilation results in many writes, a usb stick died in just a few months. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3617
|
Posted: Tue Dec 03, 2013 4:43 pm Post subject: |
|
|
Funny, afair grub 1 had always been considering it's own device (hd0). I've never had any problems with making it boot from pendrive |
|
Back to top |
|
 |
javeree Guru

Joined: 29 Jan 2006 Posts: 459
|
Posted: Tue Dec 03, 2013 5:59 pm Post subject: |
|
|
You could be right.
My problem(s) where about more than grub alone.
It also included passing the right 'root=' to the kernel with multiple usb drives connected to the same bus in an unknown order.
I also have a PC where I grub-boot from a pendrive (and yes, I think that is with grub1), but once booted, it looks like someone switched drivenames, so I had to resort to drive mapping.
I'm not claiming I did it the 'right' way. I just did it in a way that worked when I switched between PCs. If only I had documented, then I wouldn't have to rediscover it next time  |
|
Back to top |
|
 |
qfly n00b

Joined: 13 Feb 2010 Posts: 7
|
Posted: Wed Dec 04, 2013 1:36 pm Post subject: |
|
|
javeree wrote: | The kernel is not a problem. The only thing you must take care of is that the USB drivers are built-in (or in an initramfs).
The main issue is getting grub to work. If you want the USB drive to work on multipe PCs, you must assume it will get a 'random' /dev/sdx name. Therefore you cannot simply state the correct drivename in the grub configuration. Instead grub must search for the correct drive with the UUID. I did it once on a USB harddrive (I had to use grub2 for it), but it took me a lot of experimentation to get it right. I forgot to write good documentation, and at the time grub2 was still beta, so a lot may have changed.
Another option - probably an earier one would be using isolinux or similar to boot.
By the way: don't build gentoo on the usb stick itself. I tried it, and because the compilation results in many writes, a usb stick died in just a few months. |
I have found a kernel option rootdelay,have this option make alt-kernel works,I think it can also makes other works.
Accuatualy the problem is USB drivers in kernel works.But the usb disk isn't spined up.
Set rootdelay=10 will make the disk spined up,Then everythings go ok.
by the way,I use syslinux as my boot loader.
Now I am on my gentoo on my usb disk booted by the alt-kernel,Thanks all of you,Thanks.
Will someone edit the wiki page in my first post about the option rootdelay,this will be greate help I think.
This is a part of my syslinux.cfg below:
Code: | LINUX ../kernel-genkernel-x86_64-3.10.17-alt381-amd64
APPEND root=/dev/ram0 real_root=LABEL=FUNTOO_USB_ROOT rootfstype=ext4 scandelay=5 rootdelay=10 ro
INITRD ../initramfs-genkernel-x86_64-3.10.17-alt381-amd64 |
|
|
Back to top |
|
 |
|