@@ -13,12 +13,20 @@ check_root() {
13
13
fi
14
14
}
15
15
16
- check_ubuntu () {
17
- # Currently this script only works on Ubuntu instances
18
- if ! grep -qi ' ubuntu' /etc/os-release; then
19
- echo " This script currently only works on Ubuntu."
20
- exit 1
16
+ check_userspace () {
17
+ # Currently this script only works on Ubuntu and AL2023
18
+ if grep -qi ' ubuntu' /etc/os-release; then
19
+ USERSPACE=" UBUNTU"
20
+ return 0
21
+ fi
22
+
23
+ if grep -qi ' al2023' /etc/os-release; then
24
+ USERSPACE=" AL2023"
25
+ return 0
21
26
fi
27
+
28
+ echo " This script currently only works on Ubuntu and Amazon Linux 2023."
29
+ exit 1
22
30
}
23
31
24
32
tidy_up () {
@@ -96,6 +104,41 @@ check_override_presence() {
96
104
echo " All overrides correctly applied.."
97
105
}
98
106
107
+ ubuntu_update_boot () {
108
+ echo " Update initramfs"
109
+ update-initramfs -c -k $KERNEL_VERSION
110
+ echo " Updating GRUB..."
111
+ update-grub
112
+ }
113
+
114
+ al2023_update_boot () {
115
+ echo " Installing ENA driver for AL2023"
116
+ $START_DIR /install_ena.sh $KERNEL_VERSION $START_DIR /dkms.conf
117
+
118
+ # Just ensure we are back in the build dir
119
+ cd $TMP_BUILD_DIR
120
+
121
+ echo " Creating the new ram disk"
122
+ dracut --kver $KERNEL_VERSION -f -v
123
+
124
+ echo " Updating GRUB..."
125
+ grubby --grub2 --add-kernel /boot/vmlinux-$KERNEL_VERSION \
126
+ --title=" Secret Hiding" \
127
+ --initrd=/boot/initramfs-$KERNEL_VERSION .img --copy-default
128
+ grubby --set-default /boot/vmlinux-$KERNEL_VERSION
129
+ }
130
+
131
+ update_boot_config () {
132
+ case " $USERSPACE " in
133
+ UBUNTU) ubuntu_update_boot ;;
134
+ AL2023) al2023_update_boot ;;
135
+ * )
136
+ echo " Unknown userspace"
137
+ exit 1
138
+ ;;
139
+ esac
140
+ }
141
+
99
142
KERNEL_URL=$( cat kernel_url)
100
143
KERNEL_COMMIT_HASH=$( cat kernel_commit_hash)
101
144
KERNEL_PATCHES_DIR=$( pwd) /patches
@@ -155,16 +198,14 @@ echo "New kernel version:" $KERNEL_VERSION
155
198
confirm " $@ "
156
199
157
200
check_root
158
- check_ubuntu
201
+ check_userspace
159
202
160
203
echo " Installing kernel modules..."
161
204
make INSTALL_MOD_STRIP=1 modules_install
162
205
echo " Installing kernel..."
163
206
make INSTALL_MOD_STRIP=1 install
164
- echo " Update initramfs"
165
- update-initramfs -c -k $KERNEL_VERSION
166
- echo " Updating GRUB..."
167
- update-grub
207
+
208
+ update_boot_config
168
209
169
210
echo " Kernel built and installed successfully!"
170
211
0 commit comments