Skip to content

Instantly share code, notes, and snippets.

@mjcc30
Forked from dreamcat4/README.md
Last active March 7, 2024 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjcc30/8b587943b9dc3b9469e676f87d9eed4f to your computer and use it in GitHub Desktop.
Save mjcc30/8b587943b9dc3b9469e676f87d9eed4f to your computer and use it in GitHub Desktop.
Void Linux on Raspberry Pi 4

Summary

download link: https://voidlinux.org/download/#arm%20platforms

I'm able to get a Void Linux image (32bit, raspberry pi 2 image) to boot on the raspberry pi 4. Currently, I can get it to boot and even handle upgrading via xbps-install -Su (networked over ethernet), however I can't seem to get it to see the internal wlan (wifi) device.

huge shout out to kodifies on this reddit post for helping me to get this going.

Steps

grab the raspberry pi 2 (32bit) image

mkdir -p ~/temp
cd ~/temp
wget https://alpha.de.repo.voidlinux.org/live/current/void-rpi2-PLATFORMFS-20181111.tar.xz

grab the latest raspberry pi firmware (will take a while)

git clone git://github.com/raspberrypi/firmware.git

prepare the sdcard and install void. This is largely based on https://wiki.voidlinux.org/Raspberry_Pi

replace /dev/sda with your device (found in fdisk -l)

$ sudo parted /dev/sda
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mktable msdos
(parted) mkpart primary fat32 2048s 256MB
(parted) toggle 1 boot
(parted) mkpart primary ext4 256MB -1
(parted) quit

create the filesystems

$ sudo mkfs.vfat /dev/sda1
mkfs.fat 4.1 (2017-01-24)
$ sudo mkfs.ext4 -O '^has_journal' /dev/sda2
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 15579648 4k blocks and 3899392 inodes
Filesystem UUID: f07242a6-b029-4581-a24f-dd51f6bf5d3e
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

create the root filesystem

sudo mount /dev/sda2 /mnt
sudo mkdir /mnt/boot
sudo mount /dev/sda1 /mnt/boot

place the rpi2 image onto the SD card

sudo tar xvfJp ~/temp/void-rpi2-PLATFORMFS-20181111.tar.xz -C /mnt
sudo sync

--add the following lines to /mnt/etc/fstab--

/dev/mmcblk0p1  /boot  vfat  defaults  0  0

NOTE: I now skip this step. It appears that updating the installed packages (xbps-install -Su) caused files to be overwritten in /mnt/boot and this caused my raspberry pi not to boot. We can avoid this happening and manually manage the install firmware files by not mounting it at boot.


copy the latest firmware

cd ~/temp/firmware
sudo rm -rf /mnt/boot/*
sudo rsync -r ./boot/ /mnt/boot/
sudo sync

create config.txt and cmdline.txt files

/mnt/boot/config.txt

dtoverlay=vc4-fkms-v3d
max_framebuffers=2
max_usb_current=1
gpu_mem=256

/mnt/boot/cmdline.txt

root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 loglevel=4 elevator=noop

unmount the partitions

sudo umount /mnt/boot /mnt

put the sd card into an rpi 4 and it should boot!

after booting to rpi

login: root
passwd: voidlinux


xbps-install -u xbps
xbps-install -Su
sudo xbps-install -S git

mkdir -p .local/pkgs
cd .local/pkgs
git clone https://github.com/void-linux/void-packages
cd void-packages
./xbps-src binary-bootstrap
cd ..
git clone https://github.com/Makrennel/hyprland-void.git
cd hyprland-void
cat common/shlibs >> ../void-packages/common/shlibs
cp -r srcpkgs/* ../void-packages/srcpkgs
cd ../void-packages
./xbps-src pkg hyprland

./xbps-src pkg xdg-desktop-portal-hyprland
./xbps-src pkg hyprland-protocols
sudo xbps-install -R hostdir/binpkgs hyprland
sudo xbps-install -R hostdir/binpkgs hyprland-protocols
sudo xbps-install -R hostdir/binpkgs xdg-desktop-portal-hyprland

sudo xbps-install -S dbus seatd polkit elogind mesa-dri
sudo ln -s /etc/sv/dbus /var/service/
sudo ln -s /etc/sv/polkitd /var/service/
sudo ln -s /etc/sv/seatd /var/service

sudo usermod -aG _seatd mjcc
sudo reboot

sudo xbps-install -S alacritty swaybg curl
sudo xbps-install -S micro ranger neofetch cava cmus htop grim firefox telegram-desktop \
 nemo imv mpv wofi blender gimp inkscape ghostscript nerd-fonts-symbols-ttf fish-shell \
 file-roller obs obs-plugin-browser-bin curl jq swaybg gedit slurp guitarix2 calf ardour \
 lmms hydrogen musescore

cd ~/.local/pkgs/void-packages
./xbps-src pkg Waybar
sudo xbps-install -R hostdir/binpkgs  Waybar
Hyprland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment