Skip to content

Commit edeb3ac

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8edee34 + 04c2e6d commit edeb3ac

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed

README.adoc

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
= Make Alpine Linux VM Image
22
:script-name: alpine-make-vm-image
3-
:script-sha1: 75aafcb883155bcaad9ad0dadb3e22e082152c1e
3+
:script-sha1: 0fe2deca927bc91eb8ab32584574eee72a23d033
44
:gh-name: alpinelinux/{script-name}
5-
:version: 0.12.0
5+
:version: 0.13.0
66

77
ifdef::env-github[]
88
image:https://github.com/{gh-name}/workflows/CI/badge.svg["Build Status", link="https://github.com/{gh-name}/actions"]
99
endif::env-github[]
1010

11-
This project provides a script for making customized https://alpinelinux.org/[Alpine Linux] disk images for x86_64 and aarch64 virtual machines.
11+
This project provides a script for making customized https://alpinelinux.org/[Alpine Linux] disk images for x86_64 and aarch64 footnote:[Supported since Alpine Linux v3.19. See <<aarch64-old>>.] virtual machines.
1212
You can choose between BIOS mode (using https://syslinux.org/[Syslinux], only for x86_64) and UEFI mode (using Linux https://docs.kernel.org/admin-guide/efi-stub.html[EFI stub]).
1313
It’s quite simple (400 LoC of shell), fast (~32 seconds on GitHub Actions), requires minimum dependencies (QEMU and filesystem tools).
1414

15-
IMPORTANT: aarch64 currently only works with the kernel (linux-virt or linux-lts) from Alpine edge! See <<aarch64-v3.18>> for more information and a workaround.
16-
1715
TIP: Don’t need VM, just wanna chroot into Alpine Linux?
1816
Try https://github.com/alpinelinux/alpine-chroot-install[alpine-chroot-install]!
1917
Or do you want to create a custom rootfs?
@@ -51,29 +49,6 @@ Or, if you are on Alpine Linux, you can simply install the https://pkgs.alpineli
5149

5250
== Howtos
5351

54-
[[aarch64-v3.18]]
55-
=== Create Alpine v3.18 (latest-stable) image for aarch64
56-
57-
The Linux kernel (_linux-virt_, _linux-lts_ or _linux-edge_ package) in Alpine v3.18 and earlier doesn’t have https://cateee.net/lkddb/web-lkddb/EFI_ZBOOT.html[EFI_ZBOOT] enabled, so EFI stub cannot load a compressed vmlinuz.
58-
We backported it to v3.18, but then we had to revert it due to a problem with Grub (see https://gitlab.alpinelinux.org/alpine/aports/-/issues/15263[alpine/aports#15263]).
59-
60-
If you want to build an image with a stable branch of Alpine Linux, you can, but you must install the kernel from the edge branch.
61-
This is relatively safe because the kernel package doesn’t have any dynamic dependencies and the version in v3.18 and edge will be in sync at least until v3.19 is released.
62-
63-
. Create a `repositories` file with a pinned main repository from edge, e.g.:
64-
+
65-
[source]
66-
----
67-
@edge https://dl-cdn.alpinelinux.org/alpine/edge/main
68-
https://dl-cdn.alpinelinux.org/alpine/v3.18/main
69-
https://dl-cdn.alpinelinux.org/alpine/v3.18/community
70-
----
71-
72-
. Run {script-name} with the options `--repositories-file ./repositories` and `--packages linux-virt@edge` (or `linux-lts@edge` if you use `--kernel-flavor lts`).
73-
74-
This will first install _linux-virt_ from v3.18, but in the later step it will reinstall it from the edge branch.
75-
76-
7752
=== Create images for aarch64 on x86_64 host
7853

7954
All you need to do is install the https://www.qemu.org/docs/master/user/main.html[QEMU User space emulator] for aarch64 and register it in https://docs.kernel.org/admin-guide/binfmt-misc.html[binfmt_misc] as the interpreter for aarch64 binaries.
@@ -110,6 +85,29 @@ See link:.github/workflows/ci.yml[] for a complete example.
11085
After that, run {script-name} with the option `--arch aarch64`.
11186

11287

88+
[[aarch64-old]]
89+
=== Create aarch64 image with Alpine v3.18 or older
90+
91+
The Linux kernel (_linux-virt_, _linux-lts_ or _linux-edge_ package) in Alpine v3.18 and earlier doesn’t have https://cateee.net/lkddb/web-lkddb/EFI_ZBOOT.html[EFI_ZBOOT] enabled, so EFI stub cannot load a compressed vmlinuz.
92+
We backported it to v3.18, but then we had to revert it due to a problem with Grub (see https://gitlab.alpinelinux.org/alpine/aports/-/issues/15263[alpine/aports#15263]).
93+
94+
If you want to build an image with an older branch of Alpine Linux, you can, but you must install the kernel from the v3.19 branch (or newer).
95+
This is relatively safe because the kernel package doesn’t have any dynamic dependencies.
96+
97+
. Create a `repositories` file with a pinned main repository from v3.19, e.g.:
98+
+
99+
[source]
100+
----
101+
@v319 https://dl-cdn.alpinelinux.org/alpine/v3.19/main
102+
https://dl-cdn.alpinelinux.org/alpine/v3.18/main
103+
https://dl-cdn.alpinelinux.org/alpine/v3.18/community
104+
----
105+
106+
. Run {script-name} with the options `--repositories-file ./repositories` and `--packages linux-virt@v319` (or `linux-lts@v319` if you use `--kernel-flavor lts`).
107+
108+
This will first install _linux-virt_ from v3.18, but in the later step it will reinstall it from the v3.19 branch.
109+
110+
113111
=== Create image for VMware (ESXi)
114112

115113
VMware and disk images (virtual disks) is one big mess.

alpine-make-vm-image

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
#
9191
# -h --help Show this help message and exit.
9292
#
93-
# -v --version Print version and exit.
93+
# -V --version Print version and exit.
9494
#
9595
# APK APK command to use. Default is "apk".
9696
#
@@ -115,7 +115,7 @@ set -eu
115115
PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
116116

117117
readonly PROGNAME='alpine-make-vm-image'
118-
readonly VERSION='0.12.0'
118+
readonly VERSION='0.13.0'
119119
readonly VIRTUAL_PKG=".make-$PROGNAME"
120120
# An opaque string used to detect changes in resolv.conf.
121121
readonly RESOLVCONF_MARK="### created by $PROGNAME ###"
@@ -396,7 +396,7 @@ wgets() (
396396

397397
#============================= M a i n ==============================#
398398

399-
opts=$(getopt -n $PROGNAME -o a:b:B:cCf:hi:k:m:p:Pr:s:S:tv \
399+
opts=$(getopt -n $PROGNAME -o a:b:B:cCf:hi:k:m:p:Pr:s:S:tV \
400400
-l arch:,boot-mode:,branch:,fs-skel-chown:,fs-skel-dir:,image-format:,image-size:,initfs-features:,kernel-flavor:,keys-dir:,mirror-uri:,no-cleanup,packages:,partition,repositories-file:,rootfs:,script-chroot,serial-console,help,version \
401401
-- "$@") || help 1 >&2
402402

@@ -610,12 +610,6 @@ fsprogs_pkgs=
610610

611611
prepare_chroot .
612612

613-
#-----------------------------------------------------------------------
614-
einfo "Installing and configuring mkinitfs"
615-
616-
_apk add --root . mkinitfs
617-
setup_mkinitfs . "base $ROOTFS $INITFS_FEATURES"
618-
619613
#-----------------------------------------------------------------------
620614
einfo "Installing kernel linux-$KERNEL_FLAVOR"
621615

@@ -626,6 +620,12 @@ else
626620
_apk add --root . linux-$KERNEL_FLAVOR linux-firmware-none
627621
fi
628622

623+
#-----------------------------------------------------------------------
624+
einfo "Installing and configuring mkinitfs"
625+
626+
_apk add --root . mkinitfs
627+
setup_mkinitfs . "base $ROOTFS $INITFS_FEATURES"
628+
629629
#-----------------------------------------------------------------------
630630
if [ "$BOOT_MODE" = 'BIOS' ]; then
631631
einfo 'Setting up extlinux bootloader'

0 commit comments

Comments
 (0)