Add intel and amd ucode setup

This commit is contained in:
natemaia 2018-08-27 21:02:52 -07:00
parent 9bc3c70c5a
commit ac48a3640d
2 changed files with 21 additions and 17 deletions

View File

@ -12,7 +12,7 @@
# immutable variables {
readonly DIST="ArchLabs" # Linux distributor
readonly VER="1.6.58" # Installer version
readonly VER="1.6.59" # Installer version
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log
@ -485,7 +485,7 @@ mirrorlist_cmd() {
######################################################################
display_selection() {
local msg="Below are the configuration and setup values used during install
local msg="Configuration values used for install
Root Partition: $ROOT_PART
Boot Partition: $BOOT_PART
@ -514,8 +514,7 @@ Sessions: $INSTALL_WMS
Mirrors: $MIRROR_CMD
Packages: $EXTRA_PACKAGES"
msgbox "Install Info" "\n$msg\n"
return 0
msgbox "$_PrepTitle" "\n$msg\n"
}
configure_install() {
@ -570,8 +569,6 @@ edit_configs() {
}
main() {
local retval
if [[ $CURRENT_MENU != "main" ]]; then
MENU_HIGHLIGHT=1
CURRENT_MENU="main"
@ -582,15 +579,15 @@ main() {
tput civis
MENU_HIGHLIGHT=$(dialog --cr-wrap --stdout --backtitle "$BT" \
--title " $_PrepTitle " --default-item $MENU_HIGHLIGHT --menu "$_PrepBody" 0 0 0 \
"1" "$_PrepShowDev" "2" "$_PrepParts" "3" "$_PrepLUKS" "4" "$_PrepLVM" \
"5" "$_PrepMount" "6" "$_PrepConfig" "7" "Check Selections" "8" "$_PrepInstall" \
"1" "$_PrepShowDev" "2" "$_PrepParts" "3" "$_PrepLUKS" "4" "$_PrepLVM" \
"5" "$_PrepMount" "6" "$_PrepConfig" "7" "Check Choices" "8" "$_PrepInstall" \
"9" "$_Done")
# if trying to install the system, make sure the partitions are mounted
# and that the needed config variables and user variables have been set up
if [[ $MENU_HIGHLIGHT && $MENU_HIGHLIGHT -eq 8 ]]; then
check_install_ready
retval=$?
local retval=$?
[[ $retval -gt 0 ]] && { MENU_HIGHLIGHT=$retval; return 1; }
fi

View File

@ -75,10 +75,11 @@ uefi_boot_fallback() {
}
prep_for_grub() {
local ttype
local ucode="$1"
local cfg="$MNT/etc/default/grub"
if [[ $SYS == 'UEFI' ]]; then
local ttype
[[ $IS_64BIT != true ]] && ttype='i386-efi' || ttype='x86_64-efi'
BCMDS[grub]="${BCMDS[grub]} --target=$ttype --bootloader-id=$DIST"
else
@ -103,6 +104,8 @@ prep_for_grub() {
}
prep_for_systemd-boot() {
local ucode="$1"
# create the boot entry configs
mkdir -p $MNT/boot/loader/entries
cat > $MNT/boot/loader/loader.conf << EOF
@ -112,7 +115,7 @@ editor no
EOF
cat > $MNT/boot/loader/entries/${DIST}.conf << EOF
title $DIST Linux
linux /vmlinuz-${KERNEL}$([[ $(grep 'GenuineIntel' /proc/cpuinfo) && -e $MNT/boot/intel-ucode.img ]] && echo -en "\ninitrd /intel-ucode.img")
linux /vmlinuz-${KERNEL}$([[ $ucode ]] && echo -en "\ninitrd $ucode")
initrd /initramfs-$KERNEL.img
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV")rw
EOF
@ -136,6 +139,7 @@ EOF
}
prep_for_syslinux() {
local ucode="$1"
local cfgdir="$MNT/boot/syslinux"
local cfgsrcdir="/usr/lib/syslinux/bios/"
FILES[9]="/boot/syslinux/syslinux.cfg"
@ -162,14 +166,14 @@ MENU LABEL $DIST Linux
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV ")rw
INITRD ../initramfs-$KERNEL.img
$([[ $(grep 'GenuineIntel' /proc/cpuinfo) && -e $MNT/boot/intel-ucode.img ]] && echo -en "\ninitrd /intel-ucode.img")
$([[ $ucode ]] && echo -en "\nINITRD ..$ucode")
LABEL ${DIST}fallback
MENU LABEL $DIST Linux Fallback
LINUX ../vmlinuz-$KERNEL
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && echo -n "$LUKS_DEV ")rw
INITRD ../initramfs-$KERNEL-fallback.img
$([[ $(grep 'GenuineIntel' /proc/cpuinfo) && -e $MNT/boot/intel-ucode.img ]] && echo -en "\ninitrd /intel-ucode.img")
$([[ $ucode ]] && echo -en "\nINITRD ..$ucode")
EOF
return 0
}
@ -177,9 +181,12 @@ EOF
install_bootloader() {
chroot_cmd "export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/core_perl"
local msg="$_InstBootloader $BOOTLDR\n"
[[ $BOOT_PART != "" ]] && msg="$msg\n$_InstBootDev $BOOT_PART\n"
echo -e "$msg\nMountpoint: ${BMNTS[$SYS-$BOOTLDR]}\n"
local ucode=""
if [[ $(grep 'GenuineIntel' /proc/cpuinfo) && -e $MNT/boot/intel-ucode.img ]]; then
ucode="/intel-ucode.img"
elif [[ $(grep 'AuthenticAMD' /proc/cpuinfo) && -e $MNT/boot/amd-ucode.img ]]; then
ucode="/amd-ucode.img"
fi
# if not on an LVM we can use the UUID for booting
if ! [[ $ROOT_PART =~ /dev/mapper ]]; then
@ -210,7 +217,7 @@ install_bootloader() {
fi
# sets up the bootloader config(s) and ${BCMDS[$BOOTLDR]}
prep_for_$BOOTLDR
prep_for_$BOOTLDR "$ucode"
# run the bootloader command
chroot_cmd "${BCMDS[$BOOTLDR]}"