From: Chris Gianelloni Date: Thu, 12 Apr 2007 11:57:06 +0000 (+0000) Subject: Added a patch from Andrew Gaffney from bug #173826 to improve... X-Git-Tag: CATALYST_2_0_6_916~265 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=617a8f9b96c960503640edeff11f5537afb8c1a9;p=catalyst.git Added a patch from Andrew Gaffney from bug #173826 to improve the netboot2 target. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1229 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 48fa771c..c69861e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 # $Id: $ + 12 Apr 2007; Chris Gianelloni + modules/netboot2_target.py, targets/netboot2/netboot2-controller.sh, + targets/netboot2/netboot2-copyfile.sh, targets/support/functions.sh, + targets/support/netboot2-final.sh, targets/support/pre-kmerge.sh: + Added a patch from Andrew Gaffney from bug #173826 to + improve the netboot2 target. + 10 Apr 2007; Chris Gianelloni modules/generic_stage_target.py: Added a patch from Mike Frysinger for bug #173740 to @@ -2071,12 +2078,12 @@ Made sure bindist was used for all emerges in GRP. 07 Jul 2005; Eric Edgar targets/grp/grp-chroot.sh: - Fix USE flags for grp build + Fix USE flags for GRP build 07 Jul 2005; Eric Edgar targets/grp/grp-chroot.sh, targets/stage4/stage4-chroot.sh: - let grp use the users environment variables and removed extra - grp_stage23_use from stage4 + let GRP use the users environment variables and removed extra + GRP_STAGE23_USE from stage4 07 Jul 2005; Eric Edgar targets/stage2/stage2-chroot.sh, targets/stage3/stage3-chroot.sh: @@ -2084,7 +2091,7 @@ 07 Jul 2005; Eric Edgar targets/support/rc-update.sh: fix bug 98165. Change the separator on rcadd/rcdel from : to | This will - impact all previous spec files that use this option. Its beejays fault + impact all previous spec files that use this option. It's beejay's fault. 06 Jul 2005; Chris Gianelloni arch/ppc.py: Changed to use linux32 for ppc32 support when build host is ppc64. @@ -2261,7 +2268,8 @@ 20 May 2005; Chris Gianelloni AUTHORS, catalyst, files/catalyst.conf: - Retired zhen and added storedir to default catalyst.conf. + Retired John Davis and added storedir to default + catalyst.conf. 20 May 2005; Chris Gianelloni targets/support/livecdfs-update.sh: @@ -2367,16 +2375,15 @@ targets/support/create-iso.sh, targets/support/kmerge.sh, targets/support/target_image_setup.sh, targets/tinderbox/tinderbox-controller.sh: - Fix some exception handling in catalyst_support.py - remove intermediate destination folder of iso and tarball - Add additional tests for folders not found on host but defined - in spec file. Keep catalyst from erroring in this case. - Change exit code on shell scripts so that errors are reported to catalyst - and causes catalyst to die on errors - Fix bug in livecd-stage1-chroot.sh so that it uses USE flags properly - Added additional check for mkisofs. Informs user of where to get the program. - Removed autoresume code from ccache and distcc installation until I can figure - out a way to have the autoresume flag go someplace outside the chroot. + Fix some exception handling in catalyst_support.py, remove intermediate + destination folder of iso and tarball, add additional tests for folders not + found on host but defined in spec file, keep catalyst from erroring in this + case, change exit code on shell scripts so that errors are reported to + catalyst and causes catalyst to die on errors, fix bug in + livecd-stage1-chroot.sh so that it uses USE flags properly, added additional + check for mkisofs that informs the user of where to get the program, and + removed the autoresume code from ccache and distcc installation until I can + figure out a way to have the autoresume flag go someplace outside the chroot. 26 Apr 2005; Eric Edgar catalyst: Remove bind mounts before rm operations happen at startup @@ -2490,7 +2497,8 @@ targets/support/pre-kmerge.sh: Fix ctrl-c error if pre-kmerge.sh is running by sourcing /tmp/chroot-functions.sh and removed extra equal sign to fix a genkernel - caching bug; Also adding preliminary support for initramfs_overlay from genkernel + caching bug; Also adding preliminary support for initramfs_overlay from + genkernel 14 Apr 2005; Eric Edgar modules/generic_stage_target.py, targets/support/kmerge.sh: @@ -3753,7 +3761,7 @@ added envscripts support (fixes bug #39832) massive cleanup of tree to prepare it for ebuild - added headers to everything and removed deprecated dirs - 14 Jan 2004; zhen arch/mips.py, modules/targets.py: + 14 Jan 2004; John Davis arch/mips.py, modules/targets.py: adding Kumba's patches for MIPS 16 Dec 2003; Guy Martin : arch/hppa.py,modules/targets.py: @@ -3785,14 +3793,14 @@ 24 Oct 2003; Daniel Robbins : major code rework in progress on the python parts. - 17 Oct 2003; zhen files/grp/x86/x86.conf, + 17 Oct 2003; John Davis files/grp/x86/x86.conf, files/grp/x86/x86.pkg.cd1, files/grp/x86/x86.pkg.cd2, files/grp/x86/x86.src, files/livecd/x86-basic/base.pkg, files/livecd/x86-basic/kern.pkg: for organiation's sake, I have moved the files, such as livecd foundations, into catalyst/files. It will make it easier for us when ebuild time comes around. - 15 Oct 2003; zhen targets/stage3/stage3.sh: + 15 Oct 2003; John Davis targets/stage3/stage3.sh: All preliminary target build scripts are now added and coded to near as spec that we can have at this point. diff --git a/modules/netboot2_target.py b/modules/netboot2_target.py index 6fe0886e..3d7cbafe 100644 --- a/modules/netboot2_target.py +++ b/modules/netboot2_target.py @@ -10,15 +10,17 @@ from generic_stage_target import * class netboot2_target(generic_stage_target): def __init__(self,spec,addlargs): self.required_values=[ - "boot/kernel", - "netboot2/builddate", - "netboot2/packages", - "netboot2/use" + "boot/kernel" ] self.valid_values=self.required_values[:] - self.valid_values.extend(self.required_values) - self.valid_values.extend(["netboot2/extra_files"]) - + self.valid_values.extend([ + "netboot2/packages", + "netboot2/use", + "netboot2/extra_files", + "netboot2/overlay", + "netboot2/busybox_config" + ]) + try: if addlargs.has_key("netboot2/packages"): if type(addlargs["netboot2/packages"]) == types.StringType: @@ -31,20 +33,9 @@ class netboot2_target(generic_stage_target): except: raise CatalystError,"configuration error in netboot2/packages." - - generic_stage_target.__init__(self,spec,addlargs) self.set_build_kernel_vars() - - # Merge packages into the buildroot, and pick out certain files to place in - # /tmp/image - self.settings["merge_path"]=normpath("/tmp/image") - - 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"]) + self.settings["merge_path"]=normpath("/tmp/image/") def set_target_path(self): self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\ @@ -99,6 +90,17 @@ class netboot2_target(generic_stage_target): touch(self.settings["autoresume_path"]+"copy_files_to_image") + def setup_overlay(self): + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"): + print "Resume point detected, skipping setup_overlay operation..." + else: + if self.settings.has_key("netboot2/overlay"): + for x in self.settings["netboot2/overlay"]: + if os.path.exists(x): + cmd("rsync -a "+x+"/ "+\ + self.settings["chroot_path"], "netboot2/overlay: "+x+" copy failed.",env=self.env) + touch(self.settings["autoresume_path"]+"setup_overlay") def move_kernels(self): # we're done, move the kernels to builds/* @@ -112,13 +114,47 @@ class netboot2_target(generic_stage_target): self.unbind() raise CatalystError,"Failed to move kernel images!" + def remove(self): + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"remove"): + print "Resume point detected, skipping remove operation..." + else: + if self.settings.has_key(self.settings["spec_prefix"]+"/rm"): + for x in self.settings[self.settings["spec_prefix"]+"/rm"]: + # we're going to shell out for all these cleaning operations, + # so we get easy glob handling + print "netboot2: removing " + x + os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x) + + def empty(self): + if self.settings.has_key("AUTORESUME") \ + and os.path.exists(self.settings["autoresume_path"]+"empty"): + print "Resume point detected, skipping empty operation..." + else: + if self.settings.has_key("netboot2/empty"): + if type(self.settings["netboot2/empty"])==types.StringType: + self.settings["netboot2/empty"]=self.settings["netboot2/empty"].split() + for x in self.settings["netboot2/empty"]: + myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x + if not os.path.isdir(myemp): + print x,"not a directory or does not exist, skipping 'empty' operation." + continue + print "Emptying directory", x + # stat the dir, delete the dir, recreate the dir and set + # the proper perms and ownership + mystat=os.stat(myemp) + shutil.rmtree(myemp) + os.makedirs(myemp,0755) + os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) + os.chmod(myemp,mystat[ST_MODE]) + touch(self.settings["autoresume_path"]+"empty") 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"] + "copy_files_to_image","setup_overlay","build_kernel","move_kernels",\ + "remove","empty","unbind","clean","clear_autoresume"] def register(foo): foo.update({"netboot2":netboot2_target}) diff --git a/targets/netboot2/netboot2-controller.sh b/targets/netboot2/netboot2-controller.sh index dc7c64ad..c5ee152a 100644 --- a/targets/netboot2/netboot2-controller.sh +++ b/targets/netboot2/netboot2-controller.sh @@ -14,6 +14,11 @@ case ${1} in ;; pre-kmerge) # Sets up the build environment before any kernels are compiled + if [ -z "${clst_netboot2_busybox_config}" ]; then + cp ${clst_sharedir}/targets/netboot2/nb-busybox.cf ${clst_chroot_path}/tmp/busy-config + else + cp ${clst_netboot2_busybox_config} ${clst_chroot_path}/tmp/busy-config + fi exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh ;; post-kmerge) diff --git a/targets/netboot2/netboot2-copyfile.sh b/targets/netboot2/netboot2-copyfile.sh index b8146d73..66dfd0af 100644 --- a/targets/netboot2/netboot2-copyfile.sh +++ b/targets/netboot2/netboot2-copyfile.sh @@ -18,4 +18,3 @@ do fi fi done -echo "" diff --git a/targets/support/functions.sh b/targets/support/functions.sh index 34bd98b4..7b40afec 100755 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -124,6 +124,11 @@ extract_kernels() { then mv ${1}/initramfs-* ${1}/${x}.igz fi + + if [ -e ${1}/System.map-* ]; + then + mv ${1}/System.map-* ${1}/System.map-${x} + fi done } diff --git a/targets/support/netboot2-final.sh b/targets/support/netboot2-final.sh index 48a67472..2cc9d57c 100755 --- a/targets/support/netboot2-final.sh +++ b/targets/support/netboot2-final.sh @@ -14,6 +14,7 @@ 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 + mv ${clst_target_path}boot/System.map-${x} ${clst_target_path}kernels/misc done rmdir ${clst_target_path}boot @@ -31,7 +32,15 @@ case ${clst_hostarch} in sleep 0 ;; sparc*) - sleep 0 + if [ "${clst_hostarch}" == "sparc" ]; then + piggyback=piggyback + else + piggyback=piggyback64 + fi + for x in ${clst_boot_kernel}; do + elftoaout ${clst_target_path}/kernels/${x} -o ${clst_target_path}${x}-a.out + ${piggyback} ${clst_target_path}/${x}-a.out ${clst_target_path}kernels/misc/System.map-${x} ${clst_target_path}kernels/misc/${x}.igz + done ;; ia64) sleep 0 diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh index b8805e71..a224a231 100755 --- a/targets/support/pre-kmerge.sh +++ b/targets/support/pre-kmerge.sh @@ -34,17 +34,17 @@ case ${clst_target} in # Set the netboot builddate/hostname in linuxrc and copy to proper arch # directory in genkernel - sed -e "s/@@MYDATE@@/${clst_netboot2_builddate}/g" \ + sed -e "s/@@MYDATE@@/$(date '+%Y%m%d')/g" \ -e "s/@@RELVER@@/${clst_version_stamp}/g" \ - ${clst_root_path}usr/share/genkernel/netboot/linuxrc.x \ - > ${clst_root_path}usr/share/genkernel/${clst_hostarch}/linuxrc + /usr/share/genkernel/netboot/linuxrc.x \ + > /usr/share/genkernel/${clst_hostarch}/linuxrc echo ">>> Copying support files to ${clst_root_path} ..." - cp -pPRf ${clst_root_path}usr/share/genkernel/netboot/misc/* \ + cp -pPRf /usr/share/genkernel/netboot/misc/* \ ${clst_merge_path} echo ">>> Copying busybox config ..." - cp -f ${clst_root_path}usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \ - ${clst_root_path}usr/share/genkernel/${clst_hostarch}/busy-config + cp -f /tmp/busy-config \ + /usr/share/genkernel/${clst_hostarch}/busy-config ;; esac