You are not logged in.
Pages: 1
Hey all,
Maybe im totally blind and somewhat reinvented the wheel here, but I couldn't find an automated way to fill up the entries for the loader.
Perhaps its little work to create the required files, but messing with different kernels such it can be somewhat annoying.
Its suppose to be somewhat like grub-mkconfig
#!/bin/bash
title="Archlinux"
commandline="splash quiet cryptdevice=UUID=c044cabb-e626-4ee2-a680-a9af6e9bc53a:cryptroot:allow-discards rd.luks.options=discard root=/dev/mapper/cryptroot rootflags=subvol=archlinux rd.udev.log-priority=3 elevator=bfq pcie_aspm=force zswap.enabled=1 net.ipv4.ip_forward=0 net.ipv4.conf.default.rp_filter=1 net.ipv4.conf.default.accept_source_route=0 acpi_osi=Linux panic=10"
intel_ucode="initrd /intel-ucode.img"
default="vmlinuz-linux-ck"
timeout=5
function menu_entry {
kernel=$1
if [[ $kernel =~ ([^\ ]++)?/([^/]+) ]]; then
kernel=${BASH_REMATCH[2]}
path=${BASH_REMATCH[1]}
fi
echo $kernel found
initramfs=${kernel//vmlinuz/initramfs}.img
echo - $initramfs
if [[ ! -f "${path}/${initramfs}" ]]; then
echo "- Initramfs not found for matching kernel"
return -1
fi
if [[ -z $default ]]; then
default=$kernel
fi
config=/boot/loader/entries/${kernel}.conf
if [[ -f $config ]]; then
rm $config
fi
touch $config
echo "title ${title}" >> $config
echo "linux /${kernel}" >> $config
echo "${intel_ucode}" >> $config
echo "initrd /${initramfs}" >> $config
echo "options ${commandline}" >> $config
initramfs=${initramfs//.img/-fallback.img}
echo - $initramfs
if [[ ! -f "${path}/${initramfs}" ]]; then
echo "- Initramfs not found for fallback"
return -1
fi
config=/boot/loader/entries/${kernel}-fallback.conf
if [[ -f $config ]]; then
rm $config
fi
fallbackcommandline=${commandline//splash/}
fallbackcommandline=${fallbackcommandline//quiet/}
touch $config
echo "title ${title}" >> $config
echo "linux /${kernel}" >> $config
echo "${intel_ucode}" >> $config
echo "initrd /${initramfs}" >> $config
echo "options ${fallbackcommandline}" >> $config
}
if [[ ! -d /boot/loader ]]; then
echo "Boot not mounted or systemd-boot not present"
exit 1
fi
kernelfiles=$(find /boot -maxdepth 1 -type f)
for file in $kernelfiles; do
if [[ ! $file =~ (\.img) ]]; then
# echo $file
menu_entry $file
fi
done
loaderconf=/boot/loader/loader.conf
if [[ -f $loaderconf ]]; then
rm $loaderconf
fi
touch $loaderconf
echo "timeout ${timeout}" >> $loaderconf
echo "default ${default}" >> $loaderconf
Offline
Hello,
Being back on arch with my pc I also worked a script o do this, i'll post it here, it seems relevant.
You need to edit it modify defaults then you can create preset files overriding the ones in the script.
linux-ck:
ENTRY_LABEL="Archlinux CK"
KERNEL_PATH="\EFI\arch\vmlinuz-linux-ck.efi"
INITRAMFS_PATH="\EFI\arch\initramfs-linux-ck.img"
usage:
setup_efiboot_mgr.sh <preset>
setup_efiboot_mgr.sh:
#!/bin/sh
PRESET=$1
echo "Selecting preset $1"
EBM="efibootmgr"
ROOT_DRIVE="/dev/sda"
ROOT_PART_NUM=2 # partition number, 1 if first
ROOT_UUID="" #"UUID=f00-bar"
ROOT_FSTYPE="ext4"
ENTRY_LABEL="Arch Linux"
INTEL_MICROCODE="\EFI\arch\intel-ucode.img"
KERNEL_PATH="\EFI\arch\vmlinuz-linux.efi"
INITRAMFS_PATH="\EFI\arch\initramfs-linux.img"
KERNEL_ARGS="rw quiet splash"
source $PRESET
U_ARGS="root=${ROOT_UUID} rootfstype=${ROOT_FSTYPE} initrd=${INTEL_MICROCODE} initrd=${INITRAMFS_PATH} ${KERNEL_ARGS}"
EBM_ARGS="--create --gpt --disk $ROOT_DRIVE\
--part $ROOT_PART_NUM\
--label \"${ENTRY_LABEL}\"\
--loader ${KERNEL_PATH}\
--unicode \"${U_ARGS}\""
echo "Booting on:"
echo " Drive: $ROOT_DRIVE"
echo " UUID: $ROOT_UUID"
echo " Part: $ROOT_PART_NUM"
echo " FS: $ROOT_FSTYPE"
echo ""
echo "Preset:"
echo " Label: $ENTRY_LABEL"
echo "Microcode: $INTEL_MICROCODE"
echo " Initram: $INITRAMFS_PATH"
echo " Kernel: $KERNEL_PATH"
echo " args: $KERNEL_ARGS"
echo ""
echo "Efibootmgr:"
echo " Command: $EBM"
echo " args: $EBM_ARGS"
echo ""
$EBM $EBM_ARGS
Just putting this here, still have a lot to do.
Also im lazy but I tought it could be useful for someone
Regards
Offline
Pages: 1