summaryrefslogtreecommitdiff
path: root/scripts/.local
diff options
context:
space:
mode:
authorivan-boikov <ik.boikov.public@protonmail.com>2022-11-27 18:23:47 +0100
committerivan-boikov <ik.boikov.public@protonmail.com>2022-11-27 18:23:47 +0100
commit665e987db9013639eb985ef3fa051740bf89d942 (patch)
tree1a0f78524fdc78b3a43027a31cd315236813ddd5 /scripts/.local
parent110dab7e27e32a4dc055015d3b97a26719d31004 (diff)
1
Diffstat (limited to 'scripts/.local')
-rwxr-xr-xscripts/.local/bin/checkcpufreq2
-rwxr-xr-xscripts/.local/bin/makekernel26
2 files changed, 20 insertions, 8 deletions
diff --git a/scripts/.local/bin/checkcpufreq b/scripts/.local/bin/checkcpufreq
new file mode 100755
index 0000000..26edc2c
--- /dev/null
+++ b/scripts/.local/bin/checkcpufreq
@@ -0,0 +1,2 @@
+#!/bin/sh
+watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
diff --git a/scripts/.local/bin/makekernel b/scripts/.local/bin/makekernel
index 95a4122..a763eec 100755
--- a/scripts/.local/bin/makekernel
+++ b/scripts/.local/bin/makekernel
@@ -1,6 +1,7 @@
#!/bin/sh
-KERNEL_NAME="vmlinuz-latest-gentoo"
+KEYDIR="/etc/efikeys/"
+KKERNEL_NAME="vmlinuz-latest-gentoo"
if [[ $(hostname) = "pc" ]]; then
ROOT_DEVICE="/dev/nvme0n1p3"
@@ -12,17 +13,25 @@ fi
ROOT="/dev/mapper/root"
CRYPT_ROOT="$(blkid -s UUID | grep $ROOT_DEVICE | cut -d' ' -f2 | sed 's/"//g')"
-BOOT_PARAMS="crypt_root=$CRYPT_ROOT root=$ROOT rootfsype=btrfs rootflags=subvol=@ root_trim=yes lsm=selinux"
-echo $BOOT_PARAMS
+BOOT_PARAMS="ro crypt_root=$CRYPT_ROOT root=$ROOT rootfsype=btrfs rootflags=subvol=@ root_trim=yes lsm=selinux"
+
+echo -e "Boot parameters:\n$BOOT_PARAMS\n\nblkid output:\n$(blkid)\n\nProceed with kernel compiling?[Y/N]"
+read answer
+if [ "$answer" != "${answer#[Nn]}" ] ;then
+ echo "Aborted"
+ exit 1
+fi
+
+echo "Starting compilation. Asking for root permissions."
exit 1
cd /usr/src/linux
# inject $BOOT_PARAMS into kernel
-sed -i "s|^\(CONFIG_CMDLINE=\).*|\1\"$BOOT_PARAMS\"|" .config
+sudo sed -i "s|^\(CONFIG_CMDLINE=\).*|\1\"$BOOT_PARAMS\"|" .config
-genkernel --no-clean --no-mrproper --no-save-config \
+sudo genkernel --no-clean --no-mrproper --no-save-config \
--microcode="$MICROCODE" \
--integrated-initramfs --compress-initramfs --compress-initramfs-type=lz4 \
--luks --no-zfs \
@@ -34,10 +43,11 @@ genkernel --no-clean --no-mrproper --no-save-config \
all
#--virtio \
-
-# UEFI does not find images besides bootx64
if [[ $(hostname) = "pc" ]]; then
- cp -v "/boot/$KERNEL_NAME" "/boot/efi/boot/bootx64.efi"
+ # UEFI does not find images besides bootx64
+ sudo cp -v "/boot/$KERNEL_NAME" "/boot/efi/boot/bootx64.efi"
+else
+ sudo sbsign --key "$KEYDIR/db.key" --cert "$KEYDIR/db.crt" -o "/boot/efi/EFI/gentoo/$KERNEL_NAME.efi" "/boot/$KERNEL_NAME"
fi
cd -