Skip to content

Commit

Permalink
move the alpine release version to one place (config)
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Jun 15, 2024
1 parent 21ef168 commit 6c531b4
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ If you dont like the imaging method above, you can also use the official Alpine

## 1. Boot Alpine installer

Get and boot Alpine 3.19: https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-extended-3.19.1-x86_64.iso
Get and boot a recent Alpine release: https://alpinelinux.org/downloads/

Note: Should be the extended edition, since that one has ZFS support.

Expand Down
11 changes: 8 additions & 3 deletions devtools/createimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ cd ../install
./6-install-extras.sh
./7-cleanup.sh

echo "ALPINEBOX: Compressing image..."
losetup -d $LOOP_DEV
rm $IMAGE"".gz &>/dev/null || true
gzip $IMAGE
if ! [ "$SKIP_COMPRESS" ]; then
echo "ALPINEBOX: Compressing image..."
gzip -k $IMAGE
fi

echo "ALPINEBOX: Done, $IMAGE"".gz created."
#so that runimage.sh works without root
chmod 666 /tmp/alpine.img

echo "ALPINEBOX: Done, $IMAGE created."

27 changes: 22 additions & 5 deletions devtools/docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
#docker build -t alpinebox .
#!/bin/bash

REPO=`cd ../..;pwd`
#NOTE: use with INSTALL_ZPOOL=... to override rpool name

set -e

REPO=$(
cd ../..
pwd
)

source $REPO/install/config

#make sure host OS has zfs
modprobe zfs || true

docker run --rm --privileged -w /repo/devtools -i -v /tmp:/tmp -v $REPO:/repo alpine:3.19 ./createimage.sh
# docker run --rm --privileged -w /repo/devtools -itv $REPO:/repo alpine:3.19

docker run \
-e SKIP_COMPRESS=$SKIP_COMPRESS \
-e INSTALL_ZPOOL=$INSTALL_ZPOOL \
--rm \
--privileged \
-w /repo/devtools \
-i \
-v /tmp:/tmp \
-v $REPO:/repo \
alpine:$ALPINE_RELEASE \
./createimage.sh
14 changes: 14 additions & 0 deletions devtools/runimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

#boot the generated image in qemu to test it

set -e

qemu-system-x86_64 \
-enable-kvm \
-smp 4 \
-m 4096 \
-device virtio-blk-pci,drive=drive0,id=virtblk0,num-queues=4 \
-drive file=/tmp/alpine.img,format=raw,if=none,id=drive0 \
-boot order=c

2 changes: 2 additions & 0 deletions install/3-install-bootloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ mkdir -p /mnt/boot/EFI/BOOT/
cp zfsbootmenu.EFI /mnt/boot/EFI/BOOT/BOOTX64.EFI

#BIOS version:
#We use syslinux to chainboot to zfsbootmenu
mkdir -p /mnt/boot/syslinux

cp zfsbootmenu-*/* /mnt/boot/syslinux
cp /usr/share/syslinux/*c32 /mnt/boot/syslinux
cp $CWD/files/syslinux.cfg /mnt/boot/syslinux
cp $CWD/files/syslinux.txt /mnt/boot/syslinux
extlinux --install /mnt/boot/syslinux
dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/gptmbr.bin of=$INSTALL_DISK

Expand Down
6 changes: 5 additions & 1 deletion install/4-create-zpool.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
set -e


source config

echo "ALPINEBOX: Creating zpool on $INSTALL_DISK"

Expand Down Expand Up @@ -29,4 +29,8 @@ zpool set bootfs=$INSTALL_ZPOOL/ROOT $INSTALL_ZPOOL
# zpool import -N -R /mnt $INSTALL_ZPOOL
zfs mount $INSTALL_ZPOOL/ROOT

#set default zfsbootmenu kernel commandline
zfs set org.zfsbootmenu:commandline="$APPEND" $INSTALL_ZPOOL/ROOT


echo "ALPINEBOX: Done, $INSTALL_ZPOOL mounted under /mnt/newroot"
2 changes: 2 additions & 0 deletions install/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
ALPINE_RELEASE=3.19
APPEND="loglevel=4"
CONFIG_ZFSBOOTMENU_EFI="https://github.com/zbm-dev/zfsbootmenu/releases/download/v2.3.0/zfsbootmenu-release-x86_64-v2.3.0-vmlinuz.EFI"
CONFIG_ZFSBOOTMENU_BIOS="https://github.com/zbm-dev/zfsbootmenu/releases/download/v2.3.0/zfsbootmenu-recovery-x86_64-v2.3.0.tar.gz"
1 change: 1 addition & 0 deletions install/files/syslinux.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ MENU TITLE Syslinux
# TIMEOUT 1

DEFAULT zfsbootmenu
DISPLAY /syslinux/syslinux.txt

LABEL zfsbootmenu
MENU LABEL ZFSBootMenu
Expand Down
6 changes: 6 additions & 0 deletions install/files/syslinux.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

######################################
# ALPINEBOX: Loading ZFSBootMenu ... #
######################################


0 comments on commit 6c531b4

Please sign in to comment.