version 1.9.2.3, 2017/02/13 16:45:10
|
version 1.11.2.3, 2021/03/25 19:04:57
|
Line 30 if [ "${USER}" != "root" ]; then
|
Line 30 if [ "${USER}" != "root" ]; then
|
exit 1 |
exit 1 |
fi |
fi |
|
|
|
if [ ! -x "${OBJDUMP}" ]; then |
|
echo |
|
echo "ELWIX project is not configured - executable objdump not found !" |
|
echo |
|
exit 1 |
|
fi |
|
|
KRNNAME="kernel_rootfs" |
KRNNAME="kernel_rootfs" |
NEWKERN="${REL}/${KRNNAME}" |
NEWKERN="${REL}/${KRNNAME}" |
MKF="Makefile.elwix" |
MKF="Makefile.elwix" |
Line 65 prepare_elwix()
|
Line 72 prepare_elwix()
|
# !!! Dont edit by hand !!! |
# !!! Dont edit by hand !!! |
# |
# |
|
|
LIBS += -L${WORLD}/lib -L${WORLD}/usr/lib | LDFLAGS += -L${WORLD}/lib -L${WORLD}/usr/lib |
| CFLAGS += -I${BSDSRC}/lib/libifconfig -I${BSDOBJ}${BSDSRC}/${TARGET}.${TARGET_ARCH}/lib/libifconfig |
_EOF |
_EOF |
cat >$ROOTFS_CONF <<_EOF |
cat >$ROOTFS_CONF <<_EOF |
srcdirs ${BSDSRC}/tools/tools ${BSDSRC}/tools/tools/ath |
srcdirs ${BSDSRC}/tools/tools ${BSDSRC}/tools/tools/ath |
srcdirs ${BSDSRC}/release/picobsd/tinyware | srcdirs ${BSDSRC}/contrib/ncurses/progs ${BSDSRC}/lib/libifconfig |
srcdirs ${BSDSRC}/bin ${BSDSRC}/sbin ${BSDSRC}/libexec ${BSDSRC}/cddl/sbin ${BSDSRC}/sbin/ggate |
srcdirs ${BSDSRC}/bin ${BSDSRC}/sbin ${BSDSRC}/libexec ${BSDSRC}/cddl/sbin ${BSDSRC}/sbin/ggate |
srcdirs ${BSDSRC}/usr.bin ${BSDSRC}/usr.sbin ${BSDSRC}/usr.sbin/wpa |
srcdirs ${BSDSRC}/usr.bin ${BSDSRC}/usr.sbin ${BSDSRC}/usr.sbin/wpa |
srcdirs ${BSDSRC}/secure/usr.bin ${BSDSRC}/secure/usr.sbin ${BSDSRC}/secure/libexec |
srcdirs ${BSDSRC}/secure/usr.bin ${BSDSRC}/secure/usr.sbin ${BSDSRC}/secure/libexec |
|
|
buildopts TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} | #buildopts TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} ${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} |
buildopts -DNO_PAM -DNO_KERBEROS WITHOUT_PAM_SUPPORT=yes WITHOUT_KERBEROS_SUPPORT=yes WITHOUT_KERBEROS=yes |
buildopts -DNO_PAM -DNO_KERBEROS WITHOUT_PAM_SUPPORT=yes WITHOUT_KERBEROS_SUPPORT=yes WITHOUT_KERBEROS=yes |
buildopts -DMK_CASPER=no WITHOUT_CASPER=yes | buildopts -DMK_CASPER=no WITHOUT_CASPER=yes MK_TESTS=no UPDATE_DEPENDFILE=yes _RECURSING_CRUNCH=1 |
_EOF |
_EOF |
cat $CFGDIR/$ROOTFS_CONF >>$ROOTFS_CONF |
cat $CFGDIR/$ROOTFS_CONF >>$ROOTFS_CONF |
|
cat >>$ROOTFS_CONF <<_EOF |
|
special ping6 srcdir ${BSDSRC}/sbin/ping |
|
special tput srcdir ${BSDSRC}/contrib/ncurses/progs |
|
special tset srcdir ${BSDSRC}/contrib/ncurses/progs |
|
|
|
special ifconfig lib ${BSDOBJ}${BSDSRC}/${TARGET}.${TARGET_ARCH}/lib/libifconfig/libifconfig.a |
|
_EOF |
echo "+++ Prepared RootFS config ... $CFGDIR/$ROOTFS_CONF" |
echo "+++ Prepared RootFS config ... $CFGDIR/$ROOTFS_CONF" |
|
|
install -d ${BSDOBJ}/elwix |
install -d ${BSDOBJ}/elwix |
env MAKEOBJDIRPREFIX=${BSDOBJ}/elwix ${CEXEC} crunchgen -f \ | env MAKEOBJDIRPREFIX=${BSDOBJ}/elwix ${CEXEC} crunchgen -f \ |
-h $ROOTFS_MKDIR/$MKH -m $MKF \ |
-h $ROOTFS_MKDIR/$MKH -m $MKF \ |
-c elwix.c -e elwix $ROOTFS_CONF |
-c elwix.c -e elwix $ROOTFS_CONF |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
exit 1 |
exit 1 |
fi |
fi |
|
# cat >>$MKF << _EOF |
|
# |
|
#.for _tool in ${CRUNCH_BUILDTOOLS} |
|
#build-tools-${_tool}: |
|
# ${_+_}cd ${.CURDIR}/../../${_tool}; \ |
|
# if [ "${MK_AUTO_OBJ}" = "no" ]; then \ |
|
# ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} obj; \ |
|
# fi; \ |
|
# ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} build-tools |
|
# |
|
#build-tools: build-tools-${_tool} |
|
# /usr/bin ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} |
|
# |
|
#.endfor |
|
#_EOF |
cd - |
cd - |
} |
} |
|
|
Line 97 build_elwix()
|
Line 127 build_elwix()
|
cd $ROOTFS_MKDIR |
cd $ROOTFS_MKDIR |
${CBUILD} -f $MKF \ |
${CBUILD} -f $MKF \ |
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} clean |
|
${CBUILD} -f $MKF \ |
|
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
|
${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} objs |
|
${CBUILD} -f $MKF \ |
|
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
|
${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} |
${X_TARGET_CPUTYPE} __MAKE_CONF=${MAKECONF} |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
exit 1 |
exit 1 |
Line 118 build_rootdir()
|
Line 142 build_rootdir()
|
install -d bin; |
install -d bin; |
install -d dev; |
install -d dev; |
install -d elwix; |
install -d elwix; |
install -d elwix/etc; | install -d etc; |
install -d libexec; |
install -d libexec; |
install -d mnt; |
install -d mnt; |
install -d -m 0555 proc; |
install -d -m 0555 proc; |
|
install -d rescue; |
install -d sbin; |
install -d sbin; |
install -d -m 1777 tmp; |
install -d -m 1777 tmp; |
install -d usr; |
install -d usr; |
Line 134 build_rootdir()
|
Line 159 build_rootdir()
|
|
|
ln -fs /usr/lib lib; |
ln -fs /usr/lib lib; |
|
|
ln -fs /elwix/etc etc; | ln -fs /elwix/boot boot; |
ln -fs /elwix/exports exports; |
ln -fs /elwix/exports exports; |
ln -fs /elwix/home home; |
ln -fs /elwix/home home; |
ln -fs /elwix/root root; |
ln -fs /elwix/root root; |
Line 149 install_rootfs()
|
Line 174 install_rootfs()
|
SBIN="${ROOTFS}/sbin" |
SBIN="${ROOTFS}/sbin" |
UBIN="${ROOTFS}/usr/bin" |
UBIN="${ROOTFS}/usr/bin" |
LIBEXEC="${ROOTFS}/usr/libexec" |
LIBEXEC="${ROOTFS}/usr/libexec" |
ETC="${ROOTFS}/elwix/etc" | ETC="${ROOTFS}/etc" |
| RESCUE="${ROOTFS}/rescue" |
|
|
PRG="/sbin/elwix" |
PRG="/sbin/elwix" |
LNPRG="${SBIN}/elwix" |
LNPRG="${SBIN}/elwix" |
Line 170 install_rootfs()
|
Line 196 install_rootfs()
|
ln -s $PRG $BIN/chio |
ln -s $PRG $BIN/chio |
ln -s $PRG $BIN/chmod |
ln -s $PRG $BIN/chmod |
ln -s $PRG $BIN/cp |
ln -s $PRG $BIN/cp |
|
ln -s $PRG $RESCUE/cp |
ln -s $PRG $BIN/csh |
ln -s $PRG $BIN/csh |
ln -s $PRG $BIN/-csh |
ln -s $PRG $BIN/-csh |
|
ln -s $PRG $RESCUE/csh |
ln -s $PRG $BIN/tcsh |
ln -s $PRG $BIN/tcsh |
ln -s $PRG $BIN/-tcsh |
ln -s $PRG $BIN/-tcsh |
ln -s $PRG $BIN/date |
ln -s $PRG $BIN/date |
Line 193 install_rootfs()
|
Line 221 install_rootfs()
|
ln -s $PRG $BIN/pgrep |
ln -s $PRG $BIN/pgrep |
ln -s $PRG $BIN/sh |
ln -s $PRG $BIN/sh |
ln -s $PRG $BIN/-sh |
ln -s $PRG $BIN/-sh |
|
ln -s $PRG $RESCUE/sh |
ln -s $PRG $BIN/ps |
ln -s $PRG $BIN/ps |
ln -s $PRG $BIN/pwait |
ln -s $PRG $BIN/pwait |
ln -s $PRG $BIN/pwd |
ln -s $PRG $BIN/pwd |
ln -s $PRG $BIN/realpath |
ln -s $PRG $BIN/realpath |
ln -s $PRG $BIN/rm |
ln -s $PRG $BIN/rm |
|
ln -s $PRG $RESCUE/rm |
ln -s $PRG $BIN/unlink |
ln -s $PRG $BIN/unlink |
# ln -s $PRG $BIN/rmdir |
# ln -s $PRG $BIN/rmdir |
ln -s $PRG $BIN/sleep |
ln -s $PRG $BIN/sleep |
Line 224 install_rootfs()
|
Line 254 install_rootfs()
|
ln -s $PRG $BIN/cap_mkdb |
ln -s $PRG $BIN/cap_mkdb |
ln -s $PRG $BIN/sed |
ln -s $PRG $BIN/sed |
ln -s $PRG $BIN/vi |
ln -s $PRG $BIN/vi |
|
ln -s $PRG $RESCUE/vi |
ln -s $PRG $BIN/du |
ln -s $PRG $BIN/du |
ln -s $PRG $BIN/getopt |
ln -s $PRG $BIN/getopt |
ln -s $PRG $BIN/logger |
ln -s $PRG $BIN/logger |
Line 267 install_rootfs()
|
Line 298 install_rootfs()
|
ln -s $PRG $SBIN/dumpon |
ln -s $PRG $SBIN/dumpon |
ln -s $PRG $SBIN/fdisk |
ln -s $PRG $SBIN/fdisk |
ln -s $PRG $SBIN/fsck |
ln -s $PRG $SBIN/fsck |
|
ln -s $PRG $RESCUE/fsck |
ln -s $PRG $SBIN/fsck_ffs |
ln -s $PRG $SBIN/fsck_ffs |
ln -s $PRG $SBIN/fsck_ufs |
ln -s $PRG $SBIN/fsck_ufs |
ln -s $PRG $SBIN/fsck_4.2bsd |
ln -s $PRG $SBIN/fsck_4.2bsd |
Line 280 install_rootfs()
|
Line 312 install_rootfs()
|
# ln -s $PRG $SBIN/hastctl |
# ln -s $PRG $SBIN/hastctl |
# ln -s $PRG $SBIN/hastd |
# ln -s $PRG $SBIN/hastd |
ln -s $PRG $SBIN/ifconfig |
ln -s $PRG $SBIN/ifconfig |
|
ln -s $PRG $RESCUE/ifconfig |
ln -s $PRG $SBIN/init |
ln -s $PRG $SBIN/init |
ln -s $PRG $SBIN/ipfw |
ln -s $PRG $SBIN/ipfw |
ln -s $PRG $SBIN/iscontrol |
ln -s $PRG $SBIN/iscontrol |
Line 293 install_rootfs()
|
Line 326 install_rootfs()
|
ln -s $PRG $SBIN/sha256 |
ln -s $PRG $SBIN/sha256 |
ln -s $PRG $SBIN/rmd160 |
ln -s $PRG $SBIN/rmd160 |
ln -s $PRG $SBIN/mdconfig |
ln -s $PRG $SBIN/mdconfig |
|
ln -s $PRG $RESCUE/mdconfig |
ln -s $PRG $SBIN/mdmfs |
ln -s $PRG $SBIN/mdmfs |
ln -s $PRG $SBIN/mount_mfs |
ln -s $PRG $SBIN/mount_mfs |
ln -s $PRG $SBIN/mknod |
ln -s $PRG $SBIN/mknod |
# ln -s $PRG $SBIN/mksnap_ffs |
# ln -s $PRG $SBIN/mksnap_ffs |
ln -s $PRG $SBIN/mount |
ln -s $PRG $SBIN/mount |
|
ln -s $PRG $RESCUE/mount |
# ln -s $PRG $SBIN/mount_cd9660 |
# ln -s $PRG $SBIN/mount_cd9660 |
ln -s $PRG $SBIN/mount_msdosfs |
ln -s $PRG $SBIN/mount_msdosfs |
ln -s $PRG $SBIN/mount_nfs |
ln -s $PRG $SBIN/mount_nfs |
Line 306 install_rootfs()
|
Line 341 install_rootfs()
|
# ln -s $PRG $SBIN/mount_udf |
# ln -s $PRG $SBIN/mount_udf |
ln -s $PRG $SBIN/mount_unionfs |
ln -s $PRG $SBIN/mount_unionfs |
ln -s $PRG $SBIN/newfs |
ln -s $PRG $SBIN/newfs |
|
ln -s $PRG $RESCUE/newfs |
ln -s $PRG $SBIN/newfs_msdos |
ln -s $PRG $SBIN/newfs_msdos |
# ln -s $PRG $SBIN/nfsiod |
# ln -s $PRG $SBIN/nfsiod |
# ln -s $PRG $SBIN/nos-tun |
# ln -s $PRG $SBIN/nos-tun |
Line 314 install_rootfs()
|
Line 350 install_rootfs()
|
ln -s $PRG $SBIN/pflogd |
ln -s $PRG $SBIN/pflogd |
ln -s $PRG $SBIN/quotacheck |
ln -s $PRG $SBIN/quotacheck |
ln -s $PRG $SBIN/reboot |
ln -s $PRG $SBIN/reboot |
|
ln -s $PRG $RESCUE/reboot |
ln -s $PRG $SBIN/halt |
ln -s $PRG $SBIN/halt |
|
ln -s $PRG $RESCUE/halt |
ln -s $PRG $SBIN/fastboot |
ln -s $PRG $SBIN/fastboot |
ln -s $PRG $SBIN/fasthalt |
ln -s $PRG $SBIN/fasthalt |
# ln -s $PRG $SBIN/recoverdisk |
# ln -s $PRG $SBIN/recoverdisk |
Line 382 install_rootfs()
|
Line 420 install_rootfs()
|
|
|
echo "+++ ELWIX clean CVS tags ..." |
echo "+++ ELWIX clean CVS tags ..." |
CleanCVS $ETC |
CleanCVS $ETC |
CleanCVS $ETC/etc |
|
echo |
echo |
} |
} |
|
|
build_image() |
build_image() |
{ |
{ |
echo "+++ Build ELWIX RootFS image ... $ROOTFS --> $REL/$ROOTFS_IMG" |
echo "+++ Build ELWIX RootFS image ... $ROOTFS --> $REL/$ROOTFS_IMG" |
makefs -s ${ROOTFS_SIZE} -o minfree=0 $REL/$ROOTFS_IMG $ROOTFS | makefs -s ${ROOTFS_SIZE} -o minfree=0 $REL/$ROOTFS_IMG $ROOTFS || exit 1 |
echo "+++ Completed ELWIX RootFS image ... $ROOTFS --> $REL/$ROOTFS_IMG" |
echo "+++ Completed ELWIX RootFS image ... $ROOTFS --> $REL/$ROOTFS_IMG" |
} |
} |
|
|
install_image() |
install_image() |
{ |
{ |
echo "+++ Install ELWIX RootFS Image into kernel ... $REL/$ROOTFS_IMG" |
echo "+++ Install ELWIX RootFS Image into kernel ... $REL/$ROOTFS_IMG" |
|
echo "exec> stat -f '%z' $REL/$ROOTFS_IMG" |
mfs_size=`stat -f '%z' $REL/$ROOTFS_IMG 2>/dev/null` |
mfs_size=`stat -f '%z' $REL/$ROOTFS_IMG 2>/dev/null` |
[ -z ${mfs_size} ] && echo "Can't determine MFS image size" && exit 1 |
[ -z ${mfs_size} ] && echo "Can't determine MFS image size" && exit 1 |
|
|
sec_info=`${CROSSTOOLDIR}/usr/bin/objdump -h $KERNEL_ROOTFS 2> /dev/null | grep " oldmfs "` | echo "exec> ${OBJDUMP} -h $KERNEL_ROOTFS 2> /dev/null | grep \" oldmfs \"" |
| sec_info=`${OBJDUMP} -h $KERNEL_ROOTFS 2> /dev/null | grep " oldmfs "` |
[ -z "${sec_info}" ] && echo "Can't locate mfs section within kernel" && exit 1 |
[ -z "${sec_info}" ] && echo "Can't locate mfs section within kernel" && exit 1 |
echo "'-> Object dump { ${sec_info} }" |
echo "'-> Object dump { ${sec_info} }" |
|
|
Line 412 install_image()
|
Line 451 install_image()
|
dd if=$REL/$ROOTFS_IMG ibs=8192 of=$NEWKERN obs=${sec_start} oseek=1 conv=notrunc \ |
dd if=$REL/$ROOTFS_IMG ibs=8192 of=$NEWKERN obs=${sec_start} oseek=1 conv=notrunc \ |
2>/dev/null && echo "'-> Completed MFS image embedded into kernel" |
2>/dev/null && echo "'-> Completed MFS image embedded into kernel" |
|
|
# START=`strings -td $KERNEL_ROOTFS | grep "MFS Filesystem" | cut -d ' ' -f 1 | head -1` | ### START=`strings -td $KERNEL_ROOTFS | grep "MFS Filesystem" | cut -d ' ' -f 1 | head -1` |
# STOP=`strings -td $KERNEL_ROOTFS | grep "MFS Filesystem" | cut -d ' ' -f 1 | tail -1` | ### STOP=`strings -td $KERNEL_ROOTFS | grep "MFS Filesystem" | cut -d ' ' -f 1 | tail -1` |
# STOP=$(($STOP + 1)) | ### STOP=$(($STOP + 1)) |
# echo "'-> Start offset from $START to $STOP byte" | ### echo "'-> Start offset from $START to $STOP byte" |
|
|
# head -c $START $KERNEL_ROOTFS >$NEWKERN | ### head -c $START $KERNEL_ROOTFS >$NEWKERN |
# cat $REL/$ROOTFS_IMG >>$NEWKERN | ### cat $REL/$ROOTFS_IMG >>$NEWKERN |
# tail -c +$STOP $KERNEL_ROOTFS >>$NEWKERN | ### tail -c +$STOP $KERNEL_ROOTFS >>$NEWKERN |
|
|
echo "'-> Compress kernel" |
echo "'-> Compress kernel" |
cd $REL |
cd $REL |