LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS 7.1 installation on USB (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-7-1-installation-on-usb-4175434354/)

Alessandro.Valentini 10-27-2012 09:07 AM

LFS 7.1 installation on USB
 
Hi all, this is my first post on this forum but I've found a lot of useful answer here in this days.

I'm tryng to create a small LFS installation on a usb drive as base for my degree project.
I've successfully installed LFS on a virtual machine and transferred it to my usb pendrive using rsync.
It boots, but my grub.cfg is this:
Quote:

# Begin /boot/grub/grub.cfg

set default=0

set timeout=5

insmod ext3

set root=(hd0,1)

menuentry 'GNU/Linux, with Linux 3.2.6-lfs-7.1'
{
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b0705ec1-d02f-41d9-8bbd-8caf1cd02d70
linux /boot/vmlinuz-3.2.6-lfs-7.1 rootdelay=20 root=/dev/sdb1 ro
}
I will use UUID (or label) only to boot on any machine, to do that I have to create an initrd file or build all needed modules in the kernel (right?), but which are the needed modules?
Looking at some tutorial seems that I have all I need, but my LFS gives a kernel panic if I remove /dev/sdb1.

I'm using Linux From Scratch 7.1 with kernel 3.2.6


Thank you all in advance and sorry for my english.

EDDY1 10-27-2012 07:10 PM

Are you installing from usb or to the usb drive?
You set boot to hd0,1 which would be sda but you set root to sdb1

Correction you set root to (hd,1) then /boot/vmlinuzxxxxxroot sdb1

Alessandro.Valentini 10-28-2012 06:19 AM

Quote:

Originally Posted by EDDY1 (Post 4816441)
Are you installing from usb or to the usb drive?
You set boot to hd0,1 which would be sda but you set root to sdb1

Correction you set root to (hd,1) then /boot/vmlinuzxxxxxroot sdb1

I have LFS already installed on my pendrive, and it works but I want a booloader able to run my installation on any computer without modify menuentry.

"set root=(hd0,1)" outside the menuentry is a remains of LFS default bootloader, thank you for the advice I removed it.

However seems that " set root='...' " inside menuentry has no effect on grub: I've done several trials and I can boot with "hd0,1" "hd1,1" "hd0,msdos1" "hd1,msdos1" and no "set root= ..." and all times my LFS starts.
Probably is overrided by the option " --set=root <UUID> "

Now I use a menu entry like this:
Quote:

menuentry 'GNU/Linux, with Linux 3.2.6-lfs-7.1'
{
search --no-floppy --fs-uuid --set=root b0705ec1-d02f-41d9-8bbd-8caf1cd02d70
linux /boot/vmlinuz-3.2.6-lfs-7.1 rootdelay=20 root=/dev/sdb1 ro
}
but I think that I cannot boot on a pc with two hdd, because my pendrive becomes sdc device.

spiky0011 10-28-2012 06:22 AM

Hi

The pc would have to be set to boot from usb 1st not harddrive 1st

Alessandro.Valentini 10-28-2012 07:11 AM

Quote:

Originally Posted by spiky0011 (Post 4816644)
Hi

The pc would have to be set to boot from usb 1st not harddrive 1st

The boot in bios order is CD -> USB -> HDD and it works.

My problem is that in device order the USB in placed after HDDs, I even changend the boot order in USB -> CD -> HDD but the pendrive still remain /dev/sdb.
I don't know if this is a standard or not, but means that grub cannot recognize the boot partition on some machines.

I know that I can simply change the menuentry from grub pressing 'e', but is not the optimal solution, so I'm looking to use UUID or label instead of /dev/sdXY. Even a workaround is a good solution.

spiky0011 10-28-2012 07:19 AM

Mine is set the same as you but it is permenantly connected to machine so no problem.
What would happen if you added extra menuentry allowing for different options maybe add an entry root=/dev/sdc1 /dev/sdd1 just thinking out loud

Alessandro.Valentini 10-28-2012 07:43 AM

Quote:

Originally Posted by spiky0011 (Post 4816665)
What would happen if you added extra menuentry allowing for different options maybe add an entry root=/dev/sdc1 /dev/sdd1 just thinking out loud

Could be a solution, but not the most elegant. Is mine plan C ;)

My ideas is to create a menuentry like this:
Quote:

menuentry 'GNU/Linux, with Linux 3.2.6-lfs-7.1'
{
search --no-floppy --fs-uuid --set=root b0705ec1-d02f-41d9-8bbd-8caf1cd02d70
linux /boot/vmlinuz-3.2.6-lfs-7.1 rootdelay=20 root=b0705ec1-d02f-41d9-8bbd-8caf1cd02d70 ro
}
To do that I need to compile some modules into the kernel, but I'm not able to find a list of them.
Should be file system modules, USB mass storage, USB UHCI, USB OHCI and some scsi modules, but are yet built in a default recent linux kernel.

Another solution is to create a initrd image, and I have found this tutorial, but in LFS you shouldn't need an initrd, so this is plan B.

Edit:
another question: the configuration loaded by menuconfig is standard for a kernel version or is generated using machine information or host system information?
I'm not shure, but I think that the default configs loaded for linux 3.2.6 in VM and in my physical system are a bit different.

EDDY1 10-28-2012 12:23 PM

Quote:

The boot in bios order is CD -> USB -> HDD and it works.

My problem is that in device order the USB in placed after HDDs, I even changend the boot order in USB -> CD -> HDD but the pendrive still remain /dev/sdb.
A flash drive is usually recognized as hdd in bios


All times are GMT -5. The time now is 10:04 AM.