On 19/10/2019 22:10, Bruce Dubbs wrote:
On 10/19/19 12:13 PM, Pierre Labastie wrote:

Actually, I do not have a separate boot partition anymore. Usually,
I have one major distro + one or more LFS on my systems. I use
the /boot/grub/grub.cfg of the distro to boot everything, and even,
I now use "update-grub"  to update the config for the lfs systems.
It generates a pretty correct config _if_ I have a /boot/grub/grub.cfg
file on each lfs partition for the corresponding lfs system. That works
pretty well with debian ubuntu suse (not tried fedora).

The problem with that is knowing which grub.conf to change.  Which partition is the grub using for booting?  If you want to edit it to change, for instance, a kernel command line option,  how do you do that?

Let's take an example: on one of my systems:
/dev/sda1: debian
/dev/sda2: swap
/dev/sda3: /home

/dev/sdb1: lfs1
/dev/sdb2: lfs2
/dev/sdb3: lfs3

Each of those lfs has a /boot partition. On lfs1, create /boot/grub/grub.cfg:

|set root=(hd1,1) menuentry "GNU/Linux, Linux 5.2.8-lfs-SVN-20190815" { linux /boot/vmlinuz-5.2.8-lfs-SVN-20190815 root=/dev/sdb1 ro initrd /boot/microcode.img } On lfs2, create /boot/grub/grub.cfg with: ||set root=(hd1,2) menuentry "GNU/Linux, Linux 5.2.8-lfs-SVN-20190815" { linux /boot/vmlinuz-5.2.8-lfs-SVN-20190815 root=/dev/sdb2 ro initrd /boot/microcode.img } and same (changing the appropriate entries) for lfs3 Then, on debian, run "update-grub". The lines "linux ..." and "initrd ..." from each lfs are copied into debian's grub.cfg. Note that there is no need to run grub-install, since debian had already done it. All in all, it is much easier than manually maintaining a grub.cfg for all the distros on the disks. And there are functions which allow to choose which system will be booted when rebooting (using grub-editenv)... |||


grub-mkconfig is terribly verbose.  For a new install of debian, with only one distro, grub.conf is 197 lines.  I can build LFS and have a dual boot system in about 15 lines.   There is MUCH more flexibility with a single boot partition.

Except that when debian updates its kernel, it runs update-grub, which ruins the existing grub.cfg. With the method I propose, the lfs systems are still available after an update... With your method, you need a copy of grub.cfg, and to merge it with the one generated by debian after the update...


For GPT (recommended), you need something like:

Number  Start (sector)    End (sector)  Size       Code Name
   1            2048            4095   1024.0 KiB  EF02 grub
   2            4096         1052671   512.0 MiB   8300 boot
   3         1052672        39456767   18.3 GiB    8300 debian
   4        39456768        60428287   10.0 GiB    8200 Linux swap
   5       429604864       468666367   18.6 GiB    8300 lfs-20190801
   ...
  14       307765248       370679807   30.0 GiB    8300 lfs-9.0


grub should always be 1 MiB
boot can be smaller than 512 MiB, but I suggest no smaller than 100 MiB.
swap is actually optional but I recommend at least 2 GiB
For the LFS partition, 30 GiB gives enough room to build all of BLFS, but can be much smaller.  Currently I don't recommend anything less than 10 GiB.

My grub.cfg is fairly easy to understand:

# Begin /boot/grub/grub.cfg
set default=1
set timeout=5

insmod ext2
set root=(hd0,2)

menuentry "Linux 4.18.5 (lfs-SVN-20180902) /dev/sda7" {
        linux /vmlinuz-4.18.5-lfs-SVN-20180902 root=/dev/sda7 ro consoleblank=120
        initrd /microcode.img
}

menuentry "Linux 4.20.0 (lfs-8.4) /dev/sda13" {
        linux /vmlinuz-4.20.8-lfs-SVN-20190214 root=/dev/sda13 ro consoleblank=120
        initrd /microcode.img
}

...
11 more entries.


On another system, a commercial distro entry looks like:

menuentry 'Linux Mint 17.2 Xfce 64-bit' {
   insmod gzio
   linux /vmlinuz-3.16.0-38-generic root=UUID=3b35b7db-f76b-4a32-baa7-814538d95ee1 ro
   initrd   /initrd.img-3.16.0-38-generic
}

  -- Bruce



-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to