Forked from maximtrp/Orange Pi PC and Arch Linux ARM.md
Last active
August 28, 2024 14:57
-
-
Save yekm/36f40bd1c0d54dac84f0b412eb35648c to your computer and use it in GitHub Desktop.
Guide on how to install Arch Linux ARM on SD card for your Orange Pi PC board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -uev | |
sdX=$1 | |
sudo dd if=/dev/zero of=$sdX bs=1M count=8 | |
echo "1 : start=2048,size=,type=83" | sudo sfdisk $sdX | |
sudo mkfs.f2fs ${sdX}1 | |
mnt=/tmp/archlinuxarm | |
mkdir -p $mnt | |
sudo mount ${sdX}1 $mnt | |
cd /tmp | |
wget -c http://os.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz | |
sudo tar xkf ArchLinuxARM-armv7-latest.tar.gz -C $mnt | |
#sync | |
sudo pacman -S uboot-tools | |
cd $mnt/boot | |
sudo tee boot.txt << EOF | |
if test -n \${distro_bootpart}; then setenv bootpart \${distro_bootpart}; else setenv bootpart 1; fi | |
part uuid \${devtype} \${devnum}:\${bootpart} uuid | |
setenv bootargs console=\${console} root=PARTUUID=\${uuid} rw rootwait | |
if load \${devtype} \${devnum}:\${bootpart} \${kernel_addr_r} /boot/zImage; then | |
if load \${devtype} \${devnum}:\${bootpart} \${fdt_addr_r} /boot/dtbs/\${fdtfile}; then | |
if load \${devtype} \${devnum}:\${bootpart} \${ramdisk_addr_r} /boot/initramfs-linux.img; then | |
bootz \${kernel_addr_r} \${ramdisk_addr_r}:\${filesize} \${fdt_addr_r}; | |
else | |
bootz \${kernel_addr_r} - \${fdt_addr_r}; | |
fi; | |
fi; | |
fi | |
EOF | |
sudo mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr | |
cd /tmp | |
sudo umount $mnt | |
sudo pacman -S arm-none-eabi-gcc swig | |
[ -d u-boot ] || git clone --depth 1 --branch v2023.04 https://github.com/u-boot/u-boot | |
cd u-boot | |
export CROSS_COMPILE=arm-none-eabi- | |
export ARCH=arm | |
make distclean | |
make orangepi_pc_defconfig | |
make -j | |
sudo dd if=u-boot-sunxi-with-spl.bin of=$sdX bs=1024 seek=8 | |
echo pliug in and login and | |
echo pacman-key --init | |
echo pacman-key --populate archlinuxarm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment