Skip to content

Instantly share code, notes, and snippets.

@44670
Last active May 22, 2021 10:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 44670/1808828b4d3037eba9965b628827af3f to your computer and use it in GitHub Desktop.
Save 44670/1808828b4d3037eba9965b628827af3f to your computer and use it in GitHub Desktop.
debian buster arm64 on raspberry pi 4
# build rootfs on host
debootstrap --arch=arm64 buster rootfs https://mirrors.163.com/debian/
chroot rootfs
apt install apt-transport-https network-manager nano sudo
useradd -m -G video,render,sudo,dialout -s /bin/bash pi
passwd pi
# edit /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 0 0
/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime 0 1
tmpfs /tmp tmpfs rw,nodev,nosuid 0 0
# set wifi country
nano /etc/default/crda
# now boot the sdcard on rpi
# ssh server
apt install openssh-server
# utils
apt install net-tools psmisc htop nano git p7zip-full tmux openssh-client curl build-essential cmake
# python
apt install python python-pip python3 python3-pip
# gui
apt install xfce4 xfce4-terminal xscreensaver fonts-wqy-microhei bluetooth bluez blueman
# vnc server
apt install tigervnc-scraping-server
# dev
apt install libgtk-3-dev ffmpeg libavcodec-dev libavformat-dev
# install kernel and modules with rpi-update
rm /boot/.firmware_revision
curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update && chmod +x /usr/bin/rpi-update
rpi-update
mv /opt/vc /opt/vc32
# broadcom wifi firmware should be copied manually if you need wifi (could be found in the raspbian image, located at /lib/firmware/brcm)
apt install mesa-utils
apt build-dep mesa
git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa
meson builddir
ninja -C builddir
# install libs to /usr/local/lib
sudo ninja -C builddir install
# flush the ldconfig cache
ldconfig
# check if OpenGL is gpu-accelerated
glxinfo | grep OpenGL
# set cpu freq strategy to "ondemand" (the kernel is configured with "powersave" by default)
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# set wifi country
nano /etc/default/crda
# compile and install arm64 userland gpu libraries (to /opt/vc)
git clone --depth 1 https://github.com/raspberrypi/userland
cd userland
./buildme --aarch64
# vnc server
# set password with "vncpasswd /root/vncpasswd" first.
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 x0tigervncserver -PasswordFile /root/vncpasswd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment