Created
March 14, 2019 03:21
-
-
Save petronny/4541fec0efd06cba279c9634190556e1 to your computer and use it in GitHub Desktop.
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/sh | |
set -e | |
build_prefix=extra | |
arch=armv6h | |
build_path=$HOME/devtools-qemu | |
pkgcache=$build_path/pkgcache | |
mirror_name=ArchLinuxARM-rpi-latest.tar.gz | |
mirror_url=https://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/os/$mirror_name | |
build_dir=$build_path/$build_prefix-$arch | |
rm -rf $build_dir | |
mkdir -p $build_dir/root | |
[ ! -f /tmp/$mirror_name ] && wget $mirror_url -O /tmp/$mirror_name | |
bsdtar -xpf /tmp/$mirror_name -C $build_dir/root | |
cd $build_dir/root | |
# Install binfmt-qemu-static and reboot | |
# qemu-user-static-bin | |
cp $(which qemu-arm-static) usr/bin/ | |
# Configurations | |
#echo 'Server = http://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/$arch/$repo' > etc/pacman.d/mirrorlist | |
mount -o bind $pkgcache var/cache/pacman/pkg | |
cat << EOF | arch-chroot . usr/bin/bash | |
uname -a | |
sed 's/^CheckSpace/#CheckSpace/' -i /etc/pacman.conf | |
pacman-key --init | |
pacman-key --populate archlinuxarm | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm base base-devel | |
mkdir -p /etc/sudoers.d | |
echo v4 > /.arch-chroot | |
EOF | |
umount var/cache/pacman/pkg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment