initrd: Detach from the world and build on the fly
[dragonfly.git] / initrd / Makefile
1 # Target directory to install the rescue tools
2 RESCUE_DIR?=            /rescue
3
4 # Temporary directory to stage the initrd files (e.g., /etc)
5 # NOTE: Ignore ${DESTDIR} when staging files into this directory
6 INITRD_STAGEDIR!=       mktemp -d -t initrd-stage
7
8 .END:
9         rm -rf ${INITRD_STAGEDIR}
10
11 rescue:
12         @${ECHO} ">>> Building and installing rescue tools ..."
13 .for _dir in bin oinit sbin sbin.libcrypto sbin.lvm
14         (cd ${.CURDIR}/${_dir}; \
15             @${ECHO} "=> ${_dir}"; \
16             make BINDIR=${RESCUE_DIR} depend all install clean cleandepend)
17 .endfor
18
19 initrd: rescue
20         @${ECHO} ">>> Preparing initrd contents ..."
21         (cd ${.CURDIR}/etc; \
22             mkdir ${INITRD_STAGEDIR}/etc; \
23             make DESTDIR="" BINDIR=${INITRD_STAGEDIR}/etc \
24                 depend all install)
25         @${ECHO} ">>> Creating initrd.img.gz ..."
26         sh ${.CURDIR}/mkinitrd.sh \
27             -b ${DESTDIR}/boot \
28             -r ${DESTDIR}${RESCUE_DIR} \
29             -c ${INITRD_STAGEDIR}
30         (cd ${.CURDIR}/etc; make clean cleandepend)