Refer to https://blog.csdn.net/hushui/article/details/103791704
### build static link usermode/qemu-aarch64
jhula@ShSwDev2:~/tmp/qemu-4.2.0$ ./configure --target-list=aarch64-linux-user,arm-linux-user,i386-linux-user,x86_64-linux-user --enable-debug --enable-gtk --enable-vnc --prefix=$HOME/usr --static --disable-system --enable-linux-user
### ubuntu-base-18.04-base-arm64 rootfs
### Host CPU/Linux/X86_64/Ubuntu16
jhula@ShSwDev2:~/tmp/qemu-4.2.0$
jhula@ShSwDev2:~/tmp/qemu-4.2.0$ cat /proc/version
Linux version 4.4.0-142-generic (buildd@lgw01-amd64-033) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10) ) #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019
jhula@ShSwDev2:~/tmp/qemu-4.2.0$ uname -a
Linux ShSwDev2 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
jhula@ShSwDev2:~/tmp/qemu-4.2.0$ cat /etc/issue
Ubuntu 16.04.3 LTS \n \l
## register qemu-aarch64 in /proc/sys/fs/binfmt_misc/register
# arm 64bit / qemu-aarch64
jhula@ShSwDev2:~/local/lfs$ sudo cp /home/jhula/usr/bin/qemu-aarch64 /home/jhula/local/lfs/ubuntu-base-18.04-base-arm64/usr/bin/
jhula@ShSwDev2:~/local/lfs$ echo ":qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64:" > /proc/sys/fs/binfmt_misc/register
-bash: /proc/sys/fs/binfmt_misc/register: Permission denied
jhula@ShSwDev2:~/local/lfs$ sudo echo ":qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64:" > /proc/sys/fs/binfmt_misc/register
-bash: /proc/sys/fs/binfmt_misc/register: Permission denied
# arm v7 / qemu-arm
jhula@ShSwDev2:~/local/lfs$ sudo cp ~/usr/bin/qemu-arm ubuntu-base-16.04-core-armhf/usr/bin/
jhula@ShSwDev2:~/local/lfs$ sudo /bin/bash
root@ShSwDev2:/localrepo/jhula/lfs# echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:' >/proc/sys/fs/binfmt_misc/register
Refer to https://fuchsia.googlesource.com/third_party/qemu/+/v2.5.1/scripts/qemu-binfmt-conf.sh
#chroot to ARM target rootfs, execute /bin/bash ARM elf
jhula@ShSwDev2:~/local/lfs$ sudo chroot ubuntu-base-18.04-base-arm64/
root@ShSwDev2:/# uname -a
Linux ShSwDev2 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
root@ShSwDev2:/#
systemd of Ubuntu18
root@lake-Latitude-5491:/# which init <<<< Issue no init/systemd in ubuntu-base-18.04-base-arm64/armhf
root@lake-Latitude-5491:/# which systemd
root@lake-Latitude-5491:/# which busybox
root@lake-Latitude-5491:/# which ps
/bin/ps
root@lake-Latitude-5491:/# which init
root@lake-Latitude-5491:/#
root@lake-Latitude-5491:/# apt list --installed |grep systemd <<<<< Ubuntu18/arm/default no systemd
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libsystemd0/bionic,now 237-3ubuntu10 arm64 [installed]
### Ubuntu16/ARM/default
root@ShSwDev2:/# apt list --installed |grep systemd
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libsystemd0/xenial,now 229-4ubuntu4 armhf [installed]
systemd/xenial,now 229-4ubuntu4 armhf [installed]
systemd-sysv/xenial,now 229-4ubuntu4 armhf [installed]
### Note , to mount /proc /dev etc, please use the shell from https://blog.csdn.net/hushui/article/details/103791704