Skip to content

Instantly share code, notes, and snippets.

@jnorthrup
Last active April 24, 2022 07:18
Show Gist options
  • Save jnorthrup/69edd229c028847d314606616b3c507f to your computer and use it in GitHub Desktop.
Save jnorthrup/69edd229c028847d314606616b3c507f to your computer and use it in GitHub Desktop.
grub-mkconfig WIP
cfg=(
--bootloader=grub2
--no-mrproper
--no-clean
--makeopts=-j8
--no-firmware
--no-busybox
--no-keymap
--real-root=UUID=efea9656-2c14-4290-b2c8-0e45b65b6634
--no-zfs
--no-btrfs
--no-virtio
--no-iscsi
--no-ssh
--no-splash
--no-microcode-initramfs
--nice=19
--no-postclear
--compress-initramfs-type=zstd
)
export HOSTCFLAGS=-march=native
genkernel all ${cfg[*]} && {
grub-mkconfig >/boot/grub/grub.cfg
uuid=$(grep UUID= /boot/grub/grub.cfg |head -n1|sed -n --regexp-extended 's,.*UUID=([^ ]*).*,\1,p')
key=$( ls -l /dev/disk/by-uuid/${uuid}|cut -f 2 -d '>' )
partuuid=$(ls -l /dev/disk/by-partuuid/|grep $key|cut -f 9 -d ' ')
sed -e "s,UUID=${uuid},PARTUUID=${partuuid}," -i /boot/grub/grub.cfg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment