mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 22:12:43 +00:00
remove some stale options (such as running without /boot/loader)
improve support for multi-arch and cross-arch builds, by adding a suffix to the kernel config file and build_directory. (cross builds not clean yet, a cross-built kernel boots but fails when starting /sbin/init)
This commit is contained in:
parent
68266d5aba
commit
60a5d89732
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229511
@ -13,6 +13,7 @@ BINMAKE?=make
|
||||
SRC?=/usr/src
|
||||
CONFIG?=config
|
||||
MODULES?=-DNO_MODULES # do not build them as a default
|
||||
KERNCONF ?= PICOBSD
|
||||
|
||||
# caller will set MODULES to empty if modules are needed.
|
||||
# Indeed, it can be used to specify other Makefile options as well.
|
||||
@ -45,10 +46,10 @@ ${COMPILE}: ${CONF}/${CONFFILE}
|
||||
(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
|
||||
cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend )
|
||||
|
||||
${CONF}/${CONFFILE}: PICOBSD
|
||||
${CONF}/${CONFFILE}: ${KERNCONF}
|
||||
# -mkdir -p ${CONF} # XXX not needed yet.
|
||||
cp ${.OODATE} ${.TARGET}
|
||||
if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
|
||||
[ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/
|
||||
|
||||
# This part creates crunch1.conf and crunch.mk from crunch.conf
|
||||
${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
|
||||
|
@ -105,11 +105,6 @@ set_defaults() { # no arguments
|
||||
EDITOR=${EDITOR:-vi}
|
||||
fd_size=${fd_size:-1440}
|
||||
|
||||
o_use_loader="yes" # use /boot/loader
|
||||
# You should not change it unless you are really short
|
||||
# of space, and your kernel is small enough that the
|
||||
# bootblocks manage to load it.
|
||||
|
||||
o_all_in_mfs="yes" # put all files in mfs so you can boot
|
||||
# and run the image via diskless boot.
|
||||
o_clean="" # set if you want to clean prev.builds.
|
||||
@ -179,7 +174,17 @@ create_includes_and_libraries2() { # opt_dir opt_target
|
||||
if [ -d "$1" ] ; then
|
||||
cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so
|
||||
else
|
||||
${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
|
||||
# export WITH_RESCUE=yes # build crunchide
|
||||
# ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
|
||||
(
|
||||
# eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V BMAKEENV`
|
||||
eval "export XMAKE=\"`cd ${SRC}; make -f Makefile -V XMAKE`\""
|
||||
${BINMAKE} ${o_par} _+_= $no toolchain
|
||||
)
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
${BINMAKE} ${o_par} _+_= $no _includes _libraries
|
||||
[ ${o_arch} != `uname -m` ] && \
|
||||
(cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true )
|
||||
fi
|
||||
)
|
||||
}
|
||||
@ -242,16 +247,19 @@ set_type() { # the_type the_site
|
||||
name="" # clear in case of errors
|
||||
for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do
|
||||
log "set_type: checking $i"
|
||||
[ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue
|
||||
set -- `cat $i/PICOBSD | \
|
||||
[ -d $i -a -f $i/crunch.conf ] || continue
|
||||
# look for a kernel config file, privilege arch-specific
|
||||
l_kernconf=$i/PICOBSD.${o_arch}
|
||||
[ -f $l_kernconf ] || l_kernconf=$i/PICOBSD
|
||||
[ -f $l_kernconf ] || continue
|
||||
set -- `cat $l_kernconf | \
|
||||
awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'`
|
||||
[ x"$1" != "x" ] || continue
|
||||
MFS_SIZE=$1 ; init_name=$2
|
||||
mfs_inodes=$3 ; fd_inodes=$4
|
||||
MFS_SIZE=$1
|
||||
name=`(cd $i ; pwd) `
|
||||
name=`basename $name`
|
||||
MY_TREE=$i
|
||||
BUILDDIR=${c_startdir}/build_dir-${name}
|
||||
BUILDDIR=${c_startdir}/build_dir-${name}-${o_arch}
|
||||
log "Matching file $name in $i"
|
||||
return ;
|
||||
done
|
||||
@ -328,10 +336,7 @@ main_dialog() {
|
||||
K "edit Kernel config file" \
|
||||
E "Edit crunch.conf file" \
|
||||
S "MFS Size: ${MFS_SIZE}kB" \
|
||||
I "Init type: ${init_name}" \
|
||||
F "Floppy size: ${fd_size}kB" \
|
||||
M "MFS bytes per inode: ${mfs_inodes}" \
|
||||
U "UFS bytes per inode: ${fd_inodes}" \
|
||||
$ "Site-info: ${SITE}" \
|
||||
Q "Quit" \
|
||||
2> ${c_reply}
|
||||
@ -349,12 +354,6 @@ main_dialog() {
|
||||
{ dialog --menu "Setup the type of configuration" 12 70 5 $l \
|
||||
2> ${c_reply} && set_type "`cat ${c_reply}`" ${SITE} ; } || true
|
||||
;;
|
||||
I)
|
||||
{ dialog --menu "Choose your init(8) program" \
|
||||
10 70 2 init "Standard init (requires getty)" \
|
||||
oinit "small init from TinyWare" 2> ${c_reply} \
|
||||
&& init_name=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
K) ${EDITOR} ${MY_TREE}/PICOBSD ;;
|
||||
|
||||
@ -386,20 +385,6 @@ this as small as possible. " 10 70 2> ${c_reply} \
|
||||
2> ${c_reply} && fd_size=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
M)
|
||||
{ dialog --title "MFS bytes per inode:" --inputbox \
|
||||
"Enter MFS bytes per inode (typically 4096..65536). \
|
||||
A larger value means fewer inodes but more space on MFS" \
|
||||
10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
U)
|
||||
{ dialog --title "Floppy bytes per inode:" --inputbox \
|
||||
"Enter floppy bytes per inode (typically 3072..65536). \
|
||||
A larger value means fewer inodes but more space on the floppy." \
|
||||
10 70 2> ${c_reply} && fd_inodes=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
N) break 2
|
||||
;;
|
||||
|
||||
@ -454,8 +439,9 @@ do_kernel() { # OK
|
||||
# export CONFIG
|
||||
export WARNS CWARNFLAGS
|
||||
[ "${o_do_modules}" = "yes" ] && export MODULES=""
|
||||
${BINMAKE} ${o_par} -v -f ${PICO_TREE}/build/Makefile.conf ) || \
|
||||
fail $? missing_kernel
|
||||
${BINMAKE} ${o_par} KERNCONF=${l_kernconf} \
|
||||
-v -f ${PICO_TREE}/build/Makefile.conf ) || \
|
||||
fail $? missing_kernel
|
||||
}
|
||||
|
||||
# Populate the variable part of the floppy filesystem. Must be done before
|
||||
@ -604,6 +590,7 @@ find_progs() { # programs
|
||||
i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \
|
||||
grep -v '^/' | awk '{print $1}' | sort | uniq`"
|
||||
u_libs="`find_progs_helper $o $i`"
|
||||
log "--- done find_progs ---"
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -637,8 +624,12 @@ find_progs_helper() { # programs
|
||||
[ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}"
|
||||
done
|
||||
fi
|
||||
for i in $progs ; do
|
||||
# full pathnames are just listed
|
||||
[ -f "$i" ] && echo $i && continue
|
||||
find ${places} -maxdepth 3 -type f -name ${i} | head -1
|
||||
done
|
||||
# use maxdepth 3 because some libs are way down
|
||||
find ${places} -maxdepth 3 -type f \( ${names} \)
|
||||
}
|
||||
|
||||
# Populate the memory filesystem with binaries and non-variable
|
||||
@ -788,7 +779,6 @@ populate_mfs_tree() {
|
||||
final_cleanup() {
|
||||
log "final_cleanup()"
|
||||
rm -rf ${c_mnt} ${c_reply} 2> /dev/null || true
|
||||
rm -f ${c_reply}
|
||||
}
|
||||
|
||||
# fail errno errcode
|
||||
@ -857,17 +847,6 @@ fill_floppy_image() {
|
||||
fi
|
||||
|
||||
log "Labeling floppy image"
|
||||
b2=${BUILDDIR}/boot2 # modified boot2
|
||||
cp -f ${c_boot2} ${b2}
|
||||
chmod 0644 ${b2}
|
||||
|
||||
if [ ${o_use_loader} = "no" ] ; then
|
||||
log "patch ${c_boot2} to boot /kernel right away"
|
||||
set `strings -at d ${b2} | grep "/boot/loader"`
|
||||
echo -e "/kernel\0\0\0\0\0" | \
|
||||
dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null
|
||||
fi
|
||||
chmod 0444 ${b2}
|
||||
|
||||
dst=${BUILDDIR}/image.tree
|
||||
rm -rf ${dst}
|
||||
@ -893,17 +872,13 @@ fill_floppy_image() {
|
||||
log "not loading mfs, size ${mfs_size} img ${imgsize}"
|
||||
fi
|
||||
log "Compress with kgzip and copy to floppy image"
|
||||
if [ ${o_use_loader} = "no" ] ; then
|
||||
kgzip -o kernel.gz kernel
|
||||
cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel"
|
||||
else
|
||||
gzip kernel
|
||||
mkdir -p ${dst}/boot/kernel
|
||||
echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
|
||||
echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
|
||||
cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader"
|
||||
cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel"
|
||||
fi
|
||||
|
||||
mkdir -p ${dst}/boot/kernel
|
||||
# XXX update loader.conf
|
||||
echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
|
||||
echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
|
||||
cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader"
|
||||
gzip -c kernel > ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel"
|
||||
|
||||
# now transfer the floppy tree. If it is already in mfs, dont bother.
|
||||
if [ "${o_all_in_mfs}" != "yes" ] ; then
|
||||
@ -953,10 +928,13 @@ fill_floppy_image() {
|
||||
# so we skip 276 from the source, and 276+512=788 from dst
|
||||
# the old style blocks used 512 and 1024 respectively
|
||||
|
||||
dd if=${b2} iseek=1 ibs=276 2> /dev/null | \
|
||||
dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \
|
||||
dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null
|
||||
log "done disk image"
|
||||
# XXX (log "Fixing permissions"; cd ${dst}; chown -R root *)
|
||||
# leave build stuff if verbose
|
||||
[ ${o_verbose} -gt 0 ] && return
|
||||
|
||||
rm -rf ${BUILDDIR}/floppy.tree || true # cleanup
|
||||
# df -ik ${dst} | colrm 70 > .build.reply
|
||||
rm -rf ${dst}
|
||||
@ -984,9 +962,10 @@ set_build_parameters() {
|
||||
if [ ${OSVERSION} -ge 500035 ] ; then
|
||||
export MAKEOBJDIRPREFIX=${l_objtree}
|
||||
export TARGET_ARCH=${o_arch} TARGET=${o_arch}
|
||||
# XXX why change machine_arch ?
|
||||
#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
|
||||
# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers"
|
||||
eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
fi
|
||||
|
||||
if [ "${o_init_src}" != "" ] ; then
|
||||
@ -995,6 +974,8 @@ set_build_parameters() {
|
||||
else
|
||||
create_includes_and_libraries2
|
||||
fi
|
||||
else
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
fi
|
||||
if [ ${OSVERSION} -lt 500035 ] ; then
|
||||
# Create the right LIBS and CFLAGS for further builds.
|
||||
@ -1030,29 +1011,29 @@ set_defaults
|
||||
while [ true ]; do
|
||||
log "Parsing $1"
|
||||
case $1 in
|
||||
--par)
|
||||
o_par="-j 8"
|
||||
;;
|
||||
|
||||
--src) # set the source path instead of /usr/src
|
||||
SRC=`realpath $2`
|
||||
shift
|
||||
;;
|
||||
--init)
|
||||
|
||||
--init) # run a partial buildworld on the source tree
|
||||
o_init_src="YES"
|
||||
;;
|
||||
|
||||
--arch)
|
||||
--arch) # override the target architecture
|
||||
o_arch=$2
|
||||
shift
|
||||
;;
|
||||
|
||||
--floppy_size)
|
||||
--floppy_size) # image size
|
||||
fd_size=$2
|
||||
shift
|
||||
;;
|
||||
|
||||
--no_loader) # omit /boot/loader, just rely on boot2
|
||||
# (it may have problems with kernels > 4MB)
|
||||
o_use_loader="no"
|
||||
;;
|
||||
|
||||
--all_in_mfs)
|
||||
o_all_in_mfs="yes"
|
||||
;;
|
||||
@ -1064,6 +1045,7 @@ while [ true ]; do
|
||||
--modules) # also build kernel modules
|
||||
o_do_modules="yes"
|
||||
;;
|
||||
|
||||
-n)
|
||||
o_interactive="NO"
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user