summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--distrib/miniroot/install.sub18
-rw-r--r--distrib/sets/lists/base/mi14
-rw-r--r--distrib/syspatch/README8
-rw-r--r--etc/Makefile10
-rw-r--r--etc/mtree/4.4BSD.dist14
-rw-r--r--etc/rc52
-rw-r--r--libexec/ld.so/Makefile6
-rw-r--r--libexec/reorder_kernel/reorder_kernel.sh18
-rw-r--r--share/mk/bsd.lib.mk6
-rw-r--r--usr.sbin/config/mkmakefile.c10
10 files changed, 87 insertions, 69 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index cdc929b8ed4..7b277e5dd01 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1042 2017/11/02 15:35:20 rpe Exp $
+# $OpenBSD: install.sub,v 1.1043 2017/11/05 10:29:24 rpe Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2641,8 +2641,8 @@ store_random() {
# Final steps common for installs and upgrades.
finish_up() {
local _dev _mp _fstype _rest _d
- local _compile=/mnt/usr/share/compile _kernel=${MDKERNEL:-GENERIC}
- local _syspatch_archs="amd64 i386"
+ local _kernel_dir=/mnt/usr/share/relink/kernel
+ local _kernel=${MDKERNEL:-GENERIC} _syspatch_archs="amd64 i386"
# Mount all known swap partitions. This gives systems with little
# memory a better chance at running 'MAKEDEV all'.
@@ -2706,16 +2706,16 @@ finish_up() {
# ensure it references the kernel as /bsd.
sha256 /mnt/bsd | (umask 077; sed 's,/mnt,,' >/mnt/var/db/kernel.SHA256)
- if [[ -f $_compile.tgz ]]; then
+ if [[ -f $_kernel_dir.tgz ]]; then
echo -n "Relinking to create unique kernel..."
(
set -e
- rm -rf $_compile
- mkdir -m 700 -p $_compile
- tar -C $_compile -xzf $_compile.tgz $_kernel
- chroot /mnt /bin/ksh -e -c "cd ${_compile#/mnt}/$_kernel; \
+ rm -rf $_kernel_dir
+ mkdir -m 700 -p $_kernel_dir
+ tar -C $_kernel_dir -xzf $_kernel_dir.tgz $_kernel
+ chroot /mnt /bin/ksh -e -c "cd ${_kernel_dir#/mnt}/$_kernel; \
make newbsd; make newinstall"
- rm -f $_compile.tgz
+ rm -f $_kernel_dir.tgz
) >/dev/null 2>&1 && echo "done." || echo "failed."
fi
diff --git a/distrib/sets/lists/base/mi b/distrib/sets/lists/base/mi
index d76224a43ab..e96a6ae4637 100644
--- a/distrib/sets/lists/base/mi
+++ b/distrib/sets/lists/base/mi
@@ -620,9 +620,7 @@
./usr/include
./usr/lib
./usr/lib/libc.so.92.0
-./usr/lib/libc.so.92.0.a
./usr/lib/libcrypto.so.42.0
-./usr/lib/libcrypto.so.42.0.a
./usr/lib/libcurses.so.14.0
./usr/lib/libedit.so.5.2
./usr/lib/libevent.so.4.1
@@ -669,7 +667,6 @@
./usr/libdata/cvs/contrib
./usr/libdata/cvs/contrib/README
./usr/libdata/cvs/contrib/intro.doc
-./usr/libdata/ld.so.a
./usr/libdata/perl5
./usr/libdata/perl5/AnyDBM_File.pm
./usr/libdata/perl5/App
@@ -2579,8 +2576,6 @@
./usr/share/calendar/ru_RU.UTF-8/calendar.orthodox
./usr/share/calendar/ru_RU.UTF-8/calendar.pagan
./usr/share/calendar/ru_RU.UTF-8/calendar.primety
-./usr/share/compile
-./usr/share/compile.tgz
./usr/share/dict
./usr/share/dict/README
./usr/share/dict/american
@@ -2699,6 +2694,15 @@
./usr/share/mk/bsd.xconf.mk
./usr/share/mk/bsd.xorg.mk
./usr/share/mk/sys.mk
+./usr/share/relink
+./usr/share/relink/kernel
+./usr/share/relink/kernel.tgz
+./usr/share/relink/usr
+./usr/share/relink/usr/libexec
+./usr/share/relink/usr/libexec/ld.so.a
+./usr/share/relink/usr/lib
+./usr/share/relink/usr/lib/libc.so.92.0.a
+./usr/share/relink/usr/lib/libcrypto.so.42.0.a
./usr/share/snmp
./usr/share/snmp/mibs
./usr/share/snmp/mibs/OPENBSD-BASE-MIB.txt
diff --git a/distrib/syspatch/README b/distrib/syspatch/README
index 06ab8813110..f48c6738270 100644
--- a/distrib/syspatch/README
+++ b/distrib/syspatch/README
@@ -1,4 +1,4 @@
-$OpenBSD: README,v 1.2 2017/09/03 09:42:03 ajacoutot Exp $
+$OpenBSD: README,v 1.3 2017/11/05 10:29:24 rpe Exp $
Notes about the syspatch(8) build process
=========================================
@@ -35,9 +35,9 @@ install -m 0700 ${RELEASEDIR}/bsd{,.mp} ${FAKE}
for set in base comp game man xbase xshare xfont xserv; do
tar xzphf ${RELEASEDIR}/${set}$(uname -r | tr -d '.').tgz -C ${FAKE}
done
-mkdir -m 700 -p ${FAKE}/usr/share/compile/GENERIC{,.MP}
-tar -C ${FAKE}/usr/share/compile -xzf ${FAKE}/usr/share/compile.tgz
-rm ${FAKE}/usr/share/compile.tgz
+mkdir -m 700 -p ${FAKE}/usr/share/relink/kernel/GENERIC{,.MP}
+tar -C ${FAKE}/usr/share/relink/kernel -xzf ${FAKE}/usr/share/relink/kernel.tgz
+rm ${FAKE}/usr/share/relink/kernel.tgz
Building a syspatch
-------------------
diff --git a/etc/Makefile b/etc/Makefile
index 26461a8c4ad..aa0a7309ce2 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.460 2017/06/22 16:02:42 deraadt Exp $
+# $OpenBSD: Makefile,v 1.461 2017/11/05 10:29:24 rpe Exp $
.include <bsd.own.mk>
@@ -30,11 +30,11 @@ kernels: ${ALL_KERNELS}
chmod a+r ${RELEASEDIR}/$K
.endfor
cd ${.CURDIR}/../sys/arch/${MACHINE}/compile/ && \
- tar -chzf ${DESTDIR}/usr/share/compile.tgz -s ',/obj/,/,' \
+ tar -chzf ${DESTDIR}/usr/share/relink/kernel.tgz -s ',/obj/,/,' \
GENERIC*/obj/*.o GENERIC*/obj/Makefile \
GENERIC*/obj/ld.script GENERIC*/obj/makegap.sh
- chown root:wheel ${DESTDIR}/usr/share/compile.tgz
- chmod 644 ${DESTDIR}/usr/share/compile.tgz
+ chown root:wheel ${DESTDIR}/usr/share/relink/kernel.tgz
+ chmod 644 ${DESTDIR}/usr/share/relink/kernel.tgz
# -rw-r--r--
BINOWN= root
@@ -272,7 +272,7 @@ do-release:
release-sets:
su ${BUILDUSER} -c 'exec ${MAKE} distribution'
su ${BUILDUSER} -c 'exec ${MAKE} kernels'
- cp -p ${DESTDIR}/usr/share/compile.tgz /usr/share/compile.tgz
+ cp -p ${DESTDIR}/usr/share/relink/kernel.tgz /usr/share/relink/kernel.tgz
${MAKE} bootblocks
cd ${RELEASEDIR} && rm -f SHA256
cd ../distrib/sets && exec su ${BUILDUSER} -c 'exec sh maketars ${OSrev}'
diff --git a/etc/mtree/4.4BSD.dist b/etc/mtree/4.4BSD.dist
index f9a099ad979..33570e9317e 100644
--- a/etc/mtree/4.4BSD.dist
+++ b/etc/mtree/4.4BSD.dist
@@ -1,4 +1,4 @@
-# $OpenBSD: 4.4BSD.dist,v 1.300 2017/10/08 15:14:17 visa Exp $
+# $OpenBSD: 4.4BSD.dist,v 1.301 2017/11/05 10:29:24 rpe Exp $
/set type=dir uname=root gname=wheel mode=0755
@@ -414,10 +414,6 @@ usr
calendar
..
- # ./usr/share/compile
- compile
- ..
-
# ./usr/share/dict
dict
papers
@@ -565,6 +561,14 @@ usr
..
mk
..
+
+ # ./usr/share/relink
+ relink
+
+ # ./usr/share/relink/kernel
+ kernel
+ ..
+ ..
snmp
mibs
..
diff --git a/etc/rc b/etc/rc
index 3d4f219e1ca..c11ffeb20f9 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.520 2017/10/25 10:42:51 bluhm Exp $
+# $OpenBSD: rc,v 1.521 2017/11/05 10:29:24 rpe Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@@ -162,40 +162,46 @@ make_keys() {
# Re-link libraries, placing the objects in a random order.
reorder_libs() {
- local _dkdev _liba _libas _mp _tmpdir _remount=false _error=false
+ local _error=false _dkdev _liba _libas _mp _ro_list _tmpdir
[[ $library_aslr == NO ]] && return
- # Skip if /usr/lib is on a nfs mounted filesystem.
- _dkdev=$(df /usr/lib | sed '1d;s/ .*//')
- _mp=$(mount | grep "^$_dkdev")
- [[ $_mp == *' type nfs '* ]] && return
+ # Skip if /usr/lib, /usr/libexec or /usr/share/relink are on nfs mounted
+ # filesystems, otherwise record which ones are mounted read-only.
+ for _d in /usr/{lib,libexec,share/relink}; do
+ _dkdev=$(df $_d | sed '1d;s/ .*//')
+ _mp=$(mount | grep "^$_dkdev")
+ [[ $_mp == *" type nfs "* ]] && return
+ if [[ $_mp == *" type ffs "*"read-only"* &&
+ $_ro_list != *${_mp%% *}* ]]; then
+ _ro_list="$_ro_list ${_mp%% *}"
+ fi
+ done
echo -n 'reordering libraries:'
-
- # Remount read-write, if /usr/lib is on a read-only ffs filesystem.
- if [[ $_mp == *' type ffs '*'read-only'* ]]; then
- if mount -u -w $_dkdev; then
- _remount=true
- else
+
+ # Remount the (read-only) filessystems in _ro_list as read-write.
+ for _mp in $_ro_list; do
+ if ! mount -u -w $_mp; then
echo ' failed.'
return
fi
- fi
+ done
# Only choose the latest version of the libraries.
- for _liba in /usr/lib/lib{c,crypto}; do
+ for _liba in /usr/share/relink/usr/lib/lib{c,crypto}; do
_libas="$_libas $(ls $_liba.so.+([0-9.]).a | sort -rV | head -1)"
done
- _libas=${_libas# }
- for _liba in /usr/libdata/ld.so.a $_libas; do
- _tmpdir=$(mktemp -dq /usr/lib/_rebuild.XXXXXXXXXXXX) &&
+ for _liba in /usr/share/relink/usr/libexec/ld.so.a $_libas; do
+ _tmpdir=$(mktemp -dq /usr/share/relink/_rebuild.XXXXXXXXXXXX) &&
(
set -o errexit
_install='install -F -S -o root -g bin -m 0444'
_lib=${_liba##*/}
_lib=${_lib%.a}
+ _lib_dir=${_liba#/usr/share/relink}
+ _lib_dir=${_lib_dir%/*}
cd $_tmpdir
ar x $_liba
if [[ $_lib == ld.so ]]; then
@@ -205,24 +211,24 @@ reorder_libs() {
chmod u+x test-ld.so
[[ $(./test-ld.so ok) == './test-ld.so: ok!' ]]
$_install /usr/libexec/ld.so /usr/libexec/ld.so.save
- $_install ld.so.test /usr/libexec/ld.so
+ $_install ld.so.test $_lib_dir/ld.so
else
cc -shared -o $_lib $(ls *.so | sort -R) $(cat .ldadd)
[[ -s $_lib ]] && file $_lib | fgrep -q 'shared object'
LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}'
LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir openssl \
x509 -in /etc/ssl/cert.pem -out /dev/null
- $_install $_lib ${_liba%/*}/$_lib
+ $_install $_lib $_lib_dir/$_lib
fi
) || { _error=true; break; }
done
- rm -rf /usr/lib/_rebuild.*
+ rm -rf /usr/share/relink/_rebuild.*
# Restore previous mount state if it was changed.
- if $_remount; then
- mount -u -r $_dkdev || _error=true
- fi
+ for _mp in $_ro_list; do
+ mount -u -r $_mp || _error=true
+ done
if $_error; then
echo ' failed.'
diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile
index 63f51b6aedc..e4b0a5fc44a 100644
--- a/libexec/ld.so/Makefile
+++ b/libexec/ld.so/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.69 2017/08/27 22:18:08 deraadt Exp $
+# $OpenBSD: Makefile,v 1.70 2017/11/05 10:29:24 rpe Exp $
SUBDIR=ldconfig ldd
MAN= ld.so.1
@@ -82,5 +82,7 @@ ld.so.a: ${OBJS} ${.CURDIR}/Symbols.map ${test_prog}
ar cqD $@ $?
afterinstall: ld.so.a
+ install -d -o root -g wheel -m 755 \
+ ${DESTDIR}/usr/share/relink/usr/libexec
install -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
- ld.so.a ${DESTDIR}/usr/libdata/ld.so.a
+ ld.so.a ${DESTDIR}/usr/share/relink/usr/libexec/ld.so.a
diff --git a/libexec/reorder_kernel/reorder_kernel.sh b/libexec/reorder_kernel/reorder_kernel.sh
index 93521538597..a30b40adbed 100644
--- a/libexec/reorder_kernel/reorder_kernel.sh
+++ b/libexec/reorder_kernel/reorder_kernel.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: reorder_kernel.sh,v 1.3 2017/08/25 18:59:55 rpe Exp $
+# $OpenBSD: reorder_kernel.sh,v 1.4 2017/11/05 10:29:24 rpe Exp $
#
# Copyright (c) 2017 Robert Peichaer <rpe@openbsd.org>
#
@@ -24,15 +24,15 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
DISK_DEV=$(df /usr/share | sed '1d;s/ .*//')
[[ $(mount | grep "^$DISK_DEV") == *" type nfs "* ]] && exit 1
-COMPILE_DIR=/usr/share/compile
KERNEL=$(sysctl -n kern.osversion)
KERNEL=${KERNEL%#*}
-LOGFILE=$COMPILE_DIR/$KERNEL/relink.log
+KERNEL_DIR=/usr/share/relink/kernel
+LOGFILE=$KERNEL_DIR/$KERNEL/relink.log
PROGNAME=${0##*/}
SHA256=/var/db/kernel.SHA256
# Create kernel compile dir and redirect stdout/stderr to a logfile.
-mkdir -m 700 -p $COMPILE_DIR/$KERNEL
+mkdir -m 700 -p $KERNEL_DIR/$KERNEL
exec 1>$LOGFILE
exec 2>&1
@@ -41,18 +41,18 @@ trap 'trap - EXIT; logger -st $PROGNAME \
"kernel relinking failed; see $LOGFILE" >>/dev/console 2>&1' ERR
trap 'logger -t $PROGNAME "kernel relinking done"' EXIT
-if [[ -f $COMPILE_DIR.tgz ]]; then
- rm -rf $COMPILE_DIR/$KERNEL/*
+if [[ -f $KERNEL_DIR.tgz ]]; then
+ rm -rf $KERNEL_DIR/$KERNEL/*
# The directory containing the logfile was just deleted, redirect
# stdout again to a new logfile.
exec 1>$LOGFILE
- tar -C $COMPILE_DIR -xzf $COMPILE_DIR.tgz $KERNEL
- rm -f $COMPILE_DIR.tgz
+ tar -C $KERNEL_DIR -xzf $KERNEL_DIR.tgz $KERNEL
+ rm -f $KERNEL_DIR.tgz
fi
sha256 -C $SHA256 /bsd
-cd $COMPILE_DIR/$KERNEL
+cd $KERNEL_DIR/$KERNEL
make newbsd
make newinstall
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index cf6fdb0832c..57552f58f9c 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -1,4 +1,4 @@
-# $OpenBSD: bsd.lib.mk,v 1.90 2017/08/09 06:15:29 robert Exp $
+# $OpenBSD: bsd.lib.mk,v 1.91 2017/11/05 10:29:24 rpe Exp $
# $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
@@ -288,8 +288,10 @@ realinstall:
${INSTALL} ${INSTALL_COPY} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${FULLSHLIBNAME} ${DESTDIR}${LIBDIR}
.if defined(LIBREBUILD)
+ ${INSTALL} -d -o ${LIBOWN} -g ${LIBGRP} -m 755 \
+ ${DESTDIR}/usr/share/relink/${LIBDIR}
${INSTALL} ${INSTALL_COPY} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${FULLSHLIBNAME}.a ${DESTDIR}${LIBDIR}
+ ${FULLSHLIBNAME}.a ${DESTDIR}/usr/share/relink/${LIBDIR}
.endif
.endif
.if defined(LINKS) && !empty(LINKS)
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 79f59c898ab..a5bf75aaf9b 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkmakefile.c,v 1.44 2017/07/18 16:43:27 tb Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.45 2017/11/05 10:29:24 rpe Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
@@ -524,11 +524,11 @@ emitload(FILE *fp)
if (fprintf(fp, "update-link:\n") < 0)
return (1);
if (fprintf(fp,
- "\tmkdir -p -m 700 /usr/share/compile\n"
- "\trm -rf /usr/share/compile/%s /usr/share/compile.tgz\n"
- "\tmkdir /usr/share/compile/%s\n"
+ "\tmkdir -p -m 700 /usr/share/relink/kernel\n"
+ "\trm -rf /usr/share/relink/kernel/%s /usr/share/relink/kernel.tgz\n"
+ "\tmkdir /usr/share/relink/kernel/%s\n"
"\ttar -chf - Makefile makegap.sh ld.script *.o | \\\n"
- "\t tar -C /usr/share/compile/%s -xf -\n\n",
+ "\t tar -C /usr/share/relink/kernel/%s -xf -\n\n",
last_component, last_component, last_component) < 0)
return (1);
}