rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | NAME = qemu |
| 2 | |
| 3 | all: src patch config build install |
| 4 | |
| 5 | NUM_PROCESSORS=`cat /proc/cpuinfo | grep processor | wc -l` |
| 6 | |
| 7 | VER=2.11.1 |
| 8 | QEMUDIR=qemu-${VER} |
| 9 | OUTDIR=bin-qemu-${VER} |
| 10 | SRCPKG=${QEMUDIR}.tar.xz |
| 11 | LKQEMUBIN=qemu-system-arm |
| 12 | LXQEMUBIN=qemu-system-aarch64 |
| 13 | |
| 14 | LKQEMUARGS="-machine virt -cpu cortex-a15 -m 64" |
| 15 | LXQEMUARGS="-machine virt -cpu cortex-a53 -m 64" |
| 16 | |
| 17 | .PHONY: patch |
| 18 | |
| 19 | src: |
| 20 | @sh -c "if [ ! -d ${QEMUDIR} ]; then \ |
| 21 | tar Jxvf ${SRCPKG}; \ |
| 22 | fi" |
| 23 | |
| 24 | patch: |
| 25 | |
| 26 | config: |
| 27 | @sh -c "if [ -d ${QEMUDIR} ]; then \ |
| 28 | cd ${QEMUDIR} && ./configure --target-list=arm-softmmu,aarch64-softmmu --disable-gtk --disable-tpm; \ |
| 29 | fi" |
| 30 | |
| 31 | build: |
| 32 | @sh -c "if [ -d ${QEMUDIR} ]; then \ |
| 33 | cd ${QEMUDIR} && molyq make -j${NUM_PROCESSORS}; \ |
| 34 | fi" |
| 35 | |
| 36 | install: |
| 37 | @sh -c "if [ -d ${QEMUDIR} ]; then \ |
| 38 | mkdir -p ${OUTDIR}; \ |
| 39 | cp ${QEMUDIR}/arm-softmmu/qemu-system-arm ${OUTDIR}/; \ |
| 40 | cp ${QEMUDIR}/aarch64-softmmu/qemu-system-aarch64 ${OUTDIR}/; \ |
| 41 | fi" |
| 42 | |
| 43 | clean: |
| 44 | rm -fr ${QEMUDIR} config-temp config.log |
| 45 | |
| 46 | runlk: |
| 47 | mosesq `pwd`/${OUTDIR}/${LKQEMUBIN} ${LKQEMUARGS} -kernel ../../out/qemu/lk.bin -nographic |
| 48 | |
| 49 | runlinux: |
| 50 | mosesq `pwd`/${OUTDIR}/${LXQEMUBIN} ${LXQEMUARGS} -kernel ../../out/qemu/Image -initrd ../../out/qemu/initramfs.bin -nographic -append \"root=/dev/ramdisk console=ttyAMA0\" |