Skip to content

Instantly share code, notes, and snippets.

@Fleafa
Last active June 17, 2024 08:57
Show Gist options
  • Save Fleafa/da8b8e9af66791385b9ccb1a5c0367c1 to your computer and use it in GitHub Desktop.
Save Fleafa/da8b8e9af66791385b9ccb1a5c0367c1 to your computer and use it in GitHub Desktop.
Installing Alpine Linux on Linx1010B Bay Trail 32bit EFI 64bit CPU

Installing Alpine Linux on Linx1010B

Bay Trail 32bit EFI 64bit CPU

I managed install Alpine on this device, with networking surviving reboot, though ultimately I moved to Artix with Hyprland.

Create bootable USB

  1. Download Ventoy, and both x86_64 & i386 Alpine Linux ISOs.
  2. Create a Ventoy USB with GPT format and ~3GB unused.
  3. Add alpine-extended-VERSIONNUMBER-x86_64.iso to 'Ventoy' partion.
  4. Create a FAT or FAT32 partition using remaining space. This is where all handy stuff will be placed.
  5. Open alpine-extended-VERSIONNUMBER-i386.iso in 7zip or similar.
  6. Extract folder /apks/x86/grub-efi-VERSIONNUMBER.apk/grub-efi-VERSIONNUMBER.tar/usr/lib/grub/i386-efi and its contents to the 'stuff' partition created earlier.

Setup Alpine Extended x86_64

Rotate the framebuffer console! Your neck will thank you.

echo 1 | tee /sys/class/graphics/fbcon/rotate

Login as root, no password.

Add the needed packages:

apk add grub-efi efibootmgr tzdata

I add some other packages I want to use:

apk add bash nano doas

then I set bash as the shell:

nano /etc/passwd

Find root:x:0:0:root:/root:/bin/ash ,
Change to root:x:0:0:root:/root:/bin/bash,
type exit then login as root again.
(you could use chsh here)

Start step-by-step setup.

setup-keymap gb gb && setup-hostname alpine && rc-service hostname restart

Wi-Fi

I couldn't set the on-board WiFi at wlan0 UP in the live environment.
You can skip this section if you like, as the on-board WiFi will work after installation is complete.
I used a USB dongle at wlan1, but you can install Alpine Extended without internet access.
Still, setup-interfaces didn't work for this dongle. I haven't tested others.

wpas=wpa_supplicant && wpa_passphrase 'ExampleWifiSSID' 'ExampleWifiPassword' >> /etc/$wpas/$wpas.conf

Test wpa_supplicant:

$wpas -i wlan1 -c /etc/$wpas/$wpas.conf

If OK, ctrl+c then type:

$wpas -B -i wlan1 -c /etc/$wpas/$wpas.conf
nano /etc/network/interfaces

add these lines:

auto wlan1
iface wlan1 inet dhcp

save, then type:

udhcpc -i wlan1
setup-dns

(can leave domain blank)

rc-update add $wpas boot
rc-update add networking boot

Continue with Setup

export TZ='Europe/London'
install -Dm 0644 /usr/share/zoneinfo/$TZ /etc/zoneinfo/$TZ
echo "export TZ='$TZ'" >> /etc/profile.d/timezone.sh

Create user account:

adduser -g "<username>" <username> && adduser <username> wheel
nano /etc/doas.d/doas.conf

Add: permit persist :wheel, save, then:

passwd
setup-sshd
setup-ntp
setup-disk -m sys

APK Repositories

The setup-apkrepos script deletes the reference to the install media repo, and the WiFi is janky at this point.
Skip this section if you have no working WiFI. You can do this after installation.
Instead, I edited /etc/apk/repositories, commenting out the install media repo, and adding local mirrors:

http://uk.alpinelinux.org/alpine/latest-stable/main
http://uk.alpinelinux.org/alpine/latest-stable/community

Can then update packages:

apk update
apk add --upgrade apk-utils
apk upgrade --available

DHCPCD Configuration

On reboot, the on-board WiFi is slow to respond, causing dhcpcd to wait and then timeout. To avoid this:

nano /etc/dhcpcd.conf

add: background to the end of the file, and save.

Do not reboot yet!

Fixing GRUB

root=/dev/mmcblk1p3 && tmpmnt=/mnt/tmpmnt

Mount the installed OS and chroot in:

mkdir -p $tmpmnt
mount $root $tmpmnt
for i in dev dev/pts sys proc run ; do mount --bind /$i $tmpmnt/$i; done
chroot $tmpmnt /bin/bash

Now we're in the installed OS.
APK is clever and only installs for the architecture it detects, so we have to bypass it by mounting our 'stuff' partition i386-efi folder from earlier and copying over the files we need:

tmpmnt=/mnt/tmpmnt
mkdir -p $tmpmnt
mount /dev/sda3 $tmpmnt
cp -r $tmpmnt/i386-efi /usr/lib/grub/i386-efi

Then install grub and, if all is well, umount 'stuff'.

mount /dev/mmcblk1p1 /boot/efi
grub-install --target=i386-efi --removable --no-nvram /dev/mmcblk1p1
umount $tmpmnt

Modify the boot loader configuration for the sake of our necks:

nano /etc/default/grub

add: GRUB_CMDLINE_LINUX="fbcon=rotate:1",
save, update grub, then exit chroot:

grub-mkconfig -o /boot/grub/grub.cfg
exit

Now we have left the chroot, we can unmount everything:

for i in dev/pts dev sys proc run boot/efi "" ; do umount $tmpmnt/$i; done

Check we've not missed any umounts - should return blank:

mount | grep $tmpmnt

Restart the tablet without the Live USB inserted, and hopefully you'll boot into Alpine!
You may need to set up WiFi again (I did). setup-interfaces should work now, so just use that :)

Links

https://tilde.town/~kzimmermann/articles/alpine_linux_desktop.html
https://wiki.alpinelinux.org/wiki/Setting_up_a_laptop

Many thanks to Ian Renton and his commenters, as well as all the other posts/articles/guides I've found over the last few days!

@alimuhammetuslu
Copy link

grub-install --target=i386-efi --removable --no-nvram /dev/mmcblk1p1
Right before the command above, you should do;

mount /dev/mmcblk1p1 /boot/efi
Otherwise it wouldn't mount EFI partition so you cannot install grub :) Thanks for this awesome guideline!

@Fleafa
Copy link
Author

Fleafa commented Jun 17, 2024

Thanks! I moved on from Alpine to Artix for this device, so haven't made any updates here since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment