I plan to build a custom Alpine ISO image for Raspberry Pi by following instructions in https://wiki.alpinelinux.org/wiki/How_to_make_a_custom_ISO_image. However, when I followed the instructions, I got errors:
$ apk update && apk add alpine-sdk xorriso syslinux
$ abuild-keygen -i -a -n
$ git clone "http://git.alpinelinux.org/cgit/alpine-iso"
$ make PROFILE=alpine-rpi ALPINE_ARCH=armhf iso
==> modloop: Unpacking kernel modules
fetch 'http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz'
fetch 'http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz'
ERROR: unsatisfiable constraints:
linux-rpi (missing):
required by: world[linux-rpi]
make: *** [Makefile:85: /root/alpine-iso/isotmp.alpine-rpi/stamp.modloop.kernel.rpi] Error 1
Note that I was running the above commands on an Alpine x86 VM. Did I miss some configurations/commands?
--- Edited ---
Using the following patch (it passes ALPINE_ARCH
when updating apk index files), I finally passed the above errors.
diff --git a/Makefile b/Makefile
index f88a6a9..0850156 100755
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,7 @@ $(MODLOOP_KERNELSTAMP):
--update \
--no-script \
--root $(MODLOOP_DIR)/tmp \
+ --arch $(ALPINE_ARCH) \
$(MODLOOP_PKGS) $(UBOOT_PKGS)
@mv "$(MODLOOP_DIR)"/tmp/lib/modules/* "$(MODLOOP_DIR)"/lib/modules/
@if [ -d "$(MODLOOP_DIR)"/tmp/lib/firmware ]; then \
@@ -144,6 +145,7 @@ $(INITFS_DIRSTAMP):
--update \
--no-script \
--root $(INITFS_DIR) \
+ --arch $(ALPINE_ARCH) \
$(INITFS_PKGS)
@cp -r $(APK_KEYS) $(INITFS_DIR)/etc/apk/ || true
@if ! [ -e "$(INITFS_DIR)"/etc/mdev.conf ]; then \
diff --git a/alpine-rpi.conf.mk b/alpine-rpi.conf.mk
index 53349ca..18ca2bf 100644
--- a/alpine-rpi.conf.mk
+++ b/alpine-rpi.conf.mk
@@ -1,4 +1,5 @@
ALPINE_NAME := alpine-rpi
+ALPINE_ARCH := armhf
KERNEL_FLAVOR := rpi rpi2
MODLOOP_EXTRA :=
BOOT_OPTS := dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1
Unfortunately, I hit another error:
$ make PROFILE=alpine-rpi iso
...
==> initramfs: creating /root/alpine-iso/isotmp.alpine-rpi/isofs/boot/initramfs-rpi
/root/alpine-iso/isotmp.alpine-rpi/initfs.rpi/lib/ld-musl-x86_64.so.1: Not found.
libc.musl-x86_64.so.1: Not found.
/usr/bin/lddtree: cd: line 284: can't cd to libc.musl-x86_64.so.1
...
==> initramfs: creating /root/alpine-iso/isotmp.alpine-rpi/isofs/boot/initramfs-rpi2
/root/alpine-iso/isotmp.alpine-rpi/initfs.rpi2/lib/ld-musl-x86_64.so.1: Not found.
libc.musl-x86_64.so.1: Not found.
/usr/bin/lddtree: cd: line 284: can't cd to libc.musl-x86_64.so.1
==> iso: generating repository
mkdir -p "/root/alpine-iso/isotmp.alpine-rpi/isofs/apks/armhf"
sed -e 's/\#.*//' alpine-rpi.packages \
| xargs apk fetch --keys-dir /etc/apk/keys --repositories-file /etc/apk/repositories \
--output /root/alpine-iso/isotmp.alpine-rpi/isofs/apks/armhf \
--recursive || { rm /root/alpine-iso/isotmp.alpine-rpi/isofs/apks/armhf/*.apk; exit 1; }
raspberrypi: unable to select package (or it's dependencies)
omxplayer: unable to select package (or it's dependencies)
rm: can't remove '/root/alpine-iso/isotmp.alpine-rpi/isofs/apks/armhf/*.apk': No such file or directory
make: *** [Makefile:281: /root/alpine-iso/isotmp.alpine-rpi/isofs/apks/armhf/APKINDEX.tar.gz] Error 1
After investigating Makefile
, it seems that ALPINE_ARCH
was not passed to mkinitfs
. It's not clear to force mkinitfs
to use armhf
instead of x86_64
since there is no option available to do that.