x86机器的linux下面运行下面命令

sudo apt install debootstrap -y
sudo apt-get install qemu-user-static -y
mkdir debian8-rootfs
cd debian8-rootfs

wget  https://ftp-master.debian.org/keys/release-8.asc -qO- | gpg --import --no-default-keyring --keyring /usr/share/keyrings/release-8.gpg

sudo debootstrap --keyring=/usr/share/keyrings/release-8.gpg --foreign --verbose --arch=arm64  jessie rootfs http://archive.debian.org/debian-archive/debian/

sudo mount --bind /dev rootfs/dev/
sudo mount --bind /sys rootfs/sys/
sudo mount --bind /proc rootfs/proc/
sudo mount --bind /dev/pts rootfs/dev/pts/

sudo cp /usr/bin/qemu-aarch64-static rootfs/usr/bin/

sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs /debootstrap/debootstrap --second-stage --verbose

sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs
echo deb http://archive.debian.org/debian-archive/debian jessie main > /etc/apt/sources.list
apt update
apt install build-essential

这样编译环境就搭建好了,,就可以编译aarch64下面的dropbear或nginx程序了,比交叉编译环境好用得多。

退出环境命令:

exit

sudo umount   rootfs/dev/pts/ 
sudo umount   rootfs/dev/
sudo umount   rootfs/sys/
sudo umount   rootfs/proc/

以后进入环境命令为:

cd debian8-rootfs
sudo mount --bind /dev rootfs/dev/
sudo mount --bind /sys rootfs/sys/
sudo mount --bind /proc rootfs/proc/
sudo mount --bind /dev/pts rootfs/dev/pts/
sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs

确实比交叉编译环境好用得多。

标签: none

添加新评论