-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.sh
executable file
·81 lines (64 loc) · 2.55 KB
/
boot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
. "`dirname "${BASH_SOURCE[0]}"`"/common.sh
select-drive
target_arch=${2:-$arch}
do-install-packages() {
packages=(
syslinux
prebootloader
intel-ucode
)
[[ $target_arch != x86_64 ]] || packages+=(gummiboot)
chroot-cmd pacman -S --needed --noconfirm ${packages[@]}
}
do-install-syslinux() {
chroot-cmd bash `[[ ! $- =~ x ]] || echo -x` syslinux-install_update -im
}
do-configure-syslinux() {
sudo sed -i "s/^\(TIMEOUT\) .*/\1 10/" $mnt_dir/boot/syslinux/syslinux.cfg
root_uuid=`partition-uuid 2`
sudo sed -i "s/^\(\s*APPEND root\)=[^ ]* rw/\1=UUID=$root_uuid rw nouveau.config=NvForcePost=1/" $mnt_dir/boot/syslinux/syslinux.cfg
sudo sed -i "s|^\(\s*INITRD\) \(\.\./initramfs-linux\.img\)|\1 ../intel-ucode.img,\2|" $mnt_dir/boot/syslinux/syslinux.cfg
}
do-copy-efi-applications() {
[[ $target_arch == x86_64 ]] || return 0
sudo mkdir -p $mnt_dir/boot/EFI/boot
sudo cp $mnt_dir/usr/lib/prebootloader/PreLoader.efi $mnt_dir/boot/EFI/boot/bootx64.efi
sudo cp $mnt_dir/usr/lib/prebootloader/HashTool.efi $mnt_dir/boot/EFI/boot/
sudo rm -r $mnt_dir/boot/EFI/gummiboot
sudo cp $mnt_dir/usr/lib/gummiboot/gummibootx64.efi $mnt_dir/boot/EFI/boot/loader.efi
sudo curl -o $mnt_dir/boot/EFI/boot/shellx64-v1.efi https://svn.code.sf.net/p/edk2/code/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
sudo curl -o $mnt_dir/boot/EFI/boot/shellx64.efi https://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi
sudo mkdir -p $mnt_dir/boot/EFI/Microsoft/Boot
sudo cp $mnt_dir/boot/EFI/boot/bootx64.efi $mnt_dir/boot/EFI/Microsoft/Boot/bootmgfw.efi
}
do-configure-gummiboot() {
[[ $target_arch == x86_64 ]] || return 0
sudo mkdir -p $mnt_dir/boot/loader/entries
sudo tee $mnt_dir/boot/loader/loader.conf >/dev/null <<EOF
timeout 1
default arch
EOF
sudo tee $mnt_dir/boot/loader/entries/arch.conf >/dev/null <<EOF
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=UUID=`partition-uuid 2` rw nouveau.config=NvForcePost=1
EOF
sudo tee $mnt_dir/boot/loader/entries/arch-fallback.conf >/dev/null <<EOF
title Arch Linux Fallback
linux /vmlinuz-linux
initrd /initramfs-linux-fallback.img
options root=UUID=`partition-uuid 2` rw nouveau.config=NvForcePost=1
EOF
sudo tee $mnt_dir/boot/loader/entries/uefi-shell-v1.conf >/dev/null <<EOF
title UEFI Shell v1
efi /EFI/boot/shellx64-v1.efi
EOF
sudo tee $mnt_dir/boot/loader/entries/uefi-shell-v2.conf >/dev/null <<EOF
title UEFI Shell v2
efi /EFI/boot/shellx64.efi
EOF
}
run-actions