summaryrefslogtreecommitdiff
path: root/distrib/amd64
diff options
context:
space:
mode:
authorMartin Natano <natano@cvs.openbsd.org>2016-11-24 16:32:34 +0000
committerMartin Natano <natano@cvs.openbsd.org>2016-11-24 16:32:34 +0000
commit8a783c8f62af02796a06d02b8665e21b827706e1 (patch)
tree3bf6c78a147b255b677bfd651ed97c6d1e77cf15 /distrib/amd64
parent50f0af2751116f1c04947247a102c84e0431e334 (diff)
Use makefs to build bsd.rd. amd64 and i386 are first; other platforms
will follow with some safety distance when I figured out all MD quirks. makefs allows to build the ramdisk image as an unprivileged user. The next step in the quest to reduce root during builds. ok deraadt
Diffstat (limited to 'distrib/amd64')
-rw-r--r--distrib/amd64/ramdiskA/Makefile.inc52
-rw-r--r--distrib/amd64/ramdisk_cd/Makefile.inc52
2 files changed, 36 insertions, 68 deletions
diff --git a/distrib/amd64/ramdiskA/Makefile.inc b/distrib/amd64/ramdiskA/Makefile.inc
index 6229c46e94b..450b912de04 100644
--- a/distrib/amd64/ramdiskA/Makefile.inc
+++ b/distrib/amd64/ramdiskA/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.2 2016/10/19 17:21:14 natano Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2016/11/24 16:32:33 natano Exp $
TOP= ${.CURDIR}/..
@@ -54,10 +54,13 @@ ${FS}: bsd.gz
cp ${REALIMAGE} ${FS}
rm ${REALIMAGE}
-DISKTYPE?= rdroot
-NBLKS?= 4480
-# minfree, opt, b/i trks, sects, cpg
-NEWFSARGS= -m 0 -o space -i 4096
+unconfig:
+ -umount -f ${MOUNT_POINT}
+ -vnconfig -u ${VND}
+
+
+DISKTYPE= rdroot
+MAKEFSARGS_RD= -o disklabel=${DISKTYPE},minfree=0,density=4096
bsd.gz: bsd.rd
cp bsd.rd bsd.strip
@@ -75,34 +78,21 @@ bsd:
su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && env COPTS=-Os ${MAKE}'
cp -p ${.CURDIR}/../../../sys/arch/amd64/compile/${RAMDISK}/obj/bsd bsd
-mr.fs: instbin rd_setup do_files rd_teardown
-
-rd_setup: instbin
- dd if=/dev/zero of=${REALIMAGE} bs=512 count=${NBLKS}
- vnconfig -v -c ${VND} ${REALIMAGE}
- disklabel -w ${VND} ${DISKTYPE}
- newfs ${NEWFSARGS} ${VND_RDEV}
- fsck ${VND_RDEV}
- mount ${VND_DEV} ${MOUNT_POINT}
-
-rd_teardown:
- @df -i ${MOUNT_POINT}
- -umount ${MOUNT_POINT}
- -vnconfig -u ${VND}
- cp ${REALIMAGE} mr.fs
- rm ${REALIMAGE}
+mr.fs: instbin
+ rm -rf $@.d
+ install -d -o root -g wheel $@.d
+ mtree -def ${MTREE} -p $@.d -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} REV=${REV} \
+ TARGDIR=$@.d UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \
+ sh ${UTILS}/runlist.sh ${LISTS}
+ rm $@.d/instbin
+ makefs ${MAKEFSARGS_RD} $@ $@.d
rdsetroot: ${TOP}/../common/elfrdsetroot.c
${HOSTCC} ${HOSTCFLAGS} -o rdsetroot \
${TOP}/../common/elfrdsetroot.c ${TOP}/../common/elf32.c \
${TOP}/../common/elf64.c
-unconfig:
- -umount -f ${MOUNT_POINT}
- -vnconfig -u ${VND}
-
-.PRECIOUS: mr.fs
-
.ifdef RELEASEDIR
install:
.ifndef NOBSDRD
@@ -124,18 +114,12 @@ instbin: instbin.mk instbin.cache instbin.c
instbin.conf: ${LISTS}
awk -f ${UTILS}/makeconf.awk CBIN=instbin ${LISTS} > instbin.conf
-do_files:
- mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u
- TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
- REV=${REV} TARGDIR=${MOUNT_POINT} UTILS=${UTILS} \
- RELEASEDIR=${RELEASEDIR} sh ${UTILS}/runlist.sh ${LISTS}
- rm ${MOUNT_POINT}/instbin
-
clean cleandir:
/bin/rm -f *.core mr.fs instbin instbin.mk instbin*.cache \
*.o *.lo *.c bsd bsd.rd bsd.gz bsd.strip floppy*.fs \
lib*.a lib*.olist instbin.map \
rdsetroot boot instbin.conf ${FS}
+ /bin/rm -rf mr.fs.d
.include <bsd.obj.mk>
.include <bsd.subdir.mk>
diff --git a/distrib/amd64/ramdisk_cd/Makefile.inc b/distrib/amd64/ramdisk_cd/Makefile.inc
index ab8dfb3221e..e23591f78b6 100644
--- a/distrib/amd64/ramdisk_cd/Makefile.inc
+++ b/distrib/amd64/ramdisk_cd/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.2 2016/10/19 17:45:38 natano Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2016/11/24 16:32:33 natano Exp $
TOP= ${.CURDIR}/..
@@ -57,10 +57,13 @@ ${FS}: bsd.gz
cp ${REALIMAGE} ${FS}
rm ${REALIMAGE}
-DISKTYPE?= rdroot
-NBLKS?= 4480
-# minfree, opt, b/i trks, sects, cpg
-NEWFSARGS= -m 0 -o space -i 4096
+unconfig:
+ -umount -f ${MOUNT_POINT}
+ -vnconfig -u ${VND}
+
+
+DISKTYPE= rdroot
+MAKEFSARGS_RD= -o disklabel=${DISKTYPE},minfree=0,density=4096
bsd.gz: bsd.rd
cp bsd.rd bsd.strip
@@ -78,34 +81,21 @@ bsd:
su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && env COPTS=-Os ${MAKE}'
cp -p ${.CURDIR}/../../../sys/arch/amd64/compile/${RAMDISK}/obj/bsd bsd
-mr.fs: instbin rd_setup do_files rd_teardown
-
-rd_setup: instbin
- dd if=/dev/zero of=${REALIMAGE} bs=512 count=${NBLKS}
- vnconfig -v -c ${VND} ${REALIMAGE}
- disklabel -w ${VND} ${DISKTYPE}
- newfs ${NEWFSARGS} ${VND_RDEV}
- fsck ${VND_RDEV}
- mount ${VND_DEV} ${MOUNT_POINT}
-
-rd_teardown:
- @df -i ${MOUNT_POINT}
- -umount ${MOUNT_POINT}
- -vnconfig -u ${VND}
- cp ${REALIMAGE} mr.fs
- rm ${REALIMAGE}
+mr.fs: instbin
+ rm -rf $@.d
+ install -d -o root -g wheel $@.d
+ mtree -def ${MTREE} -p $@.d -u
+ TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} REV=${REV} \
+ TARGDIR=$@.d UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \
+ sh ${UTILS}/runlist.sh ${LISTS}
+ rm $@.d/instbin
+ makefs ${MAKEFSARGS_RD} $@ $@.d
rdsetroot: ${TOP}/../common/elfrdsetroot.c
${HOSTCC} ${HOSTCFLAGS} -o rdsetroot \
${TOP}/../common/elfrdsetroot.c ${TOP}/../common/elf32.c \
${TOP}/../common/elf64.c
-unconfig:
- -umount -f ${MOUNT_POINT}
- -vnconfig -u ${VND}
-
-.PRECIOUS: mr.fs
-
.ifdef RELEASEDIR
install:
.ifndef NOBSDRD
@@ -127,18 +117,12 @@ instbin: instbin.mk instbin.cache instbin.c
instbin.conf: ${LISTS}
awk -f ${UTILS}/makeconf.awk CBIN=instbin ${LISTS} > instbin.conf
-do_files:
- mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u
- TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
- REV=${REV} TARGDIR=${MOUNT_POINT} UTILS=${UTILS} \
- RELEASEDIR=${RELEASEDIR} sh ${UTILS}/runlist.sh ${LISTS}
- rm ${MOUNT_POINT}/instbin
-
clean cleandir:
/bin/rm -f *.core mr.fs instbin instbin.mk instbin*.cache \
*.o *.lo *.c bsd bsd.rd bsd.gz bsd.strip floppy*.fs \
lib*.a lib*.olist instbin.map \
rdsetroot boot instbin.conf ${FS}
+ /bin/rm -rf mr.fs.d
.include <bsd.obj.mk>
.include <bsd.subdir.mk>