This instruction assumes, the php source files of master branch are installed in /home/dmitry/php/php-master
. Please correct all the relevant paths according to your real path.
sudo dnf install gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu
1. Install necessary packages
sudo dnf install qemu-system-aarch64 sudo dnf install cloud-utils
2. Create directory for VM image file
mkdir -p /home/dmitry/php/php-master/ARM64 cd /home/dmitry/php/php-master/ARM64
3. Download system image files
wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-arm64-uefi1.img wget https://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/QEMU_EFI.fd
4. Create file cloud.txt with the following context. Add your real name (I recommend to use the same name as on host system) and your ssh public key.
#cloud-config users: - name: <your_name> ssh-authorized-keys: - <your_ssh_public_key> sudo: ['ALL=(ALL) NOPASSWD:ALL'] groups: sudo shell: /bin/bash
5. Create user image file
cloud-localds --disk-format qcow2 cloud.img cloud.txt
6. Start QEMU
qemu-system-aarch64 \ -smp 2 \ -m 2048 \ -M virt \ -cpu cortex-a57 \ -bios QEMU_EFI.fd \ -nographic \ -device virtio-blk-device,drive=hd0 \ -drive if=none,file=ubuntu-16.04-server-cloudimg-arm64-uefi1.img,id=hd0 \ -device virtio-blk-device,drive=cloud \ -drive if=none,id=cloud,file=cloud.img \ -virtfs local,path=/home/dmitry/php/php-master,mount_tag=php-master,security_model=passthrough,id=php-master \ -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22
this will take a wile...
7. Connect to running VM through SSH
ssh -p 2222 dmitry@127.0.0.1
The following instructions are executed on guest VM...
8. Install necessary packages (the list may be incomplete)
sudo apt-get update sudo apt-get install git autoconf automake bison build-essential curl flex \ libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline-dev \ libsqlite3-dev nginx openssl pkg-config re2c sqlite3 zlib1g-dev \ gdb linux-tools-common
9. Mount PHP source directory
Add the following line to /etc/fstab
php-master /home/dmitry/php/php-master 9p noauto,trans=virtio,version=9p2000.L 0 0
mkdir -p /home/dmitry/php/php-master sudo mount /home/dmitry/php/php-master
10. Copy include/lib files to host
cd /home/dmitry/php/php-master/ARM64 mkdir -p lib/aarch64-linux-gnu mkdir -p usr/include mkdir -p usr/lib cp -a /lib/aarch64-linux-gnu lib cp -a /usr/include usr cp -a /usr/lib usr cd usr/lib ln -s aarch64-linux-gnu/crt1.o crt1.o ln -s aarch64-linux-gnu/crti.o crti.o ln -s aarch64-linux-gnu/crtn.o crtn.o cd aarch64-linux-gnu ln -sf ../../../lib/aarch64-linux-gnu/libdl.so.2 libdl.so
mkdir /home/dmitry/php/php-master/ARM64-DEBUG cd /home/dmitry/php/php-master/ARM64-DEBUG CC='aarch64-linux-gnu-gcc --sysroot=/home/dmitry/php/php-master/ARM64 -I/home/dmitry/php/php-master/ARM64/usr/include/aarch64-linux-gnu -L/home/dmitry/php/php-master/ARM64/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/home/dmitry/php/php-master/ARM64/lib/aarch64-linux-gnu' \ '../configure' \ '--host=aarch64-linux-gnu' \ '--target=aarch64-linux-gnu' \ '--prefix=/home/dmitry/php/php-master/ARM64/DEBUG' \ '--with-config-file-path=/home/dmitry/php/php-master/ARM64/DEBUG/etc' \ '--disable-all' \ '--enable-opcache' \ '--enable-debug' \ '--enable-filter' \ '--enable-pdo' \ '--enable-session' \ '--enable-tokenizer' \ '--with-iconv' \ '--with-pdo-mysql=mysqlnd' \ '--with-mysqli=mysqlnd' make make install
cd /home/dmitry/php/php-master/ARM64-DEBUG cp ext/opcache/.libs/opcache.so ext/opcache/.libs/opcache.la modules make test TESTS="ext/opcache/tests/jit"