Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARCH=armv7l version of iso #108

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ endif
# is required for Docker and asset downloads.
ARCH_ALIAS_x86_64 = amd64
ARCH_ALIAS_aarch64 = arm64
ARCH_ALIAS_armv7l = arm-v7
ARCH_ALIAS = $(shell echo "$(ARCH_ALIAS_$(ARCH))")

# x86_64, aarch64, armv7
ALPINE_ARCH = $(shell echo "$(ARCH)" | sed -e 's/armv7l/armv7/')

# amd64, arm64, arm/v7
DOCKER_ARCH = $(shell echo "$(ARCH_ALIAS)" | tr '-' '/')

NERDCTL_VERSION=1.1.0
QEMU_VERSION=v7.0.0
CRI_DOCKERD_VERSION=0.2.3
Expand All @@ -35,12 +42,12 @@ mkimage:
--tag mkimage:$(ALPINE_VERSION)-$(ARCH) \
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
--build-arg BINFMT_IMAGE=$(BINFMT_IMAGE) \
--platform linux/$(ARCH_ALIAS) \
--platform linux/$(DOCKER_ARCH) \
.

.PHONY: iso
iso: nerdctl-$(NERDCTL_VERSION)-$(ARCH) qemu-$(QEMU_VERSION)-copying cri-dockerd-$(CRI_DOCKERD_VERSION)-$(ARCH)
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) QEMU_VERSION=$(QEMU_VERSION) CRI_DOCKERD_VERSION=$(CRI_DOCKERD_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) BUILD_ID=$(BUILD_ID) ARCH=$(ARCH) ARCH_ALIAS=$(ARCH_ALIAS) ./build.sh
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) QEMU_VERSION=$(QEMU_VERSION) CRI_DOCKERD_VERSION=$(CRI_DOCKERD_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) BUILD_ID=$(BUILD_ID) ARCH=$(ARCH) ARCH_ALIAS=$(ARCH_ALIAS) ALPINE_ARCH=$(ALPINE_ARCH) DOCKER_ARCH=$(DOCKER_ARCH) ./build.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARCH_ALIAS doesn't seem to be used by build.sh anymore:

Suggested change
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) QEMU_VERSION=$(QEMU_VERSION) CRI_DOCKERD_VERSION=$(CRI_DOCKERD_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) BUILD_ID=$(BUILD_ID) ARCH=$(ARCH) ARCH_ALIAS=$(ARCH_ALIAS) ALPINE_ARCH=$(ALPINE_ARCH) DOCKER_ARCH=$(DOCKER_ARCH) ./build.sh
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) QEMU_VERSION=$(QEMU_VERSION) CRI_DOCKERD_VERSION=$(CRI_DOCKERD_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) BUILD_ID=$(BUILD_ID) ARCH=$(ARCH) ALPINE_ARCH=$(ALPINE_ARCH) DOCKER_ARCH=$(DOCKER_ARCH) ./build.sh



nerdctl-$(NERDCTL_VERSION)-$(ARCH):
Expand All @@ -55,27 +62,46 @@ cri-dockerd-$(CRI_DOCKERD_VERSION)-$(ARCH):

.PHONY: lima
lima:
ALPINE_VERSION=$(ALPINE_VERSION) EDITION=$(EDITION) ARCH=$(ARCH) ./lima.sh
ALPINE_VERSION=$(ALPINE_VERSION) EDITION=$(EDITION) ARCH=$(ARCH) ALPINE_ARCH=$(ALPINE_ARCH) ./lima.sh

QEMU_ARCH = $(shell echo "$(ARCH)" | sed -e 's/armv7l/arm/')

.PHONY: run
run:
accel=tcg; display=sdl; \
cpu=max; accel=tcg; display=sdl; \
if [ "$(shell uname -m)" = "$(ARCH)" ]; then \
cpu=host; \
case "$(shell uname)" in \
Darwin) accel=hvf;; \
Linux) accel=kvm;; \
esac; \
fi; \
case "$(shell uname)" in \
Darwin) accel=hvf; display=cocoa;; \
Linux) accel=kvm; display=gtk;; \
Darwin) display=cocoa;; \
Linux) display=gtk;; \
esac; \
case "$(ARCH)" in \
x86_64) machine=q35;; \
*) machine=virt;; \
esac; \
qemu-system-$(ARCH) \
vga=cirrus-vga; \
if qemu-system-$(QEMU_ARCH) \
-device help \
-machine $$machine | grep -q virtio-vga; then \
vga=virtio-vga; \
fi; \
qemu-system-$(QEMU_ARCH) \
-boot order=d,splash-time=0,menu=on \
-cdrom iso/alpine-lima-$(EDITION)-$(ALPINE_VERSION)-$(ARCH).iso \
-cpu host \
-machine q35,accel=$$accel \
-cdrom iso/alpine-lima-$(EDITION)-$(ALPINE_VERSION)-$(ALPINE_ARCH).iso \
-cpu $$cpu \
-machine $$machine,accel=$$accel \
-smp 4,sockets=1,cores=4,threads=1 \
-m 4096 \
-net nic,model=virtio \
-net user,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:20022-:22 \
-display $$display \
-device virtio-rng-pci \
-device virtio-vga \
-device $$vga \
-device virtio-keyboard-pci \
-device virtio-mouse-pci \
-parallel none
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TAG="${EDITION}-${ALPINE_VERSION}"
source "edition/${EDITION}"

