Howto install archlinuxarm raspberrypi5: Difference between revisions
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
register the qemu-aarch64-static as an arm interpreter in the kernel: | register the qemu-aarch64-static as an arm interpreter in the kernel: | ||
echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register | echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register | ||
script to mount image: | |||
#!/bin/bash | |||
if [ ! -d /mnt/temp ]; | |||
then | |||
mkdir /mnt/temp | |||
fi | |||
kpartx -va $1 1> /tmp/part-names.txt | |||
PART2=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p2$) | |||
PART1=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p1$) | |||
sleep 1 | |||
mount /dev/mapper/$PART2 /mnt/temp | |||
mount /dev/mapper/$PART1 /mnt/temp/boot/ | |||
sleep 1 | |||
mount -o bind /dev /mnt/temp/dev | |||
mount -o bind /dev/pts /mnt/temp/dev/pts | |||
mount -o bind /proc /mnt/temp/proc | |||
mount -o bind /sys /mnt/temp/sys | |||
rm /tmp/part-names.txt | |||
if [[ $1 == *[32]* ]]; then | |||
mount -o bind ./pkg32 /mnt/temp/var/cache/pacman/pkg | |||
fi | |||
if [[ $1 == *[64]* ]]; then | |||
mount -o bind ./pkg64 /mnt/temp/var/cache/pacman/pkg | |||
fi | |||
enter chroot using arch-chroot: | enter chroot using arch-chroot: | ||
arch-chroot /mnt/temp | arch-chroot /mnt/temp |
Revision as of 00:47, 21 February 2024
download image
download archlinux-arm-aarch64 image:
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
chroot with qemu
use qemu-user-static to interpret the arm instructions in the chroot:
pacman -Sy qemu-user-static --noconfirm
copy the qemu-aarch64-static binary to the chroot:
cp /usr/bin/qemu-aarch64-static /mnt/temp/usr/bin
register the qemu-aarch64-static as an arm interpreter in the kernel:
echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
script to mount image:
#!/bin/bash if [ ! -d /mnt/temp ]; then mkdir /mnt/temp fi
kpartx -va $1 1> /tmp/part-names.txt PART2=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p2$) PART1=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p1$) sleep 1 mount /dev/mapper/$PART2 /mnt/temp mount /dev/mapper/$PART1 /mnt/temp/boot/ sleep 1 mount -o bind /dev /mnt/temp/dev mount -o bind /dev/pts /mnt/temp/dev/pts mount -o bind /proc /mnt/temp/proc mount -o bind /sys /mnt/temp/sys rm /tmp/part-names.txt if [[ $1 == *[32]* ]]; then mount -o bind ./pkg32 /mnt/temp/var/cache/pacman/pkg fi if [[ $1 == *[64]* ]]; then mount -o bind ./pkg64 /mnt/temp/var/cache/pacman/pkg fi
enter chroot using arch-chroot:
arch-chroot /mnt/temp