Move handling of crunch* files into Makefile.conf, which is a
better place to handle dependencies. Make another step at helping cross-compiling: when the user specifies an alternate source tree, the script takes care of creating include files and libraries for the new tree. Furthermore, build and use a version of the "config" program which matches the new sources. It takes a long time to create libraries, and it might even not do the right thing at once, there might be some dependencies that i have forgotten. At any rate, with this code i have been able to build a working picobsd image using -CURRENT sources on -STABLE MFC after: 3 days
This commit is contained in:
parent
fd5556399e
commit
a39c93813c
@ -1,24 +1,41 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
#
|
#
|
||||||
# Makefile for building PICOBSD kernels
|
# Makefile for building PICOBSD kernels and running crunchgen
|
||||||
|
#
|
||||||
|
# Needs SRC pointing to the source tree,
|
||||||
|
# MY_TREE ponting to my tree
|
||||||
|
# BUILDDIR pointing to the build directory
|
||||||
|
# PICO_OBJ pointing to the object directory
|
||||||
|
# When building a kernel, also need ${name} from the environment
|
||||||
|
# and CONFIG may indicate an alternate config program
|
||||||
|
|
||||||
SRC?=/usr/src
|
SRC?=/usr/src
|
||||||
CONF?=$(SRC)/sys/i386/conf
|
CONF?=${SRC}/sys/i386/conf
|
||||||
|
CONFIG?=config
|
||||||
|
|
||||||
CONFFILE=PICOBSD-${name}
|
CONFFILE=PICOBSD-${name}
|
||||||
COMPILE=$(SRC)/sys/compile/$(CONFFILE)
|
COMPILE=${SRC}/sys/compile/${CONFFILE}
|
||||||
KERNFILE=$(COMPILE)/kernel
|
KERNFILE=${COMPILE}/kernel
|
||||||
|
|
||||||
|
|
||||||
$(KERNFILE): ${COMPILE} do_a_make_in_the_kernel_directory_anyways
|
${KERNFILE}: ${COMPILE} do_a_make_in_the_kernel_directory_anyways
|
||||||
|
|
||||||
do_a_make_in_the_kernel_directory_anyways:
|
do_a_make_in_the_kernel_directory_anyways:
|
||||||
(cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES)
|
(cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES)
|
||||||
|
|
||||||
${COMPILE}: ${CONF}/${CONFFILE}
|
${COMPILE}: ${CONF}/${CONFFILE}
|
||||||
(cd ${CONF}; config $(CONFFILE); \
|
(cd ${CONF}; ${CONFIG} ${CONFFILE}; \
|
||||||
cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES depend )
|
cd ${COMPILE}; make KERNEL=kernel -DNO_MODULES depend )
|
||||||
|
|
||||||
$(CONF)/${CONFFILE}: PICOBSD
|
${CONF}/${CONFFILE}: PICOBSD
|
||||||
cp PICOBSD $(CONF)/${CONFFILE}
|
cp ${.OODATE} ${.TARGET}
|
||||||
|
if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
|
||||||
|
|
||||||
|
# This part creates crunch1.conf and crunch.mk from crunch.conf
|
||||||
|
${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
|
||||||
|
-(cd ${BUILDDIR}/crunch ; \
|
||||||
|
crunchgen -p ${PICO_OBJ} -m ${.TARGET} ${.OODATE} )
|
||||||
|
|
||||||
|
${BUILDDIR}/crunch1.conf: ${MY_TREE}/crunch.conf
|
||||||
|
(cd ${BUILDDIR}/crunch ; cat ${.OODATE} | \
|
||||||
|
sed -e "s@/usr/src@${SRC}@" -e "s@CWD@${MY_TREE}@" > ${.TARGET} )
|
||||||
|
@ -345,10 +345,6 @@ init_stage1() {
|
|||||||
. ${MY_TREE}/config
|
. ${MY_TREE}/config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export MFS_MOUNTPOINT # used in the makefiles.
|
|
||||||
export PICO_OBJ # used in the makefiles
|
|
||||||
export SRC # used in the makefiles.
|
|
||||||
|
|
||||||
PICO_OBJ=${OBJ}/picobsd/${TYPE}
|
PICO_OBJ=${OBJ}/picobsd/${TYPE}
|
||||||
|
|
||||||
if [ ! -d ${BUILDDIR} ]; then
|
if [ ! -d ${BUILDDIR} ]; then
|
||||||
@ -367,8 +363,8 @@ init_stage1() {
|
|||||||
# Then copy it here and strip as much as possible.
|
# Then copy it here and strip as much as possible.
|
||||||
do_kernel() { # OK
|
do_kernel() { # OK
|
||||||
log "---> Preparing kernel \"$name\" in $MY_TREE"
|
log "---> Preparing kernel \"$name\" in $MY_TREE"
|
||||||
export name SRC # used in this makefile
|
(cd $MY_TREE; export name SRC CONFIG # used in this makefile ;
|
||||||
(cd $MY_TREE; make -v -f ${PICO_TREE}/build/Makefile.conf )
|
make -v -f ${PICO_TREE}/build/Makefile.conf )
|
||||||
cp -p ${SRC}/sys/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \
|
cp -p ${SRC}/sys/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \
|
||||||
fail $? missing_kernel
|
fail $? missing_kernel
|
||||||
(cd ${BUILDDIR};
|
(cd ${BUILDDIR};
|
||||||
@ -493,14 +489,13 @@ populate_mfs() {
|
|||||||
cd ${BUILDDIR}/crunch
|
cd ${BUILDDIR}/crunch
|
||||||
log "---> Making and installing crunch1 from `pwd`..."
|
log "---> Making and installing crunch1 from `pwd`..."
|
||||||
a=${BUILDDIR}/crunch1.conf
|
a=${BUILDDIR}/crunch1.conf
|
||||||
cat ${MY_TREE}/crunch.conf|sed -e "s@/usr/src@${SRC}@" | \
|
( export BUILDDIR SRC MY_TREE PICO_OBJ ;
|
||||||
sed -e "s@CWD@${MY_TREE}@" > $a
|
make -v -f ${PICO_TREE}/build/Makefile.conf ${BUILDDIR}/crunch.mk )
|
||||||
arg=""
|
# update crunch.mk for new libs
|
||||||
if [ -f ${MY_TREE}/crunch.inc ] ; then
|
if [ "${LIBS}" != "" ] ; then
|
||||||
h="-h ${MY_TREE}/crunch.inc"
|
sed -e "s@^LIBS=@ LIBS= ${LIBS}@" ${BUILDDIR}/crunch.mk > ${BUILDDIR}/crunch1.mk
|
||||||
|
mv ${BUILDDIR}/crunch1.mk ${BUILDDIR}/crunch.mk
|
||||||
fi
|
fi
|
||||||
crunchgen -p ${PICO_OBJ} -o $arg -m ${BUILDDIR}/crunch.mk $a || true
|
|
||||||
# failure is not critical here
|
|
||||||
log "Now make -f crunch.mk"
|
log "Now make -f crunch.mk"
|
||||||
make ${makeopts} -f ${BUILDDIR}/crunch.mk
|
make ${makeopts} -f ${BUILDDIR}/crunch.mk
|
||||||
strip --remove-section=.note --remove-section=.comment crunch1
|
strip --remove-section=.note --remove-section=.comment crunch1
|
||||||
@ -510,7 +505,7 @@ populate_mfs() {
|
|||||||
for i in `crunchgen -l $a` ; do
|
for i in `crunchgen -l $a` ; do
|
||||||
ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/${i};
|
ln ${MFS_MOUNTPOINT}/stand/crunch ${MFS_MOUNTPOINT}/stand/${i};
|
||||||
done
|
done
|
||||||
rm $a
|
# rm $a # do not remove!
|
||||||
) || fail $? crunch
|
) || fail $? crunch
|
||||||
|
|
||||||
if [ -f ${MFS_MOUNTPOINT}/stand/sshd ] ; then
|
if [ -f ${MFS_MOUNTPOINT}/stand/sshd ] ; then
|
||||||
@ -668,13 +663,30 @@ while [ true ]; do
|
|||||||
# accordingly. Note that you will still need the right
|
# accordingly. Note that you will still need the right
|
||||||
# libraries...
|
# libraries...
|
||||||
|
|
||||||
#i=${SRC}/usr/include # the include directory...
|
i=${SRC}/usr/include # the include directory...
|
||||||
#if [ \! -d $i ] ; then
|
if [ \! -d $i ] ; then
|
||||||
# echo "Create \"$i\" as include directory"
|
echo "Create \"$i\" as include directory"
|
||||||
# mkdir -p $i
|
mkdir -p $i
|
||||||
# (cd ${SRC}; DESTDIR=${SRC} make includes )
|
(cd ${SRC};
|
||||||
#fi
|
INCOWN=`id -un` DESTDIR=${SRC} make includes
|
||||||
#CFLAGS="-nostdinc -I$i" ; export CFLAGS
|
)
|
||||||
|
fi
|
||||||
|
CFLAGS="-nostdinc -I$i" ; export CFLAGS
|
||||||
|
i=${SRC}/usr/lib
|
||||||
|
if [ \! -d $i ]; then
|
||||||
|
echo "Create libraries (this takes long...)"
|
||||||
|
mkdir -p $i
|
||||||
|
(cd ${SRC};
|
||||||
|
BINOWN=`id -un` DESTDIR=${SRC} \
|
||||||
|
make -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
LIBS=" -L$i"
|
||||||
|
(cd ${SRC}/usr.sbin/config ;
|
||||||
|
make
|
||||||
|
)
|
||||||
|
CONFIG=${SRC}/usr.sbin/config/config
|
||||||
|
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--floppy_size)
|
--floppy_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user