Alpine Linux Support #7

Closed
opened 2020-08-02 19:32:02 +00:00 by kemonine · 0 comments
Owner

This is NOT going to happen. Early investigations uncovered bad documentation, fiddly installation process (it's a chroot but poorly documented making it extra painful), broken first boot (write permissions all kinds of broken).

Notes below for posterity.

WONTFIX


https://github.com/hoshsadiq/alpine-raspberry-pi/blob/master/make-image
https://forum.openwrt.org/t/howto-install-alpine-chroot-for-armhf-armv7-aarm64-x86/38806
https://github.com/hoshsadiq/alpine-raspberry-pi

parted /dev/sdc
mkpart
1
256M
mkpart
256M
-1
q
mkfs.vfat /dev/sdc1
mkfs.ext4 /dev/sdc2
parted /dev/sdc
set 1 lba on
set 1 boot on
set 2 lba on
mkdir /mnt/alpine
mount /dev/sdc2 /mnt/alpine
mkdir /mnt/alpine/boot
mount /dev/sdc1 /mnt/alpine/boot

mkdir /opt/apk-tools-static
cd /opt/apk-tools-static
wget http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/armv7/apk-tools-static-2.10.5-r1.apk
tar -xzf apk-tools-static-2.10.5-r1.apk
/opt/apk-tools-static/sbin/apk.static

CHROOT_DIR="/mnt/alpine"
ARCH="armv7"
cd "$CHROOT_DIR"

mkdir -p "$CHROOT_DIR"/etc/apk

printf '%s\n' \
	"https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" \
	"https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" \
	> etc/apk/repositories

/opt/apk-tools-static/sbin/apk.static --allow-untrusted \
    --root . --update-cache --initdb --no-progress \
	${ARCH:+--arch $ARCH} \
	add alpine-base

mount -v -t proc none proc
mount -v --rbind /sys sys
mount --make-rprivate sys
mount -v --rbind /dev dev
mount --make-rprivate dev

cp /etc/resolv.conf "$CHROOT_DIR"/etc

chroot /mnt/alpine /bin/sh
source /etc/profile

passwd

apk update
apk upgrade

apk add linux-rpi4
apk add linux-firmware-brcm
apk add raspberrypi-bootloader

cp -r /boot/dtbs-rpi4/* /boot/

cat > /boot/config.txt <<EOF
# KmN: Borrowed some stuff from majaro
# See /boot/overlays/README for all available options
kernel=vmlinuz-rpi4
initramfs=initramfs-rpi4

gpu_mem=512
dtoverlay=miniuart-bt
initramfs initramfs-linux.img followkernel
disable_overscan=1

#enable vc4
dtoverlay=vc4-kms-v3d
max_framebuffers=1
EOF

cat > /boot/cmdline.txt <<EOF
root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 elevator=noop audit=0
EOF

cat > /etc/fstab <<EOF
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
EOF

apk add ca-certificates
update-ca-certificates

setup-hostname "piframe"
echo "127.0.0.1    piframe piframe.localdomain" > /etc/hosts
setup-keymap us us

mkdir /etc/network
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF
apk add dbus

for service in devfs dmesg mdev; do
	rc-update add $service sysinit
done

for service in modules sysctl hostname bootmisc swclock syslog; do
	rc-update add $service boot
done
rc-update del hwclock boot || true

for service in dbus local networking; do
	rc-update add $service default
done

for service in killprocs savecache; do
	rc-update add $service shutdown
done











apk add openssh-server
rc-update add sshd default

apk add chrony
setup-timezone -z UTC
rc-update add chronyd default

This is NOT going to happen. Early investigations uncovered bad documentation, fiddly installation process (it's a chroot but poorly documented making it extra painful), broken first boot (write permissions all kinds of broken). Notes below for posterity. WONTFIX ``` https://github.com/hoshsadiq/alpine-raspberry-pi/blob/master/make-image https://forum.openwrt.org/t/howto-install-alpine-chroot-for-armhf-armv7-aarm64-x86/38806 https://github.com/hoshsadiq/alpine-raspberry-pi parted /dev/sdc mkpart 1 256M mkpart 256M -1 q mkfs.vfat /dev/sdc1 mkfs.ext4 /dev/sdc2 parted /dev/sdc set 1 lba on set 1 boot on set 2 lba on mkdir /mnt/alpine mount /dev/sdc2 /mnt/alpine mkdir /mnt/alpine/boot mount /dev/sdc1 /mnt/alpine/boot mkdir /opt/apk-tools-static cd /opt/apk-tools-static wget http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/armv7/apk-tools-static-2.10.5-r1.apk tar -xzf apk-tools-static-2.10.5-r1.apk /opt/apk-tools-static/sbin/apk.static CHROOT_DIR="/mnt/alpine" ARCH="armv7" cd "$CHROOT_DIR" mkdir -p "$CHROOT_DIR"/etc/apk printf '%s\n' \ "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" \ "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" \ > etc/apk/repositories /opt/apk-tools-static/sbin/apk.static --allow-untrusted \ --root . --update-cache --initdb --no-progress \ ${ARCH:+--arch $ARCH} \ add alpine-base mount -v -t proc none proc mount -v --rbind /sys sys mount --make-rprivate sys mount -v --rbind /dev dev mount --make-rprivate dev cp /etc/resolv.conf "$CHROOT_DIR"/etc chroot /mnt/alpine /bin/sh source /etc/profile passwd apk update apk upgrade apk add linux-rpi4 apk add linux-firmware-brcm apk add raspberrypi-bootloader cp -r /boot/dtbs-rpi4/* /boot/ cat > /boot/config.txt <<EOF # KmN: Borrowed some stuff from majaro # See /boot/overlays/README for all available options kernel=vmlinuz-rpi4 initramfs=initramfs-rpi4 gpu_mem=512 dtoverlay=miniuart-bt initramfs initramfs-linux.img followkernel disable_overscan=1 #enable vc4 dtoverlay=vc4-kms-v3d max_framebuffers=1 EOF cat > /boot/cmdline.txt <<EOF root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 elevator=noop audit=0 EOF cat > /etc/fstab <<EOF /dev/mmcblk0p1 /boot vfat defaults 0 2 /dev/mmcblk0p2 / ext4 defaults,noatime 0 1 EOF apk add ca-certificates update-ca-certificates setup-hostname "piframe" echo "127.0.0.1 piframe piframe.localdomain" > /etc/hosts setup-keymap us us mkdir /etc/network cat > /etc/network/interfaces <<EOF auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOF apk add dbus for service in devfs dmesg mdev; do rc-update add $service sysinit done for service in modules sysctl hostname bootmisc swclock syslog; do rc-update add $service boot done rc-update del hwclock boot || true for service in dbus local networking; do rc-update add $service default done for service in killprocs savecache; do rc-update add $service shutdown done apk add openssh-server rc-update add sshd default apk add chrony setup-timezone -z UTC rc-update add chronyd default ```
kemonine added the
wontfix
question
enhancement
labels 2020-08-02 19:32:02 +00:00
kemonine self-assigned this 2020-08-02 19:32:02 +00:00
kemonine added this to the Initial Stable Deployment milestone 2020-08-02 20:13:48 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: PiFrame/piframe#7
No description provided.