# ChangeLog for gentoo/src/catalyst
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.90 2004/10/06 16:00:09 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.91 2004/10/11 14:19:30 zhen Exp $
+
+ 11 Oct 2004; <zhen@gentoo.org> modules/netboot.py,
+ targets/netboot/netboot-busybox.sh, targets/netboot/netboot-image.sh,
+ targets/netboot/netboot-kernel.sh, targets/netboot/netboot-packages.sh,
+ targets/netboot/netboot.sh:
+ sweeping updates and changes to the netboot code. the patches should fix the
+ arch specific code as well as some pkgcache issues, etc. Much thanks to Mike
+ Frysinger <spanky@gentoo.org> for writing and contributing the patches.
06 Oct 2004; John Davis <zhen@gentoo.org> files/catalyst.1,
livecd/runscript-support/kmerge.sh, targets/netboot/netboot-busybox.sh,
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/Attic/netboot.py,v 1.1 2004/10/06 01:34:29 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/Attic/netboot.py,v 1.2 2004/10/11 14:19:30 zhen Exp $
"""
Builder class for a netboot build.
class netboot_target(generic_stage_target):
def __init__(self,spec,addlargs):
- self.required_values=["netboot/kernel/sources",\
- "netboot/kernel/config","netboot/busybox_config"]
+ self.valid_values = [
+ "netboot/kernel/sources",
+ "netboot/kernel/config",
+ "netboot/kernel/prebuilt",
- self.valid_values=["netboot/extra_files"]
- if not addlargs.has_key("netboot/packages"):
- raise CatalystError, "Required value netboot/packages not specified."
-
- if type(addlargs["netboot/packages"]) == types.StringType:
- loopy=[addlargs["netboot/packages"]]
+ "netboot/busybox_config",
+
+ "netboot/extra_files",
+ "netboot/packages"
+ ]
+ self.required_values=[]
- else:
- loopy=addlargs["netboot/packages"]
+ try:
+ if addlargs.has_key("netboot/packages"):
+ if type(addlargs["netboot/packages"]) == types.StringType:
+ loopy=[addlargs["netboot/packages"]]
+ else:
+ loopy=addlargs["netboot/packages"]
for x in loopy:
self.required_values.append("netboot/packages/"+x+"/files")
-
- self.valid_values.extend(self.required_values)
+ except:
+ raise CatalystError,"configuration error in netboot/packages."
generic_stage_target.__init__(self,spec,addlargs)
+ if addlargs.has_key("netboot/busybox_config"):
file_locate(self.settings, ["netboot/busybox_config"])
+
+ if addlargs.has_key("netboot/kernel/sources"):
file_locate(self.settings, ["netboot/kernel/config"])
- file_locate(self.settings, ["netboot/base_tarball"])
+ elif addlargs.has_key("netboot/kernel/prebuilt"):
+ file_locate(self.settings, ["netboot/kernel/prebuilt"])
+ else:
+ raise CatalystError,"you must define netboot/kernel/config or netboot/kernel/prebuilt"
+
+ # unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os
+ for envvar in "CFLAGS", "CXXFLAGS":
+ if not os.environ.has_key(envvar) and not addlargs.has_key(envvar):
+ self.settings[envvar] = "-Os -pipe"
+
def run_local(self):
- # Build packages
+ # setup our chroot
+ try:
+ cmd("/bin/bash "+self.settings["sharedir"]+\
+ "/targets/netboot/netboot.sh setup")
+ except CatalystError:
+ self.unbind()
+ raise CatalystError,"couldn't setup netboot env."
+
+ # build packages
+ if self.settings.has_key("netboot/packages"):
mypack=list_bashify(self.settings["netboot/packages"])
try:
cmd("/bin/bash "+self.settings["sharedir"]+\
"/targets/netboot/netboot.sh packages "+mypack)
-
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
- # Build busybox
+ # build busybox
+ if self.settings.has_key("netboot/busybox_config"):
+ mycmd = self.settings["netboot/busybox_config"]
+ else:
+ mycmd = ""
try:
cmd("/bin/bash "+self.settings["sharedir"]+\
- "/targets/netboot/netboot.sh busybox "+ self.settings["netboot/busybox_config"])
-
+ "/targets/netboot/netboot.sh busybox "+ mycmd)
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
- # Build kernel
+ # build kernel
+ if self.settings.has_key("netboot/kernel/prebuilt"):
+ mycmd = "kernel-prebuilt " + \
+ self.settings["netboot/kernel/prebuilt"]
+ else:
+ mycmd = "kernel-sources " + \
+ self.settings["netboot/kernel/sources"] + " " + \
+ self.settings["netboot/kernel/config"]
try:
cmd("/bin/bash "+self.settings["sharedir"]+\
- "/targets/netboot/netboot.sh kernel "+ self.settings["netboot/kernel/sources"] + " " +\
- self.settings["netboot/kernel/config"])
-
+ "/targets/netboot/netboot.sh kernel " + mycmd)
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
- # Create image
+ # create image
myfiles=[]
+ if self.settings.has_key("netboot/packages"):
if type(self.settings["netboot/packages"]) == types.StringType:
loopy=[self.settings["netboot/packages"]]
-
else:
loopy=self.settings["netboot/packages"]
else:
myfiles.append(self.settings["netboot/packages/"+x+"/files"])
+ if self.settings.has_key("netboot/extra_files"):
if type(self.settings["netboot/extra_files"]) == types.ListType:
myfiles.extend(self.settings["netboot/extra_files"])
else:
try:
cmd("/bin/bash "+self.settings["sharedir"]+\
- "/targets/netboot/netboot.sh image "+ self.settings["netboot/base_tarball"] + " " + list_bashify(myfiles))
-
+ "/targets/netboot/netboot.sh image " + list_bashify(myfiles))
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
- # Copying images in the target_path
+ # finish it all up
try:
cmd("/bin/bash "+self.settings["sharedir"]+\
"/targets/netboot/netboot.sh finish")
-
except CatalystError:
self.unbind()
raise CatalystError,"netboot build aborting due to error."
- # End
+ # end
print "netboot: build finished !"
#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-busybox.sh,v 1.2 2004/10/06 16:00:09 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-busybox.sh,v 1.3 2004/10/11 14:19:30 zhen Exp $
/usr/sbin/env-update
source /etc/profile
[ -f /tmp/envscript ] && source /tmp/envscript
-if [ -n "${clst_DISTCC}" ]
-then
- export clst_myfeatures="${clst_myfeatures} distcc"
- export DISTCC_HOSTS="${clst_distcc_hosts}"
-
- USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-## setup the environment
+# setup our environment
export FEATURES="${clst_myfeatures}"
export CONFIG_PROTECT="-*"
-
-## START BUILD
export USE_ORDER="env:conf:defaults"
# Use the catalyst config
-export USE="savedconfig make-busybox-symlinks"
-mkdir -pv ${IMAGE_PATH}
-ROOT=${IMAGE_PATH} emerge --nodeps ${clst_emergeopts} busybox || exit 1
-
-# Remove portage's unneeded files
-rm -rf ${IMAGE_PATH}/etc
-rm -rf ${IMAGE_PATH}/tmp
-rm -rf ${IMAGE_PATH}/usr
-rm -rf ${IMAGE_PATH}/var
+export USE="savedconfig netboot"
+ROOT=${IMAGE_PATH} emerge --nodeps ${clst_myemergeopts} busybox || exit 1
#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-image.sh,v 1.2 2004/10/06 16:00:09 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-image.sh,v 1.3 2004/10/11 14:19:30 zhen Exp $
/usr/sbin/env-update
source /etc/profile
[ -f /tmp/envscript ] && source /tmp/envscript
-IMAGE_PATH=$1
-shift
-TARBALL=$1
-shift
+export USE="-* netboot"
+
+emerge -k -b --nodeps genext2fs || exit 1
if [ -z "${IMAGE_PATH}" ]
then
exit 1
fi
-# Required directories
-mkdir -vp ${IMAGE_PATH}/bin
-mkdir -vp ${IMAGE_PATH}/dev
-mkdir -vp ${IMAGE_PATH}/etc
-mkdir -vp ${IMAGE_PATH}/mnt/gentoo
-mkdir -vp ${IMAGE_PATH}/proc
-mkdir -vp ${IMAGE_PATH}/var/log
+# Install the netboot base system
+ROOT=${IMAGE_PATH} emerge -k -b --nodeps netboot-base || exit 1
+
+# Handle all strip calls here
+function do_strip() {
+ strip --strip-unneeded "$@"
+}
# Copy libs of a executable in the chroot
function copy_libs() {
+ local ldd file="${1}"
+ # Figure out what libraries this file needs
+ local libs="$(readelf -d "${file}" | grep '(NEEDED)' | awk '{print $NF}')"
- # Check if it's a dynamix exec
- ldd ${1} > /dev/null 2>&1 || return
+ # Check if it's a dynamix exec, bail if it isnt
+ [ -z "${libs}" ] && return 0
- for lib in `ldd ${1} | awk '{ print $3 }'`
+ for lib in ${libs}
do
- if [ -e ${lib} ]
- then
- if [ ! -e ${IMAGE_PATH}/${lib} ]
- then
- copy_file ${lib}
- [ -e "${IMAGE_PATH}/${lib}" ] && strip -R .comment -R .note ${IMAGE_PATH}/${lib} || echo "WARNING : Cannot strip lib ${IMAGE_PATH}/${lib} !"
- fi
- else
- echo "WARNING : Some library was not found for ${lib} !"
- fi
- done
-
-}
-
-function copy_symlink() {
-
- STACK=${2}
- [ "${STACK}" = "" ] && STACK=16 || STACK=$((${STACK} - 1 ))
-
- if [ ${STACK} -le 0 ]
- then
- echo "WARNING : ${TARGET} : too many levels of symbolic links !"
- return
- fi
-
- [ ! -e ${IMAGE_PATH}/`dirname ${1}` ] && mkdir -p ${IMAGE_PATH}/`dirname ${1}`
- [ ! -e ${IMAGE_PATH}/${1} ] && cp -vfdp ${1} ${IMAGE_PATH}/${1}
+ # readelf shows [libblah.so] so we have to trim []
+ lib=${lib:1:${#lib}-2}
+
+ # don't scan the lib if it's already been copied over
+ [ -e "${IMAGE_PATH}/lib/${lib}" ] && continue
+
+ # ldd changes output format over time
+ ldd="$(ldd "${file}" | grep ${lib})"
+ set -- ${ldd}
+ for ldd in "${@}" NF
+ do
+ [ "${ldd:0:1}" == "/" ] && break
+ done
- TARGET=`readlink -f ${1}`
- if [ -h ${TARGET} ]
+ if [ "${ldd}" == "NF" ]
then
- copy_symlink ${TARGET} ${STACK}
+ echo "copy_lib: could not locate '${lib}'"
else
- copy_file ${TARGET}
+ copy_file ${ldd}
fi
-
+ done
}
-
function copy_file() {
-
- f="${1}"
+ local f="${1}"
if [ ! -e "${f}" ]
then
- echo "WARNING : File not found : ${f}"
- continue
+ echo "copy_file: File '${f}' not found"
+ return 0
fi
- [ ! -e ${IMAGE_PATH}/`dirname ${f}` ] && mkdir -p ${IMAGE_PATH}/`dirname ${f}`
- [ ! -e ${IMAGE_PATH}/${f} ] && cp -vfdp ${f} ${IMAGE_PATH}/${f}
- if [ -x ${f} -a ! -h ${f} ]
+ if [ -L "${f}" ]
then
- copy_libs ${f}
- strip -R .comment -R .note ${IMAGE_PATH}/${f} > /dev/null 2>&1
- elif [ -h ${f} ]
+ cp -dp "${f}" "${IMAGE_PATH}/lib/"
+ local l="$(readlink "${f}")"
+ if [ ! -e "${l}" ]
then
- copy_symlink ${f}
+ l="$(dirname "${f}")/${l}"
+ fi
+ f="${l}"
fi
+ cp "${f}" "${IMAGE_PATH}/lib/"
+ do_strip "${IMAGE_PATH}/lib/$(basename "${f}")"
}
# Copy the files needed in the chroot
+loader="$(readelf -a ${IMAGE_PATH}/bin/busybox | grep 'ld-.*so' | awk '{print $NF}')"
+copy_file ${loader/]}
copy_libs ${IMAGE_PATH}/bin/busybox
-
-FILES="${@}"
-for f in ${FILES}
-do
+for f in "$@" ; do
+ copy_libs ${f}
copy_file ${f}
done
-# Copy the kernel modules
-[ ! -e ${IMAGE_PATH}/lib ] && mkdir -p ${IMAGE_PATH}/lib
-cp -Rv /lib/modules ${IMAGE_PATH}/lib
-#find ${IMAGE_PATH}/lib -name \*.o -o -name \*.ko | xargs strip -R .comment -R .note
-
-# Extract the base tarball
-tar xjvf ${TARBALL} -C ${IMAGE_PATH}/
+# Copy the kernel modules over
+if [ -d ${GK_BINARIES}/lib ] ; then
+ cp -r ${GK_BINARIES}/lib ${IMAGE_PATH}/ || exit 1
+fi
-# Unpack the kernel
-tar xjvf ${GK_BINARIES}/kernel.tar.bz2 -C /
-mv -f /kernel-2.* /kernel
+# Prune portage stuff
+cd ${IMAGE_PATH}
+rm -r var/db var/cache
# Create the ramdisk
-IMAGE_SIZE=`du -s ${IMAGE_PATH} | awk '{ print $1 }'`
-
-dd if=/dev/zero of=/ramdisk bs=1k count=$((IMAGE_SIZE + 500))
-
-yes | mke2fs /ramdisk
-
-mkdir /ramdisk-loop
-mount -o loop ramdisk ramdisk-loop
-cp -R ${IMAGE_PATH}/* /ramdisk-loop
-umount /ramdisk-loop
-rmdir /ramdisk-loop
+IMAGE_SIZE=$(du -s -k ${IMAGE_PATH} | cut -f1)
+IMAGE_SIZE=$((IMAGE_SIZE + 200))
+IMAGE_INODES=$(find ${IMAGE_PATH} | wc -l)
+IMAGE_INODES=$((IMAGE_INODES + 100))
+genext2fs -q -d "${IMAGE_PATH}" -b ${IMAGE_SIZE} -i ${IMAGE_INODES} /initrd || exit 1
+gzip -9f /initrd || exit 1
#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-kernel.sh,v 1.2 2004/10/06 16:00:09 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-kernel.sh,v 1.3 2004/10/11 14:19:30 zhen Exp $
/usr/sbin/env-update
source /etc/profile
[ -f /tmp/envscript ] && source /tmp/envscript
-if [ -n "${clst_DISTCC}" ]
-then
- export clst_myfeatures="${clst_myfeatures} distcc"
- export DISTCC_HOSTS="${clst_distcc_hosts}"
+# setup our environment
+export FEATURES="${clst_myfeatures}"
+export CONFIG_PROTECT="-*"
+export USE_ORDER="env:conf:defaults"
- USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
+mkdir -p ${GK_BINARIES}
+BUILD_KERNEL=1
if [ -n "${clst_PKGCACHE}" ]
then
- clst_emergeopts="--usepkg --buildpkg"
-else
- clst_emergeopts=""
+ GK_PKGDIR="$(portageq envvar PKGDIR)/All/genkernel"
+ mkdir -p ${GK_PKGDIR}
+ if [ -f ${GK_PKGDIR}/kernel ] && [ -d ${GK_PKGDIR}/lib ]
+ then
+ cp -r ${GK_PKGDIR}/lib ${GK_BINARIES}/ || exit 1
+ cp ${GK_PKGDIR}/kernel ${GK_BINARIES}/ || exit 1
+ BUILD_KERNEL=0
+ fi
fi
-KERNEL_SOURCES=$1
-shift
-
-## setup the environment
-export FEATURES="${clst_myfeatures}"
-export CONFIG_PROTECT="-*"
-
-## START BUILD
-export USE_ORDER="env:conf:defaults"
+if [ ${BUILD_KERNEL} -eq 1 ]
+then
+ # setup genkernel
+ emerge ${clst_myemergeopts} genkernel || exit 1
+ # Fix dumb genkernel bug (#64514)
+ sed -e "/BUILD_INITRD/{s/&&/& (/
+ s/$/ )/ }" -i /usr/share/genkernel/gen_package.sh
-emerge ${clst_emergeopts} genkernel || exit 1
+ # Build the kernel !
+ emerge ${clst_myemergeopts} ${SOURCES} || exit 1
-# Fix dumb genkernel bug (#64514) (remove this when genkernel 3.0.2g goes stable)
-sed -e "/BUILD_INITRD/{s/&&/& (/
-s/$/ )/ }" -i /usr/share/genkernel/gen_package.sh
+ genkernel \
+ --no-mountboot \
+ --kerneldir=/usr/src/linux \
+ --kernel-config=${CONFIG} \
+ --module-prefix=${GK_BINARIES} \
+ --minkernpackage=${GK_BINARIES}/kernel.tar.bz2 \
+ kernel || exit 1
-USE="${@}" emerge ${KERNEL_SOURCES} || exit 1
+ find ${GK_BINARIES}/lib \
+ -name '*.o' -o -name '*.ko' \
+ -exec strip -R .comment -R .note {} \; \
+ || exit 1
+ kernname="$(tar -tjf ${GK_BINARIES}/kernel.tar.bz2)"
+ tar -jxf ${GK_BINARIES}/kernel.tar.bz2 -C ${GK_BINARIES}
+ mv ${GK_BINARIES}/{${kernname},kernel} || exit 1
-mkdir -p ${GK_BINARIES}
+ if [ -n "${clst_PKGCACHE}" ]
+ then
+ case ${clst_mainarch} in
+ alpha|arm|sparc);;
+ *)
+ cp -r ${GK_BINARIES}/lib ${GK_PKGDIR}/ || exit 1
+ cp ${GK_BINARIES}/kernel ${GK_PKGDIR}/ || exit 1
+ ;;
+ esac
+ fi
+fi
-genkernel --kerneldir=/usr/src/linux --kernel-config=/var/tmp/kernel.config \
- --minkernpackage=${GK_BINARIES}/kernel-${clst_version_stamp}.tar.bz2 \
- kernel || exit 1
+cp ${GK_BINARIES}/kernel / || exit 1
#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-packages.sh,v 1.1 2004/10/06 01:34:29 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot-packages.sh,v 1.2 2004/10/11 14:19:30 zhen Exp $
/usr/sbin/env-update
source /etc/profile
[ -f /tmp/envscript ] && source /tmp/envscript
-if [ -n "${clst_CCACHE}" ]
-then
- export clst_myfeatures="${clst_myfeatures} ccache"
- emerge --oneshot --nodeps -b -k ccache || exit 1
-fi
-
-if [ -n "${clst_DISTCC}" ]
-then
- export clst_myfeatures="${clst_myfeatures} distcc"
- export DISTCC_HOSTS="${clst_distcc_hosts}"
-
- USE="-gnome -gtk" emerge --oneshot --nodeps -b -k distcc || exit 1
-fi
-
-if [ -n "${clst_PKGCACHE}" ]
-then
- clst_emergeopts="--usepkg --buildpkg"
-else
- clst_emergeopts=""
-fi
-
-## setup the environment
+# setup our environment
export FEATURES="${clst_myfeatures}"
export CONFIG_PROTECT="-*"
-
-## START BUILD
-USE="build" emerge portage
-#turn off auto-use:
export USE_ORDER="env:conf:defaults"
+# START BUILD
if [ "${clst_VERBOSE}" ]
then
- emerge ${clst_emergeopts} -vp ${clst_packages}
+ emerge ${clst_myemergeopts} -vp ${clst_packages}
sleep 15
fi
-emerge ${clst_emergeopts} ${clst_packages}
+emerge ${clst_myemergeopts} ${clst_packages}
#!/bin/bash
-# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot.sh,v 1.2 2004/10/06 16:00:09 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/Attic/netboot.sh,v 1.3 2004/10/11 14:19:30 zhen Exp $
-export GK_BINARIES=/usr/portage/packages/gk_binaries
-export IMAGE_PATH=/image
+export GK_BINARIES=/var/tmp/gk_binaries
+export IMAGE_PATH=/tmp/image
-# Force usage of -Os for smaller size
-export CFLAGS="-Os -pipe"
-export CXXFLAGS="-Os -pipe"
+if [ -n "${clst_CCACHE}" ]
+then
+ export clst_myfeatures="${clst_myfeatures} ccache"
+fi
+if [ -n "${clst_DISTCC}" ]
+then
+ export clst_myfeatures="${clst_myfeatures} distcc"
+ export DISTCC_HOSTS="${clst_distcc_hosts}"
+fi
+if [ -n "${clst_PKGCACHE}" ]
+then
+ export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg"
+fi
-case $1 in
- enter)
- ${clst_CHROOT} ${clst_chroot_path}
+scriptdir=${clst_sharedir}/targets/netboot
+
+echo "NETBOOT.SH: $@"
+cmd=$1
+shift
+case ${cmd} in
+
+ setup)
+ cp ${scriptdir}/netboot-setup.sh ${clst_chroot_path}/tmp
+ ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-setup.sh || exit 1
+ rm -f ${clst_chroot_path}/tmp/netboot-setup.sh
;;
- packages)
- shift
- cp ${clst_sharedir}/targets/netboot/netboot-packages.sh ${clst_chroot_path}/tmp
+ packages)
+ cp ${scriptdir}/netboot-packages.sh ${clst_chroot_path}/tmp
clst_packages="$*" ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-packages.sh || exit 1
rm -f ${clst_chroot_path}/tmp/netboot-packages.sh
;;
+
busybox)
- shift
+ # Custom busybox config support
+ if [ ! -z "${1}" ]
+ then
+ mkdir -p ${clst_chroot_path}/etc/busybox/${clst_CHOST}
+ cp ${1} ${clst_chroot_path}/etc/busybox/${clst_CHOST}/busybox.config
+ fi
- cp ${clst_sharedir}/targets/netboot/netboot-busybox.sh ${clst_chroot_path}/tmp
- mkdir -p ${clst_chroot_path}/etc/busybox/${clst_CHOST}/
- # Seems busybox doesn't have a CCHOST set when emerging
- CCHOST=
- cp ${1} ${clst_chroot_path}/etc/busybox/${CCHOST}/busybox.config
+ cp ${scriptdir}/netboot-busybox.sh ${clst_chroot_path}/tmp
${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-busybox.sh || exit 1
rm -f ${clst_chroot_path}/tmp/netboot-busybox.sh
;;
kernel)
- shift
- SOURCES=${1}
- shift
- CONFIG=${1}
- shift
-
- cp ${clst_sharedir}/targets/netboot/netboot-kernel.sh ${clst_chroot_path}/tmp
- cp ${CONFIG} ${clst_chroot_path}/var/tmp/kernel.config
- ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-kernel.sh ${SOURCES} ${clst_netboot_kernel_use} || exit 1
+ KERNEL_TYPE=${1}
+ SOURCES=${2}
+ CONFIG=${3}
+ if [ "${KERNEL_TYPE}" == "kernel-sources" ]
+ then
+ cp ${scriptdir}/netboot-kernel.sh ${clst_chroot_path}/tmp
+ cp ${CONFIG} ${clst_chroot_path}/var/tmp/kernel.config || die
+ env SOURCES=${SOURCES} CONFIG=/var/tmp/kernel.config \
+ ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-kernel.sh || exit 1
rm -f ${clst_chroot_path}/tmp/netboot-kernel.sh
+ else
+ cp ${clst_netboot_kernel_prebuilt} ${clst_chroot_path}/kernel
+ fi
;;
image)
- shift
- TARBALL=${1}
- shift
-
- cp ${clst_sharedir}/targets/netboot/netboot-image.sh ${clst_chroot_path}/tmp
- cp ${TARBALL} ${clst_chroot_path}/netboot-base.tar.bz2
- ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-image.sh ${IMAGE_PATH} /netboot-base.tar.bz2 ${@} || exit 1
+ cp ${scriptdir}/netboot-image.sh ${clst_chroot_path}/tmp
+ ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-image.sh "$@" || exit 1
rm -f ${clst_chroot_path}/tmp/netboot-image.sh
- exit 0
;;
finish)
- [ ! -e ${clst_target_path} ] && mkdir -p ${clst_target_path}
- cp ${clst_chroot_path}/ramdisk ${clst_chroot_path}/kernel ${clst_target_path}
- strip ${clst_target_path}/kernel > /dev/null 2>&1
- gzip -9f ${clst_target_path}/ramdisk
- exit 0
- ;;
+ cp ${scriptdir}/netboot-combine.sh ${clst_chroot_path}/tmp
+ ${clst_CHROOT} ${clst_chroot_path} /tmp/netboot-combine.sh || exit 1
+ rm -f ${clst_chroot_path}/tmp/netboot-combine.sh
- clean)
- exit 0
+ mkdir -p ${clst_target_path}
+ cp \
+ ${clst_chroot_path}/{initrd.gz,kernel,netboot.$clst_mainarch} \
+ ${clst_target_path} || exit 1
;;
+ clean)
+ exit 0;;
*)
- exit 1
- ;;
-
+ exit 1;;
esac
+
exit 0