${DOCKER} run --rm \
--platform "linux/${ARCH_ALIAS}" \
--platform "linux/${DOCKER_ARCH}" \
-v "${PWD}/iso:/iso" \
-v "${PWD}/mkimg.lima.sh:/home/build/aports/scripts/mkimg.lima.sh:ro" \
-v "${PWD}/genapkovl-lima.sh:/home/build/aports/scripts/genapkovl-lima.sh:ro" \
Expand All @@ -30,11 +30,11 @@ ${DOCKER} run --rm \
"mkimage:${ALPINE_VERSION}-${ARCH}" \
--tag "${TAG}" \
--outdir /iso \
--arch "${ARCH}" \
--arch "${ALPINE_ARCH}" \
--repository "/home/build/packages/lima" \
--repository "http://dl-cdn.alpinelinux.org/alpine/${REPO_VERSION}/main" \
--repository "http://dl-cdn.alpinelinux.org/alpine/${REPO_VERSION}/community" \
--profile lima

ISO="alpine-lima-${EDITION}-${ALPINE_VERSION}-${ARCH}.iso"
ISO="alpine-lima-${EDITION}-${ALPINE_VERSION}-${ALPINE_ARCH}.iso"
cd iso && sha512sum "${ISO}" > "${ISO}.sha512sum"
15 changes: 11 additions & 4 deletions genapkovl-lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ fi
mkdir -p "${tmp}/proc/sys/fs/binfmt_misc"
rc_add procfs default

if [ "${LIMA_INSTALL_BINFMT_MISC}" == "true" ]; then
if [ "${LIMA_INSTALL_BINFMT_MISC}" == "true" ] && [ "$(uname -m)" != "armv7l" ]; then
# install qemu-aarch64 on x86_64 and vice versa
OTHERARCH=aarch64
if [ "$(uname -m)" == "${OTHERARCH}" ]; then
if [ "$(uname -m)" == "x86_64" ]; then
OTHERARCH=aarch64
fi
if [ "$(uname -m)" == "aarch64" ]; then
OTHERARCH=x86_64
fi

Expand Down Expand Up @@ -223,10 +225,15 @@ fi

if [ "${LIMA_INSTALL_CNI_PLUGIN_FLANNEL}" == "true" ]; then
echo "cni-plugin-flannel" >> "$tmp"/etc/apk/world
ARCH=amd64
if [ "$(uname -m)" == "x86_64" ]; then
ARCH=amd64
fi
if [ "$(uname -m)" == "aarch64" ]; then
ARCH=arm64
fi
if [ "$(uname -m)" == "armv7l" ]; then
ARCH=armv7
fi
Comment on lines -226 to +236
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set ARCH here at all? It isn't being used anymore at all. It seems to be vestigial code from the time when this block ended with:

    mkdir -p "${tmp}/usr/libexec/cni"
    ln -s "flannel-${ARCH}" "${tmp}/usr/libexec/cni/flannel"

But that has since been removed because the cni-plugin-flannel package has since been fixed. So we can drop all the ARCH setting here.

fi

if [ "${LIMA_INSTALL_CURL}" == "true" ]; then
Expand Down
8 changes: 6 additions & 2 deletions lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ case "$(uname)" in
Darwin) display=cocoa;;
Linux) display=gtk;;
esac
case "${ARCH}" in
x86_64) bios=true;;
*) bios=false;;
esac
Comment on lines +8 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop setting legacyBIOS: true for all platforms now; it is no longer needed and has already been removed from the examples/alpine.yaml template in the lima.git repo.

cat <<EOF >"${EDITION}.yaml"
arch: "${ARCH}"
images:
- location: "${PWD}/iso/alpine-lima-${EDITION}-${ALPINE_VERSION}-${ARCH}.iso"
- location: "${PWD}/iso/alpine-lima-${EDITION}-${ALPINE_VERSION}-${ALPINE_ARCH}.iso"
arch: "${ARCH}"
mounts:
- location: "~"
Expand All @@ -18,7 +22,7 @@ mounts:
ssh:
localPort: 40022
firmware:
legacyBIOS: true
legacyBIOS: $bios
video:
display: $display
containerd:
Expand Down
8 changes: 6 additions & 2 deletions mkimg.lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ profile_lima() {
Slimmed down kernel.
Optimized for virtual systems.
Configured for lima."
arch="aarch64 x86 x86_64"
arch="aarch64 armv7 x86 x86_64"
initfs_cmdline="modules=loop,squashfs,sd-mod,usb-storage"
kernel_addons=
kernel_flavors="virt"
kernel_cmdline="console=tty0 console=ttyS0,115200"
case "$ARCH" in
arm*|aarch64)
kernel_cmdline="console=tty0 console=ttyAMA0"
jandubois marked this conversation as resolved.
Show resolved Hide resolved
;;
esac
syslinux_serial="0 115200"
apkovl="genapkovl-lima.sh"
apks="$apks openssh-server-pam"
Expand Down