aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-05-22 18:23:29 -0700
committerMike Crute <mike@crute.us>2020-05-30 15:07:45 -0700
commit9d672fbd6a42cf769cdc3e52f776292b17d4616b (patch)
treeb4a7b889539a5c8d0e700eba8527e15579a8540a
parent8a09fdda0e211bc4f2a10aad0b5f0814cf925a51 (diff)
downloadalpine-ec2-ami-9d672fbd6a42cf769cdc3e52f776292b17d4616b.tar.bz2
alpine-ec2-ami-9d672fbd6a42cf769cdc3e52f776292b17d4616b.tar.xz
alpine-ec2-ami-9d672fbd6a42cf769cdc3e52f776292b17d4616b.zip
Support ARM instance types
-rw-r--r--profiles/alpine.conf5
-rw-r--r--profiles/base/17
-rw-r--r--profiles/test.conf1
-rwxr-xr-xscripts/setup-ami28
4 files changed, 28 insertions, 13 deletions
diff --git a/profiles/alpine.conf b/profiles/alpine.conf
index 7947801..fbb086d 100644
--- a/profiles/alpine.conf
+++ b/profiles/alpine.conf
@@ -6,6 +6,7 @@ version-3_10 { include required("version/3.10") }
6version-3_9 { include required("version/3.9") } 6version-3_9 { include required("version/3.9") }
7version-edge { include required("version/edge") } 7version-edge { include required("version/edge") }
8arch-x86_64 { include required("arch/x86_64") } 8arch-x86_64 { include required("arch/x86_64") }
9arch-aarch64 { include required("arch/aarch64") }
9 10
10# profile vars 11# profile vars
11alpine { 12alpine {
@@ -21,4 +22,8 @@ BUILDS {
21 edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine} { 22 edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine} {
22 revision = "@NOW@" 23 revision = "@NOW@"
23 } 24 }
25
26 edge-aarch64 = ${version-edge} ${arch-aarch64} ${alpine} {
27 revision = "@NOW@"
28 }
24} 29}
diff --git a/profiles/base/1 b/profiles/base/1
index 936018f..8ba6ff8 100644
--- a/profiles/base/1
+++ b/profiles/base/1
@@ -33,6 +33,7 @@ ami_desc_suffix = ""
33ami_volume_size = "1" 33ami_volume_size = "1"
34ami_encrypt = "false" 34ami_encrypt = "false"
35ami_user = "alpine" # modification currently not supported 35ami_user = "alpine" # modification currently not supported
36
36# NOTE: the following are python format strings, resolved in resolve-profile.py 37# NOTE: the following are python format strings, resolved in resolve-profile.py
37ami_name = "{var.ami_name_prefix}{var.release}-{var.arch}-{var.revision}{var.ami_name_suffix}" 38ami_name = "{var.ami_name_prefix}{var.release}-{var.arch}-{var.revision}{var.ami_name_suffix}"
38ami_desc = "{var.ami_desc_prefix}{var.release} {var.arch} {var.revision}{var.ami_desc_suffix}" 39ami_desc = "{var.ami_desc_prefix}{var.release} {var.arch} {var.revision}{var.ami_desc_suffix}"
@@ -86,10 +87,12 @@ kernel_modules {
86 sd-mod = true 87 sd-mod = true
87 usb-storage = true 88 usb-storage = true
88 ext4 = true 89 ext4 = true
90 nvme = true
91 ena = true
89} 92}
90kernel_options { 93kernel_options {
91 "console=ttyS0" = true 94 "console=ttyS0,115200n8" = true
92 "console=tty0" = true 95 "nvme_core.io_timeout=4294967295" = true
93} 96}
94# NOTE: nvme and ena are critical for i3, a1, m6g, and anything in the 5 series 97# NOTE: nvme and ena are critical for i3, a1, m6g, and anything in the 5 series
95# forward. Without them these instances will not boot. 98# forward. Without them these instances will not boot.
diff --git a/profiles/test.conf b/profiles/test.conf
index 085f8cc..0d4e740 100644
--- a/profiles/test.conf
+++ b/profiles/test.conf
@@ -23,6 +23,7 @@ BUILDS {
23 edge-x86_64 = ${version-edge} ${arch-x86_64} ${test} 23 edge-x86_64 = ${version-edge} ${arch-x86_64} ${test}
24 24
25 # aarch64 AMI builds are under development 25 # aarch64 AMI builds are under development
26 edge-aarch64 = ${version-edge} ${arch-aarch64} ${test}
26 #edge-aarch64 = ${version-edge} ${arch-aarch64} ${test} { 27 #edge-aarch64 = ${version-edge} ${arch-aarch64} ${test} {
27 # other us-west-2 subnet doesn't do a1.* instances 28 # other us-west-2 subnet doesn't do a1.* instances
28 # build_subnet = "subnet-08dfc622745f7d96a" 29 # build_subnet = "subnet-08dfc622745f7d96a"
diff --git a/scripts/setup-ami b/scripts/setup-ami
index 023c208..1710ca9 100755
--- a/scripts/setup-ami
+++ b/scripts/setup-ami
@@ -59,7 +59,7 @@ fetch_apk_tools() {
59 59
60# mostly from Alpine's /sbin/setup-disk 60# mostly from Alpine's /sbin/setup-disk
61setup_partitions() { 61setup_partitions() {
62 start=1M # TODO: do we really need to waste 1M? 62 start=2M # Needed to align EBS partitions
63 line= 63 line=
64 64
65 # create new partitions 65 # create new partitions
@@ -70,7 +70,7 @@ setup_partitions() {
70 *) echo "$start,$line"; start= ;; 70 *) echo "$start,$line"; start= ;;
71 esac 71 esac
72 done 72 done
73 ) | sfdisk --quiet --label dos "$DEVICE" 73 ) | sfdisk --quiet --label gpt "$DEVICE"
74 74
75 # we assume that the build host will create the new devices within 5s 75 # we assume that the build host will create the new devices within 5s
76 tries=5 76 tries=5
@@ -87,7 +87,7 @@ make_filesystem() {
87 87
88 if [ "$BOOTLOADER" = 'grub-efi' ]; then 88 if [ "$BOOTLOADER" = 'grub-efi' ]; then
89 # create a small EFI partition (remainder for root), and mount it 89 # create a small EFI partition (remainder for root), and mount it
90 setup_partitions '5M,EF' ',L' 90 setup_partitions '5M,U,*' ',L'
91 root_dev="${DEVICE}2" 91 root_dev="${DEVICE}2"
92 mkfs.vfat -n EFI "${DEVICE}1" 92 mkfs.vfat -n EFI "${DEVICE}1"
93 fi 93 fi
@@ -142,9 +142,15 @@ install_core_packages() {
142 # EC2 console. 142 # EC2 console.
143 sed -Ei '/^tty[0-9]/s/^/#/' "$TARGET/etc/inittab" 143 sed -Ei '/^tty[0-9]/s/^/#/' "$TARGET/etc/inittab"
144 144
145 # Enable the getty for the serial terminal. This will show the login prompt
146 # in the get-console-output API that's accessible by the CLI and the web
147 # console.
148 sed -Ei '/^#ttyS0:/s/^#//' "$TARGET/etc/inittab"
149
145 # Make it a little more obvious who is logged in by adding username to the 150 # Make it a little more obvious who is logged in by adding username to the
146 # prompt 151 # prompt
147 sed -i "s/^export PS1='/&\\\\u@/" "$TARGET/etc/profile" 152 sed -i "s/^export PS1='/&\\\\u@/" "$TARGET/etc/profile"
153
148} 154}
149 155
150setup_mdev() { 156setup_mdev() {
@@ -196,7 +202,6 @@ install_extlinux() {
196 chroot "$TARGET" /sbin/update-extlinux --warn-only 202 chroot "$TARGET" /sbin/update-extlinux --warn-only
197} 203}
198 204
199# TODO: this isn't quite working for some reason
200install_grub_efi() { 205install_grub_efi() {
201 case "$ARCH" in 206 case "$ARCH" in
202 x86_64) grub_target=x86_64-efi ; fwa=x64 ;; 207 x86_64) grub_target=x86_64-efi ; fwa=x64 ;;
@@ -209,16 +214,17 @@ install_grub_efi() {
209 --bootloader-id=alpine --boot-directory=/boot --no-nvram 214 --bootloader-id=alpine --boot-directory=/boot --no-nvram
210 215
211 # fallback mode 216 # fallback mode
212 install -D "$TARGET/boot/efi/EFI/alpine/grub$fwa.efi" "$TARGET/boot/efi/EFI/boot/$fwa.efi" 217 install -D "$TARGET/boot/efi/EFI/alpine/grub$fwa.efi" "$TARGET/boot/efi/EFI/boot/boot$fwa.efi"
213
214 # add cmdline linux defaults to /etc/default/grub
215 echo "GRUB_CMDLINE_LINUX_DEFAULT=\"modules=$KERNEL_MODS $KERNEL_OPTS\"" >> "$TARGET"/etc/default/grub
216 218
217 # eliminate grub pause 219 cat > "$TARGET/etc/default/grub" <<- EOF
218 sed -ie 's/^GRUB_TIMEOUT=.$/GRUB_TIMEOUT=0/' "$TARGET/etc/default/grub" 220 GRUB_TIMEOUT=0
221 GRUB_DISABLE_SUBMENU=y
222 GRUB_DISABLE_RECOVERY=true
223 GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
224 GRUB_CMDLINE_LINUX_DEFAULT="modules=$KERNEL_MODS $KERNEL_OPTS"
225 EOF
219 226
220 # generate/install new config 227 # generate/install new config
221 [ -e "$TARGET/boot/grub/grub.cfg" ] && cp "$TARGET/boot/grub/grub.cfg" "$TARGET/boot/grub/grub.cfg.backup"
222 chroot "$TARGET" grub-mkconfig -o /boot/grub/grub.cfg 228 chroot "$TARGET" grub-mkconfig -o /boot/grub/grub.cfg
223} 229}
224 230