ACPI P-State support step 1/2: Extract information from ACPI objects
[dragonfly.git] / test / vkernel / Makefile
blob9ffc4dfde5ab272c55303f2b9dd3666f7ce36263
1 # Makefile - set up a vkernel environment for testing the vkernel
4 # require it to be specified
5 SRCDIR ?= ${.CURDIR}/../..
6 ROOTSIZE ?= 512M
7 NETADDR= 10.3.1.1
9 all: help
11 scratch: world32 kernel32 install32
12 @echo "Run the environment with:"
13 @echo "make VKDIR=${VKDIR} run"
15 quickw: quickworld32 quickkernel32 reinstall32 reinstallkernel32
16 @echo "Run the environment with:"
17 @echo "make VKDIR=${VKDIR} run"
19 quick: quickkernel32 reinstallkernel32
20 @echo "Run the environment with:"
21 @echo "make VKDIR=${VKDIR} run"
23 help:
24 @echo "Setup Instructions:"
25 @echo ""
26 @echo " setenv VKDIR target_dir"
27 @echo ""
28 @echo "Meta target components:"
29 @echo ""
30 @echo " help - this help"
31 @echo " clean - clean up"
32 @echo " scratch - build and install everything from scratch"
33 @echo " (this is absolutely everything)"
34 @echo " quick - incremental kernel build & reinstall"
35 @echo " quickw - incremental world & kernel build & reinstall"
36 @echo " run - run vkernel with VKDIR/root.img"
37 @echo " mount - mount VKDIR/root.img at VKDIR/root"
38 @echo " umount - unmount"
39 @echo ""
40 @echo "Individual target components:"
41 @echo ""
42 @echo " world32 - build the 32 bit world from scratch"
43 @echo " root32 - create a new, empty root.img"
44 @echo " install32 - install a 32 bit world & kernel"
45 @echo " into root.img"
46 @echo " kernel32 - build 32 bit vkernel"
47 @echo " quickworld32 - incremental rebuild world32"
48 @echo " quickkernel32 - incremental rebuild kernel32"
49 @echo " reinstall32 - reinstall world32 into root.img"
50 @echo " (just the installworld piece)"
51 @echo " reinstallkernel32 - reinstall kernel32 into root.img"
52 @echo ""
54 # Unmount everything, de-configured VN, and clean up.
55 # (check handles umounting/deconfiguring)
57 clean: check
58 rm -rf ${VKDIR}/root.img ${VKDIR}/root
60 # Build the 32 bit world and kernel
63 world32: checkq
64 cd ${SRCDIR} && make -j 4 buildworld
66 kernel32: checkq
67 cd ${SRCDIR} && make -j 4 KERNCONF=VKERNEL buildkernel
69 # Quick build - just rebuild the kernel quickly
72 quickworld32: checkq
73 cd ${SRCDIR} && make -j 4 quickworld
75 quickkernel32: checkq
76 cd ${SRCDIR} && make KERNCONF=VKERNEL quickkernel
78 # Build and mount an empty filesystem for the emulated root disk
80 # NOTE: root32 must umount when done because a later dependency may
81 # have a dependency on mount.
83 root32: check
84 vnconfig -c -T -S ${ROOTSIZE} -s labels \
85 `cat ${VKDIR}/vn.which` ${VKDIR}/root.img
86 dd if=/dev/zero of=/dev/`cat ${VKDIR}/vn.which` bs=32k count=4
87 fdisk -IB `cat ${VKDIR}/vn.which`
88 disklabel -r -w `cat ${VKDIR}/vn.which`s1 auto
89 disklabel `cat ${VKDIR}/vn.which`s1 > ${VKDIR}/label.tmp
90 echo 'a: * 0 4.2BSD' >> ${VKDIR}/label.tmp
91 disklabel -R `cat ${VKDIR}/vn.which`s1 ${VKDIR}/label.tmp
92 disklabel -B `cat ${VKDIR}/vn.which`s1
93 newfs /dev/`cat ${VKDIR}/vn.which`s1a
94 mkdir -p ${VKDIR}/root
95 vnconfig -u `cat ${VKDIR}/vn.which` > /dev/null 2>&1
97 mount: check
98 vnconfig -c -s labels `cat ${VKDIR}/vn.which` ${VKDIR}/root.img
99 fsck -p /dev/`cat ${VKDIR}/vn.which`s1a
100 mount /dev/`cat ${VKDIR}/vn.which`s1a ${VKDIR}/root
101 @echo "Mounted ${VKDIR}/root"
103 umount: check
105 # Install a fresh 32 bit world & distribution, and kernel
107 install32: mount
108 cd ${SRCDIR} && \
109 make -j 4 DESTDIR=${VKDIR}/root installworld
110 cd ${SRCDIR}/etc && \
111 make -j 4 DESTDIR=${VKDIR}/root distribution
112 echo '/dev/vkd0s1a / ufs rw 1 1' > ${VKDIR}/root/etc/fstab
113 echo 'proc /proc procfs rw 0 0' >> ${VKDIR}/root/etc/fstab
114 echo 'vfs.root.mountfrom="ufs:vkds1a"' > ${VKDIR}/root/boot/loader.conf
115 #(egrep -v '^console' ${VKDIR}/root/etc/ttys; echo 'console "/usr/libexec/getty Pc" cons25 on secure') > ${VKDIR}/root/etc/ttys.new
116 #mv -f ${VKDIR}/root/etc/ttys.new ${VKDIR}/root/etc/ttys
117 cd ${SRCDIR} && \
118 make -j 4 \
119 DESTDIR=${VKDIR}/root KERNCONF=VKERNEL \
120 NO_MODULES= \
121 installkernel
122 cp ${VKDIR}/root/boot/kernel ${VKDIR}/vkernel
124 # Quick reinstall - just install a new kernel on top of an existing image
127 reinstall32: mount
128 cd ${SRCDIR} && make -j 4 DESTDIR=${VKDIR}/root installworld
130 reinstallkernel32: mount
131 cd ${SRCDIR} && \
132 make -j 4 DESTDIR=${VKDIR}/root KERNCONF=VKERNEL \
133 NO_MODULES= installkernel
134 cp ${VKDIR}/root/boot/kernel ${VKDIR}/vkernel
136 sysloader: mount
137 cp /boot/loader ${VKDIR}/root/boot/loader
138 sync
140 # Run the vkernel on our image. Make sure we are unmounted so
141 # we do not compete against the emulated kernel when writing to root.img.
142 # (check does this for us)
144 run: check
145 cd ${VKDIR} && ./vkernel -m 128m -n 2 \
146 -r root.img -U -v \
147 -I /dev/vknet
148 # -I /dev/vknet:0.0.0.0:${NETADDR}/16
150 # Make sure we are not mounted and the VN device is unconfigured,
152 # Find an unused VN device but do not do anything with it yet.
154 checkq:
155 .if !defined(VKDIR)
156 @(echo "must specify VKDIR=target or as an environment variable"; exit 1)
157 .endif
158 .if exists(${VKDIR})
159 @echo "${VKDIR} found"
160 .else
161 mkdir -p ${VKDIR}
162 .endif
164 check: checkq
165 .if exists(${VKDIR}/vn.which)
166 -umount ${VKDIR}/root > /dev/null 2>&1
167 -vnconfig -u `cat ${VKDIR}/vn.which` > /dev/null 2>&1
168 rm -f ${VKDIR}/vn.which
169 .endif
170 (vnconfig -l | fgrep "not in use" > /dev/null) || \
171 (echo "Cannot find unused VN"; exit 1)
172 vnconfig -l | fgrep "not in use" | \
173 cut -f 1 -d : | head -1 > ${VKDIR}/vn.which
174 egrep '^vn' ${VKDIR}/vn.which > /dev/null || \
175 (echo "VN device selection is bad"; exit 1)