Browse Source

Trap error of util-linux and update grub config

master
Cyril CONSTANTIN 3 weeks ago
parent
commit
9075c19f2f
  1. 67
      README.md
  2. 34
      build.sh
  3. 24
      build/88210_util-linux.sh

67
README.md

@ -100,3 +100,70 @@ Execute as *lfs* user.
```bash ```bash
make make
``` ```
## Grub config
Grub is initiated with the following menu :
```bash
$ cat /mnt/lfs/boot/grub/grub.cfg
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod part_gpt
insmod ext2
search --set=root --fs-uuid=8c137b8d-3612-4715-94c2-8203e273318f
set gfxpayload=1024x768x32
menuentry "GNU/Linux, Linux 6.18.10-lfs-13.0-systemd with blockdevice" {
linux /boot/vmlinuz-6.18.10-lfs-13.0-systemd root=/dev/vdb1 ro
}
menuentry "GNU/Linux, Linux 6.18.10-lfs-13.0-systemd with partuuid" {
linux /boot/vmlinuz-6.18.10-lfs-13.0-systemd root=PARTUUID=001cdfe1-01 ro
}
```
The *partuuid* section is not required, but can be helpful if you add another disk or change boot order in bios. partuuid is *more* immutable then *vdx*.
Devices are extracted from the following command :
```bash
$ lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT
UUID PARTUUID PATH MOUNTPOINT
/dev/sr0
/dev/vda
e46c1c50-d494-44f2-a826-41afc1b76eae 9ffe027f-01 /dev/vda1 /
9ffe027f-02 /dev/vda2
cae0487a-2eca-44c7-aa5f-060ea258f30c 9ffe027f-05 /dev/vda5 [SWAP]
/dev/vdb
8c137b8d-3612-4715-94c2-8203e273318f 001cdfe1-01 /dev/vdb1 /mnt/lfs
```
In this configuration extracted from a libvirt host (*/dev/vdxn*) with a second disk dedicated to LFS, /mnt/lfs device entry is filtered.
The grub config is made with it.
*cclfs* doesn't install the bootloader. It use the bootloader of the host.
You can install it if you want before or after the first boot.
See instruction in *LFS* book and *BLFS* book. There is only one bootloader *by default* at boot nonetheless.
On Debian Trixie (13) (at least), OS_PROBER is disabled.
Just uncomment the line in /etc/default/grub or customize a config file in /etc/grub.d/ .
And reinstall the bootloader.
```bash
$ su -
$ grep PROBER /etc/default/grub
GRUB_DISABLE_OS_PROBER=false
# vim /etc/default/grub
# update-grub
```
In default configuration, libvirt doesn't activate a second disk, so it won't boot.
Activate the second disk in the boot options.
You can find devices seen by *bios* with the grub console : type *c* at grub general menu
```bash
ls
(hd0,msdos1) (hd0,msdos5) (hd1,msdos1)
```
If you don't see your *LFS* partition, it won't boot.

34
build.sh

@ -2388,6 +2388,40 @@ set gfxpayload=1024x768x32
menuentry "GNU/Linux, Linux ${linuxversion}-lfs-13.0-systemd with blockdevice" { menuentry "GNU/Linux, Linux ${linuxversion}-lfs-13.0-systemd with blockdevice" {
linux /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd root=${blockdevice} ro linux /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd root=${blockdevice} ro
} }
menuentry "GNU/Linux, Linux ${linuxversion}-lfs-13.0-systemd with partuuid" {
linux /boot/vmlinuz-${linuxversion}-lfs-13.0-systemd root=PARTUUID=${uuidpartition} ro
}
EOF
EOSF
if lfs_chroot "${sudofile}"
then
echo "104000" > "${SLFSB}"
else
echo "grub config error"
exit 1
fi
fi
ask_for_exit 110100
echo "11.1. The End"
if [[ $(cat "${SLFSB}") -lt 110100 ]]
then
sudofile=/tmp/lfs_110100.sh
cat > ${sudofile} << EOSF
echo 13.0-systemd > /etc/lfs-release
cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="13.0-systemd"
DISTRIB_CODENAME="<your name here>"
DISTRIB_DESCRIPTION="Linux From Scratch"
EOF
cat > /etc/os-release << "EOF"
NAME="Linux From Scratch"
VERSION="13.0-systemd"
ID=lfs
PRETTY_NAME="Linux From Scratch 13.0-systemd"
VERSION_CODENAME="<your name here>"
EOF EOF
EOSF EOSF
if lfs_chroot "${sudofile}" if lfs_chroot "${sudofile}"

24
build/88210_util-linux.sh

@ -23,6 +23,26 @@ make
touch /etc/fstab touch /etc/fstab
chown -R tester . chown -R tester .
su tester -c "make -k check"
make install
# su tester -c "make -k check"
[ -e /tmp/util-linux_make_check.log ] && rm /tmp/util-linux_make_check.log
if ! su tester -c "make -k check" | tee /tmp/util-linux_make_check.log
then
grep "^ FAILED" /tmp/util-linux_make_check.log |sed -e "s/[()]//g" |cut --delimiter=' ' --fields=3 | while IFS= read -r failure
do
echo "--- Check ${failure}"
case ${failure} in
# script/options-size
script/options-size)
echo "test script/options-size is known to fail"
continue
;;
*)
echo "Failed on ${failure}"
exit 1
;;
esac
done
fi
make install

Loading…
Cancel
Save