run arm64 on amd64

chroot到根目录失败

安装apt-get install qemu-user-static

sudo debootstrap --arch=arm64 stretch ./arm64_root/ https://mirrors.tuna.tsinghua.edu.cn/debian


SEEK=2047
RELEASE=stretch
DIR=arm64_root

sudo chroot arm64_root  /bin/bash -c "printf '\nauto eth0\niface eth0 inet dhcp\n' | tee -a /etc/network/interfaces"
sudo chroot arm64_root /bin/bash -c "sed -i '/^root/ { s/:x:/::/ }' /etc/passwd"

use_eth0=$(cat <<-END
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="20:1a:06:d8:65:ae", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
END
)

sudo chroot arm64_root  /bin/bash -c "printf '$use_eth0' > /etc/udev/rules.d/70-persistent-net.rules"

sudo chroot arm64_root /bin/bash -c "apt install openssh-server vim git"

sudo mkdir -p arm64_root/root/.ssh ; sudo cp stretch.id_rsa.pub arm64_root/root/.ssh/authorized_keys

dd if=/dev/zero of=$RELEASE.img bs=1M seek=$SEEK count=1
sudo mkfs.ext4 -F $RELEASE.img
sudo mount -o loop $RELEASE.img ./tmp
sudo cp -rf ./arm64_root/. ./tmp/.
sudo umount ./tmp

sudo apt install qemu-efi-aarch64
wget https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-arm64.qcow2

https://askubuntu.com/questions/803322/properly-disabling-predictable-interface-naming-on-xenial

你可能感兴趣的:(run arm64 on amd64)