Index: modules/netboot2_target.py =================================================================== --- modules/netboot2_target.py (revision 1224) +++ modules/netboot2_target.py (working copy) @@ -10,15 +10,16 @@ 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" + ]) + try: if addlargs.has_key("netboot2/packages"): if type(addlargs["netboot2/packages"]) == types.StringType: @@ -31,21 +32,10 @@ except: raise CatalystError,"configuration error in netboot2/packages." - - generic_stage_target.__init__(self,spec,addlargs) self.set_build_kernel_vars() + self.settings["merge_path"]=normpath("/tmp/image/") - # 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"]) - def set_target_path(self): self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\ self.settings["target_subpath"]+"/") @@ -99,6 +89,17 @@ 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 +113,47 @@ 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}) Index: targets/netboot2/netboot2-copyfile.sh =================================================================== --- targets/netboot2/netboot2-copyfile.sh (revision 1224) +++ targets/netboot2/netboot2-copyfile.sh (working copy) @@ -18,4 +18,3 @@ fi fi done -echo "" Index: targets/support/functions.sh =================================================================== --- targets/support/functions.sh (revision 1224) +++ targets/support/functions.sh (working copy) @@ -124,6 +124,11 @@ then mv ${1}/initramfs-* ${1}/${x}.igz fi + + if [ -e ${1}/System.map-* ]; + then + mv ${1}/System.map-* ${1}/System.map-${x} + fi done } Index: targets/support/netboot2-final.sh =================================================================== --- targets/support/netboot2-final.sh (revision 1224) +++ targets/support/netboot2-final.sh (working copy) @@ -14,6 +14,7 @@ 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,10 @@ sleep 0 ;; sparc*) - sleep 0 + for x in ${clst_boot_kernel}; do + elftoaout ${clst_target_path}/kernels/${x} -o ${clst_target_path}${x}-a.out + piggyback64 ${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 Index: targets/support/pre-kmerge.sh =================================================================== --- targets/support/pre-kmerge.sh (revision 1224) +++ targets/support/pre-kmerge.sh (working copy) @@ -29,17 +29,19 @@ # 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 /usr/share/genkernel/${clst_hostarch}/nb-busybox.cf \ + /usr/share/genkernel/${clst_hostarch}/busy-config ;; esac