1 all: buildroot/images/rootfs.cpio.uboot kernel-4.4/vmlinux
5 # TX2 U-Boot does not support FIT images
6 image.fit: buildroot/images/rootfs.cpio.uboot kernel-4.4/vmlinux
7 mkimage -f auto -d kernel-4.4/arch/arm64/boot/Image -i buildroot/images/rootfs.cpio.uboot -b kernel-4.4/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb image.fit
9 buildroot/images/rootfs.cpio.uboot: ./buildroot/.config
10 buildroot/images/rootfs.cpio.uboot: rootfs-overlay/lib/firmware/jailhouse.bin
11 buildroot/images/rootfs.cpio.uboot: modules_install
12 buildroot/images/rootfs.cpio.uboot: $(shell find rootfs-overlay)
13 buildroot/images/rootfs.cpio.uboot: rootfs-overlay/bin/prem-test
14 $(MAKE) -j1 -C buildroot ROOTFS_CPIO_COMPRESS_CMD="gzip --fast -c"
16 rootfs-overlay/bin/prem-test: ../test/prem-test
19 rootfs-overlay/lib/firmware/jailhouse.bin: ../jailhouse/hypervisor/jailhouse.bin
20 rootfs-overlay/lib/firmware/jailhouse.bin: $(wildcard ../jailhouse/configs/arm64/*.cell)
21 $(MAKE) jailhouse-install
23 jailhouse: ../jailhouse/hypervisor/jailhouse.bin
25 DESTDIR=$(CURDIR)/rootfs-overlay
27 jailhouse-install: FORCE
28 $(MAKE) -C ../jailhouse -j$(NPROC) install KDIR=$(CURDIR)/kernel-4.4 ARCH=arm64 DESTDIR=$(abspath $(DESTDIR)) prefix=/usr
29 mkdir -p $(DESTDIR)/jailhouse/configs/ $(DESTDIR)/jailhouse/demos/
30 # cp ../jailhouse/inmates/demos/arm64/my-demo.bin rootfs-overlay/jailhouse/demos/
31 cp ../jailhouse/configs/arm64/jetson-tx2.cell $(DESTDIR)/jailhouse/configs/
32 cp ../jailhouse/configs/arm64/jetson-tx2-demo.cell $(DESTDIR)/jailhouse/demos/
34 # Add something like this to ~/.ssh/config for
35 # jailhouse-install-remote to work out of the box:
38 # Hostname 192.168.1.54
39 INSTALL_HOST ?= root@tx2
41 jailhouse-install-remote: JAILHOUSE_DESTDIR=jailhouse-install
42 jailhouse-install-remote: jailhouse-install
43 rsync -rlptD jailhouse-install/ $(INSTALL_HOST):/
44 rsync -rlptD rootfs-overlay/lib/modules/ $(INSTALL_HOST):/lib/modules
46 ../jailhouse/hypervisor/jailhouse.bin: ../jailhouse/include/jailhouse/config.h
47 ../jailhouse/hypervisor/jailhouse.bin: kernel-4.4/vmlinux
48 ../jailhouse/hypervisor/jailhouse.bin: $(addprefix ../jailhouse/,$(shell cd ../jailhouse && git ls-files))
49 $(MAKE) -C ../jailhouse -j$(NPROC) KDIR=$(CURDIR)/kernel-4.4 ARCH=arm64 prefix=/usr
51 ../jailhouse/include/jailhouse/config.h: Makefile
53 echo '#define CONFIG_TRACE_ERROR 1' >> $@.tmp
54 echo '#define CONFIG_ARM_GIC_V2 1' >> $@.tmp
55 echo '#define CONFIG_MACH_JETSON_TX2 1' >> $@.tmp
59 $(MAKE) -C $(@D) -j$(NPROC)
61 linux_install: kernel-4.4/vmlinux
62 install -m644 -D kernel-4.4/arch/arm64/boot/Image $(DESTDIR)/boot/Image-prem
64 modules_install: kernel-4.4/vmlinux
65 $(MAKE) -C kernel-4.4 -j$(NPROC) modules_install INSTALL_MOD_PATH=$(DESTDIR)
69 ../test/prem-test: FORCE
73 rm -rf buildroot/images/rootfs.cpio.uboot kernel-4.4/vmlinux buildroot/target `find buildroot/ -name .stamp_target_installed` jailhouse-install
75 deploy: ../test/prem-test
76 #deploy: ../jailhouse/hypervisor/jailhouse.bin
77 scp ../test/prem-test tx2:/bin
78 # scp ../jailhouse/hypervisor/jailhouse.bin tx2:/lib/firmware
79 ssh tx2 'sh /etc/init.d/S20jailhouse.sh stop && sh /etc/init.d/S20jailhouse.sh start'
81 deb: DESTDIR=$(CURDIR)/_install.deb
82 deb: jailhouse-install linux_install modules_install DEBIAN_DIR
83 $(file >$(DESTDIR)/DEBIAN/control,$(deb_control))
84 $(file >$(DESTDIR)/DEBIAN/postinst,$(deb_postinst))
85 $(file >$(DESTDIR)/DEBIAN/prerm,$(deb_prerm))
86 chmod +x $(DESTDIR)/DEBIAN/postinst $(DESTDIR)/DEBIAN/prerm
87 rm -f _install.deb/lib/modules/*/source _install.deb/lib/modules/*/build
88 install -D ./rootfs-overlay/etc/init.d/S20jailhouse.sh $(DESTDIR)/etc/init.d/jailhouse
89 install -m644 -D ./rootfs-overlay/etc/systemd/system/jailhouse.service $(DESTDIR)/lib/systemd/system/jailhouse.service
90 #install -d $(DESTDIR)/lib/systemd/system/multi-user.target.wants/
91 #ln -sf ../jailhouse.service $(DESTDIR)/lib/systemd/system/multi-user.target.wants/jailhouse.service
92 # Note: --root-owner-group requires dpkg version 1.19.0+
93 dpkg-deb --root-owner-group --build $(DESTDIR) .
96 install -d $(DESTDIR)/DEBIAN
104 Maintainer: Michal Sojka <michal.sojka@cvut.cz>
106 Version: $(shell git describe --always --dirty)
107 Description: Jailhouse hypervisor and the Linux kernel for the HERCULES project.
113 if ! grep -q Image-prem /boot/extlinux/extlinux.conf; then
114 cat >>/boot/extlinux/extlinux.conf <<'EOF'
116 MENU LABEL prem kernel and jailhouse
117 LINUX /boot/Image-prem
118 APPEND $${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 mem=7808M vmalloc=512M jailhouse
126 if grep -q Image-prem /boot/extlinux/extlinux.conf; then