Added vmlinuz syslinux.cfg generatoin and bios link

This commit is contained in:
oddlama 2020-04-25 17:56:04 +02:00
parent bbece4293a
commit ac5d8f1645
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
1 changed files with 32 additions and 23 deletions

View File

@ -148,14 +148,12 @@ install_kernel_efi() {
try emerge --verbose sys-boot/efibootmgr try emerge --verbose sys-boot/efibootmgr
# Copy kernel to EFI # Copy kernel to EFI
local kernel_version local kernel_file
kernel_version="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -n 1)" \ kernel_file="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -n 1)" \
|| die "Could not list newest kernel file" || die "Could not list newest kernel file"
kernel_version="${kernel_version#vmlinuz-}" \
|| die "Could not find kernel version"
mkdir_or_die 0755 "/boot/efi/EFI" mkdir_or_die 0755 "/boot/efi/EFI"
cp "/boot/vmlinuz-$kernel_version"* "/boot/efi/EFI/vmlinuz.efi" \ cp "/boot/$kernel_file" "/boot/efi/EFI/vmlinuz.efi" \
|| die "Could not copy kernel to EFI partition" || die "Could not copy kernel to EFI partition"
# Generate initramfs # Generate initramfs
@ -169,13 +167,28 @@ install_kernel_efi() {
try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\EFI\vmlinuz.efi' --unicode 'initrd=\EFI\initramfs.img'" $(get_cmdline)" try efibootmgr --verbose --create --disk "$gptdev" --part "$efipartnum" --label "gentoo" --loader '\EFI\vmlinuz.efi' --unicode 'initrd=\EFI\initramfs.img'" $(get_cmdline)"
} }
generate_syslinux_cfg() {
cat <<EOF
DEFAULT gentoo
PROMPT 0
TIMEOUT 0
LABEL gentoo
LINUX ../vmlinuz-current
APPEND initrd=initramfs.img $(get_cmdline)
EOF
}
install_kernel_bios() { install_kernel_bios() {
try emerge --verbose sys-boot/syslinux try emerge --verbose sys-boot/syslinux
# Install syslinux MBR record # Link kernel to known name
einfo "Copying syslinux MBR record" local kernel_file
local gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_BIOS]}")" kernel_file="$(find "/boot" -name "vmlinuz-*" -printf '%f\n' | sort -V | tail -n 1)" \
try dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of="$gptdev" || die "Could not list newest kernel file"
ln -s "$kernel_file" "/boot/vmlinuz-current" \
|| die "Could create link to current kernel"
# Generate initramfs # Generate initramfs
generate_initramfs "/boot/initramfs.img" generate_initramfs "/boot/initramfs.img"
@ -183,27 +196,23 @@ install_kernel_bios() {
# Install syslinux # Install syslinux
einfo "Installing syslinux" einfo "Installing syslinux"
local biosdev="$(resolve_device_by_id "$DISK_ID_BIOS")" local biosdev="$(resolve_device_by_id "$DISK_ID_BIOS")"
syslinux --directory syslinux --install "$biosdev" mkdir_or_die 0700 "/boot/syslinux"
try syslinux --directory syslinux --install "$biosdev"
# Create syslinux.cfg # Create syslinux.cfg
cat >/boot/syslinux/syslinux.cfg <<EOF echo -n "$(generate_syslinux_cfg)" > /boot/syslinux/syslinux.cfg \
DEFAULT gentoo || die "Could save generated syslinux.cfg"
PROMPT 0
TIMEOUT 0
LABEL gentoo # Install syslinux MBR record
LINUX ../vmlinuz-gentoo einfo "Copying syslinux MBR record"
APPEND initrd=initramfs.img $(get_cmdline) local gptdev="$(resolve_device_by_id "${DISK_ID_PART_TO_GPT_ID[$DISK_ID_BIOS]}")"
EOF try dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of="$gptdev"
} }
install_kernel() { install_kernel() {
einfo "Installing dracut"
try emerge --verbose sys-kernel/dracut
# Install vanilla kernel # Install vanilla kernel
einfo "Installing vanilla kernel" einfo "Installing vanilla kernel and related tools"
try emerge --verbose sys-kernel/gentoo-kernel-bin try emerge --verbose sys-kernel/dracut sys-kernel/gentoo-kernel-bin
if [[ $IS_EFI == "true" ]]; then if [[ $IS_EFI == "true" ]]; then
install_kernel_efi install_kernel_efi