diff -Naurp catalyst.orig/modules/catalyst_support.py catalyst/modules/catalyst_support.py --- catalyst.orig/modules/catalyst_support.py 2005-12-21 01:32:09 -0500 +++ catalyst/modules/catalyst_support.py 2006-01-06 10:25:12 -0500 @@ -146,7 +146,7 @@ required_build_targets=["generic_target" # new build types should be added here valid_build_targets=["stage1_target","stage2_target","stage3_target","stage4_target","grp_target", "livecd_stage1_target","livecd_stage2_target","embedded_target", - "tinderbox_target","snapshot_target","netboot_target"] + "tinderbox_target","snapshot_target","netboot_target","netboot2_target"] required_config_file_values=["storedir","sharedir","distdir","portdir"] valid_config_file_values=required_config_file_values[:] diff -Naurp catalyst.orig/modules/netboot2_target.py catalyst/modules/netboot2_target.py --- catalyst.orig/modules/netboot2_target.py 1969-12-31 19:00:00 -0500 +++ catalyst/modules/netboot2_target.py 2006-01-06 15:53:04 -0500 @@ -0,0 +1,129 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/netboot_target.py,v 1.10 2005/12/05 18:13:12 rocket Exp $ + +""" +Builder class for a netboot build, version 2 +""" + +import os,string,types +from catalyst_support import * +from generic_stage_target import * + +class netboot2_target(generic_stage_target): + def __init__(self,spec,addlargs): + self.valid_values = [ + "netboot2/extra_files", + ] + self.required_values=[ + "boot/kernel", + "netboot2/builddate", + "netboot2/busybox_config", + "netboot2/packages" + ] + + try: + if addlargs.has_key("netboot2/packages"): + if type(addlargs["netboot2/packages"]) == types.StringType: + loopy=[addlargs["netboot2/packages"]] + else: + loopy=addlargs["netboot2/packages"] + except: + raise CatalystError,"configuration error in netboot2/packages." + + + + generic_stage_target.__init__(self,spec,addlargs) + self.set_build_kernel_vars(addlargs) + + # Merge packages into the buildroot, and pick out certain files to place in + # /tmp/image + self.settings["merge_path"]=normpath("/tmp/image") + + for envvar in "CFLAGS", "CXXFLAGS": + if not os.environ.has_key(envvar) and not addlargs.has_key(envvar): + self.settings[envvar] = "-Os -pipe" + + def set_dest_path(self): + if self.settings.has_key("merge_path"): + self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["merge_path"]) + else: + self.settings["destpath"]=normpath(self.settings["chroot_path"]) + + def set_target_path(self): + self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\ + self.settings["target_subpath"]+"/") + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"): + print "Resume point detected, skipping target path setup operation..." + else: + # first clean up any existing target stuff + if os.path.isfile(self.settings["target_path"]): + cmd("rm -f "+self.settings["target_path"], \ + "Could not remove existing file: "+self.settings["target_path"],env=self.env) + touch(self.settings["autoresume_path"]+"setup_target_path") + + if not os.path.exists(self.settings["storedir"]+"/builds/"): + os.makedirs(self.settings["storedir"]+"/builds/") + + def copy_files_to_image(self): + # copies specific files from the buildroot to merge_path + myfiles=[] + + # check for autoresume point + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"copy_files_to_image"): + print "Resume point detected, skipping target path setup operation..." + else: + if self.settings.has_key("netboot2/packages"): + if type(self.settings["netboot2/packages"]) == types.StringType: + loopy=[self.settings["netboot2/packages"]] + else: + loopy=self.settings["netboot2/packages"] + + for x in loopy: + if self.settings.has_key("netboot2/packages/"+x+"/files"): + if type(self.settings["netboot2/packages/"+x+"/files"]) == types.ListType: + myfiles.extend(self.settings["netboot2/packages/"+x+"/files"]) + else: + myfiles.append(self.settings["netboot2/packages/"+x+"/files"]) + + if self.settings.has_key("netboot2/extra_files"): + if type(self.settings["netboot2/extra_files"]) == types.ListType: + myfiles.extend(self.settings["netboot2/extra_files"]) + else: + myfiles.append(self.settings["netboot2/extra_files"]) + + try: + cmd("/bin/bash "+self.settings["controller_file"]+\ + " image " + list_bashify(myfiles),env=self.env) + except CatalystError: + self.unbind() + raise CatalystError,"Failed to copy files to image!" + + touch(self.settings["autoresume_path"]+"copy_files_to_image") + + + def move_kernels(self): + # we're done, move the kernels to builds/* + # no auto resume here as we always want the + # freshest images moved + try: + cmd("/bin/bash "+self.settings["controller_file"]+\ + " final",env=self.env) + print ">>> Netboot Build Finished!" + except CatalystError: + self.unbind() + raise CatalystError,"Failed to move kernel images!" + + + def set_action_sequence(self): + self.settings["action_sequence"]=["unpack","unpack_snapshot","config_profile_link", + "setup_confdir","bind","chroot_setup",\ + "setup_environment","build_packages","root_overlay",\ + "copy_files_to_image","build_kernel","move_kernels",\ + "unbind","clean","clear_autoresume"] + +def register(foo): + foo.update({"netboot2":netboot2_target}) + return foo diff -Naurp catalyst.orig/targets/netboot2/netboot2-controller.sh catalyst/targets/netboot2/netboot2-controller.sh --- catalyst.orig/targets/netboot2/netboot2-controller.sh 1969-12-31 19:00:00 -0500 +++ catalyst/targets/netboot2/netboot2-controller.sh 2006-01-06 10:25:12 -0500 @@ -0,0 +1,64 @@ +#!/bin/bash +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-controller.sh,v 1.8 2005/12/19 15:03:25 wolf31o2 Exp $ + +. ${clst_sharedir}/targets/support/functions.sh +. ${clst_sharedir}/targets/support/filesystem-functions.sh + +case ${1} in + build_packages) + echo ">>> Building packages ..." + shift + clst_root_path="/" \ + clst_packages="$*" \ + exec_in_chroot \ + ${clst_sharedir}/targets/${clst_target}/${clst_target}-pkg.sh + ;; + pre-kmerge) + # Sets up the build environment before any kernels are compiled + exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh + ;; + post-kmerge) + # Cleans up the build environment after the kernels are compiled + exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh + ;; + kernel) + shift + export clst_kname="$1" + + # if we have our own linuxrc, copy it in + if [ -n "${clst_linuxrc}" ] + then + cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc + fi + exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh + delete_from_chroot tmp/linuxrc + + extract_modules ${clst_chroot_path} ${clst_kname} + #16:12 <@solar> kernel_name=foo + #16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar + #16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config + ;; + image) + # Creates the base initramfs image for the netboot + echo -e ">>> Preparing Image ..." + shift + + # Copy remaining files over to the initramfs target + clst_files="${@}" \ + exec_in_chroot \ + ${clst_sharedir}/targets/${clst_target}/${clst_target}-copyfile.sh + ;; + final) + # For each arch, fetch the kernel images and put them in builds/ + echo -e ">>> Copying completed kernels to ${clst_target_path} ..." + ${clst_sharedir}/targets/support/netboot2-final.sh + ;; + clean) + exit 0;; + *) + exit 1;; +esac + +exit $? diff -Naurp catalyst.orig/targets/netboot2/netboot2-copyfile.sh catalyst/targets/netboot2/netboot2-copyfile.sh --- catalyst.orig/targets/netboot2/netboot2-copyfile.sh 1969-12-31 19:00:00 -0500 +++ catalyst/targets/netboot2/netboot2-copyfile.sh 2006-01-06 10:25:12 -0500 @@ -0,0 +1,16 @@ +#!/bin/bash +# Copyright 1999-2005 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.7 2005/12/19 15:03:25 wolf31o2 Exp $ + +. /tmp/chroot-functions.sh + +update_env_settings + +echo ">>> Copying initramfs files to ${clst_merge_path} (in chroot) ..." +[ ! -d "${clst_merge_path}" ] && mkdir -p ${clst_merge_path} +for f in ${clst_files} +do + cp -af --parents ${f} ${clst_merge_path} +done +echo "" diff -Naurp catalyst.orig/targets/netboot2/netboot2-pkg.sh catalyst/targets/netboot2/netboot2-pkg.sh --- catalyst.orig/targets/netboot2/netboot2-pkg.sh 1969-12-31 19:00:00 -0500 +++ catalyst/targets/netboot2/netboot2-pkg.sh 2006-01-06 10:25:12 -0500 @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/netboot/netboot-chroot.sh,v 1.5 2005/12/19 15:03:25 wolf31o2 Exp $ + +. /tmp/chroot-functions.sh + +update_env_settings + +setup_myfeatures +setup_myemergeopts + +# Setup our environment +export FEATURES="${clst_myfeatures}" +export USE_ORDER="env:pkg:conf:defaults" + +# START BUILD + +run_emerge ${clst_myemergeopts} ${clst_packages} diff -Naurp catalyst.orig/targets/support/netboot2-final.sh catalyst/targets/support/netboot2-final.sh --- catalyst.orig/targets/support/netboot2-final.sh 1969-12-31 19:00:00 -0500 +++ catalyst/targets/support/netboot2-final.sh 2006-01-08 20:56:41 -0500 @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ +. ${clst_sharedir}/targets/support/functions.sh +. ${clst_sharedir}/targets/support/filesystem-functions.sh + + +extract_kernels ${clst_target_path}boot + +# Move kernel binaries to ${clst_target_path}kernels, and +# move everything else to ${clst_target_path}kernels/misc +mkdir ${clst_target_path}kernels +mkdir ${clst_target_path}kernels/misc + +for x in ${clst_boot_kernel}; do + mv ${clst_target_path}boot/${x} ${clst_target_path}kernels + mv ${clst_target_path}boot/${x}.igz ${clst_target_path}kernels/misc +done +rmdir ${clst_target_path}boot + + +# Any post-processing necessary for each architecture can be done here. This may +# include things like sparc's elftoaout, x86's PXE boot, etc. +case ${clst_mainarch} in + alpha) + sleep 0 + ;; + arm) + sleep 0 + ;; + hppa) + sleep 0 + ;; + sparc*) + sleep 0 + ;; + ia64) + sleep 0 + ;; + x86|amd64) + sleep 0 + ;; +esac +exit $? diff -Naurp catalyst.orig/targets/support/pre-kmerge.sh catalyst/targets/support/pre-kmerge.sh --- catalyst.orig/targets/support/pre-kmerge.sh 2005-12-19 11:52:01 -0500 +++ catalyst/targets/support/pre-kmerge.sh 2006-01-06 10:25:12 -0500 @@ -6,19 +6,39 @@ update_env_settings -export USE="livecd" -run_emerge --oneshot genkernel +case ${clst_target} in + livecd*) + export USE="livecd" + run_emerge --oneshot genkernel + install -d /usr/portage/packages/gk_binaries -install -d /usr/portage/packages/gk_binaries - -# Setup case structure for livecd_type -case ${clst_livecd_type} in - gentoo-release-minimal | gentoo-release-universal) - case ${clst_mainarch} in - amd64|x86) - sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /' /usr/share/genkernel/genkernel + # Setup case structure for livecd_type + case ${clst_livecd_type} in + gentoo-release-minimal | gentoo-release-universal) + case ${clst_mainarch} in + amd64|x86) + sed -i 's/initramfs_data.cpio.gz /initramfs_data.cpio.gz -r 1024x768 /' /usr/share/genkernel/genkernel + ;; + esac ;; esac ;; -esac + + netboot2) + run_emerge --oneshot genkernel + install -d /usr/portage/packages/gk_binaries + + # Set the netboot builddate/hostname in linuxrc & copy to proper arch directory in genkernel + sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \ + -e "s/@@RELVER@@/${clst_version_stamp}/g" \ + ${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \ + > ${clst_root_path}usr/share/genkernel/${clst_mainarch}/linuxrc + + echo ">>> Copying support files to ${clst_root_path} ..." + cp -af ${clst_root_path}usr/share/genkernel/netboot/misc/* ${clst_merge_path} + + echo ">>> Copying busybox config ..." + cp -f ${clst_netboot2_busybox_config} /usr/share/genkernel/${clst_mainarch}/busy-config + ;; +esac