Mail archive
alpine-user

[alpine-user] Problem on creating Alpine ISO for Raspberry Pi

From: Herry Herry <Herry.Herry_at_glasgow.ac.uk>
Date: Fri, 28 Apr 2017 22:49:19 +0000

Hi All,

First, thank you to Alpine developers for this amazing OS.

I was building a custom ISO image for Raspberry Pi as described in https://wiki.alpinelinux.org/wiki/How_to_make_a_custom_ISO_image <https://wiki.alpinelinux.org/wiki/How_to_make_a_custom_ISO_image>.

However, when I followed the instructions, I got this error:

---
$ apk update && apk add alpine-sdk xorriso syslinux
$ abuild-keygen -i -a -n
$ git clone "http://git.alpinelinux.org/cgit/alpine-iso <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 <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 <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 ran the commands on an Alpine x86 VM. Someone in stackexchange pointed me that there were some broken links, in particular the repo’s ARCH (it should be ‘armhf’ instead of ‘x86_64’). In light of that, I applied the following patch (it passes ALPINE_ARCH when updating apk index files):

=====
diff --git a/Makefile b/Makefile
index f88a6a9..0850156 100755
--- a/Makefile
+++ b/Makefile
_at_@ -87,6 +87,7 @@ $(MODLOOP_KERNELSTAMP):
    --update \
    --no-script \
    --root $(MODLOOP_DIR)/tmp \
+ --arch $(ALPINE_ARCH) \
    $(MODLOOP_PKGS) $(UBOOT_PKGS)
  _at_mv "$(MODLOOP_DIR)"/tmp/lib/modules/* "$(MODLOOP_DIR)"/lib/modules/
  _at_if [ -d "$(MODLOOP_DIR)"/tmp/lib/firmware ]; then \
_at_@ -144,6 +145,7 @@ $(INITFS_DIRSTAMP):
    --update \
    --no-script \
    --root $(INITFS_DIR) \
+ --arch $(ALPINE_ARCH) \
    $(INITFS_PKGS)
  _at_cp -r $(APK_KEYS) $(INITFS_DIR)/etc/apk/ || true
  _at_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
_at_@ -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
=====

The patch helped me eliminating the above error, but produced a new one:

=====
$ 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 investigation, it seems that mkinitfs didn’t consider ALPINE_ARCH when it was invoked by Makefile. Unfortunately, it's not clear for me on how to force mkinitfs to use ‘armhf' instead of ‘x86_64' since there is no option available to do that.

Can anyone please help me sorting out this problem?

Thank you.

Best regards,
HerryR{.n+z맲rzXƥ)ޖ)ƊijZbzzZeljZbbh
Received on Fri Apr 28 2017 - 22:49:19 GMT