# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 12 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+ -examples/netboot_template.spec, -modules/catalyst/target/netboot.py,
+ -targets/netboot/netboot-chroot.sh, -targets/netboot/netboot-combine.sh,
+ -targets/netboot/netboot-controller.sh, -targets/netboot/netboot-image.sh:
+ Whack the outdated and non-functional netboot target
+
12 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
modules/catalyst/__init__.py, modules/catalyst/arch/__init__.py,
modules/catalyst/arch/alpha.py, modules/catalyst/arch/arm.py,
+++ /dev/null
-# generic netboot image specfile
-# used to build a network bootable image
-
-# The subarch can be any of the supported catalyst subarches (like athlon-xp).
-# Refer to the catalyst reference manual for suppurted subarches.
-# http://www.gentoo.org/proj/en/releng/catalyst/
-# example:
-# subarch: athlon-xp
-subarch:
-
-# The version stamp is an identifier for the build. It can be anything you wish# it to be, but it is usually a date.
-# example:
-# version_stamp: 2006.1
-version_stamp:
-
-# The target specifies what target we want catalyst to do. For building a
-# netboot image, we use the netboot target.
-# example:
-# target: netboot
-target:
-
-# The rel_type defines what kind of build we are doing. This is merely another
-# identifier, but it useful for allowing multiple concurrent builds. Usually,
-# default will suffice.
-# example:
-# rel_type: default
-rel_type:
-
-# This is the system profile to be used by catalyst to build this target. It is# specified as a relative path from /usr/portage/profiles.
-# example:
-# profile: default-linux/x86/2006.1
-profile:
-
-# This specifies which snapshot to use for building this target.
-# example:
-# snapshot: 2006.1
-snapshot:
-
-# This specifies where the seed stage comes from for this target, The path is
-# relative to $clst_sharedir/builds. The rel_type is also used as a path prefix# for the seed.
-# example:
-# default/stage3-x86-2006.1
-source_subpath:
-
-# These are the hosts used as distcc slaves when distcc is enabled in your
-# catalyst.conf. It follows the same syntax as distcc-config --set-hosts and
-# is entirely optional.
-# example:
-# distcc_hosts: 127.0.0.1 192.168.0.1
-distcc_hosts:
-
-# This is an optional directory containing portage configuration files. It
-# follows the same syntax as /etc/portage and should be consistent across all
-# targets to minimize problems.
-# example:
-# portage_confdir: /etc/portage
-portage_confdir:
-
-# This option specifies the location to a portage overlay that you would like to
-# have used when building this target.
-# example:
-# portage_overlay: /usr/local/portage
-portage_overlay:
-
-# This allows the optional directory containing the output packages for
-# catalyst. Mainly used as a way for different spec files to access the same
-# cache directory. Default behavior is for this location to be autogenerated
-# by catalyst based on the spec file.
-# example:
-# pkgcache_path: /tmp/packages
-pkgcache_path:
-
-# This allows the optional directory containing the output packages for kernel
-# builds. Mainly used as a way for different spec files to access the same
-# cache directory. Default behavior is for this location to be autogenerated
-# by catalyst based on the spec file.
-# example:
-# kerncache_path: /tmp/kernel
-kerncache_path:
-
-# This option tells catalyst which kernel sources to merge for building this
-# image. This can use normal portage atoms to specify a specific version.
-# example:
-# netboot/kernel/sources: gentoo-sources
-netboot/kernel/sources:
-
-# This option is the full path and filename to a kernel .config file that is
-# used by genkernel to compile the kernel for this image.
-# example:
-# netboot/kernel/config: /tmp/2.6.11-netboot.config
-netboot/kernel/config:
-
-# This option sets the USE flags used to build the kernel. These USE flags are
-# additive from the default USE for the specified profile.
-# example:
-# netboot/kernel/use: ultra1
-netboot/kernel/use:
-
-# This option sets the USE flags with which the optional packages below are
-# built. Like the kernel USE, they are additive.
-# example:
-# netboot/use:
-netboot/use:
-
-# The netboot target builds busybox for its root filesystem. This option is
-# where you specify the full path and filename to your busybox configuration.
-# example
-# netboot/busybox_config: /tmp/busybox.config
-netboot/busybox_config:
-
-# This is the full path and filename to the tarball to use as the base for the
-# netboot image.
-# example:
-# netboot/base_tarball: /usr/lib/catalyst/netboot/netboot-base.tar.bz2
-netboot/base_tarball:
-
-# These are the packages that will be built for your netboot image using the USE
-# flags set in netboot/use. These package names are also labels used later when
-# determining what files to copy into your netboot image.
-# example:
-# netboot/packages: raidtools xfsprogs e2fsprogs reiserfsprogs
-
-# This is where you tell catalyst which files from each package to copy into the
-# netboot image.
-# example:
-# netboot/packages/raidtools/files: /sbin/raidstart /sbin/mkraid /sbin/detect_multipath /sbin/raidreconf /sbin/raidstop /sbin/raidhotadd /sbin/raidhotremove /sbin/raidsetfaulty /sbin/raid0run
-netboot/packages/raidtools/files:
-
-# Here is the same thing for xfsprogs.
-# example:
-# netboot/packages/xfsprogs/files: /sbin/mkfs.xfs /sbin/xfs_repair /bin/xfs_check
-netboot/packages/xfsprogs/files:
-
-# Here is the same thing for e2fsprogs.
-# example:
-# netboot/packages/e2fsprogs/files: /sbin/mke2fs
-netboot/packages/e2fsprogs/files:
-
-# Here is the same thing for reiserfsprogs.
-# example:
-# netboot/packages/reiserfsprogs/files: /sbin/mkreiserfs
-netboot/packages/reiserfsprogs/files:
-
-# This is a list of any other files, not belonging to the above packages, that
-# you would wish to have copied into your netboot image.
-# example:
-# netboot/extra_files: /lib/libresolv.so.2 /lib/libnss_compat.so.2 /lib/libnss_dns.so.2 /lib/libnss_files.so.2 /sbin/consoletype
-netboot/extra_files:
-
+++ /dev/null
-
-"""
-Builder class for a netboot build.
-"""
-
-import os,string,types
-from catalyst.support import *
-from generic_stage import *
-import catalyst.util
-from catalyst.error import *
-from catalyst.spawn import *
-
-class netboot_target(generic_stage_target):
- def __init__(self,spec,addlargs):
- self.valid_values = [
- "netboot/kernel/sources",
- "netboot/kernel/config",
- "netboot/kernel/prebuilt",
-
- "netboot/busybox_config",
-
- "netboot/extra_files",
- "netboot/packages"
- ]
- self.required_values=[]
-
- try:
- if "netboot/packages" in addlargs:
- 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")
- except:
- raise CatalystError,"configuration error in netboot/packages."
-
-
-
-
- generic_stage_target.__init__(self,spec,addlargs)
- self.set_build_kernel_vars()
- if "netboot/busybox_config" in addlargs:
- catalyst.util.file_locate(self.settings, ["netboot/busybox_config"])
-
- # Custom Kernel Tarball --- use that instead ...
-
- # unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os
-
- for envvar in "CFLAGS", "CXXFLAGS":
- if not envvar in os.environ and not envvar in addlargs:
- self.settings[envvar] = "-Os -pipe"
-
-
- def set_root_path(self):
- # ROOT= variable for emerges
- self.settings["root_path"]=catalyst.util.normpath("/tmp/image")
- print "netboot root path is "+self.settings["root_path"]
-
-# def build_packages(self):
-# # build packages
-# if "netboot/packages" in self.settings:
-# mypack = catalyst.util.list_bashify(self.settings["netboot/packages"])
-# try:
-# cmd("/bin/bash "+self.settings["controller_file"]+" packages "+mypack,env=self.env)
-# except CatalystError:
-# self.unbind()
-# raise CatalystError,"netboot build aborting due to error."
-
- def build_busybox(self):
- # build busybox
- if "netboot/busybox_config" in self.settings:
- mycmd = self.settings["netboot/busybox_config"]
- else:
- mycmd = ""
- try:
- cmd("/bin/bash "+self.settings["controller_file"]+" busybox "+ mycmd,env=self.env)
- except CatalystError:
- self.unbind()
- raise CatalystError,"netboot build aborting due to error."
-
-
- def copy_files_to_image(self):
- # create image
- myfiles=[]
- if "netboot/packages" in self.settings:
- if type(self.settings["netboot/packages"]) == types.StringType:
- loopy=[self.settings["netboot/packages"]]
- else:
- loopy=self.settings["netboot/packages"]
-
- for x in loopy:
- if "netboot/packages/"+x+"/files" in self.settings:
- if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType:
- myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
- else:
- myfiles.append(self.settings["netboot/packages/"+x+"/files"])
-
- if "netboot/extra_files" in self.settings:
- if type(self.settings["netboot/extra_files"]) == types.ListType:
- myfiles.extend(self.settings["netboot/extra_files"])
- else:
- myfiles.append(self.settings["netboot/extra_files"])
-
- try:
- cmd("/bin/bash "+self.settings["controller_file"]+\
- " image " + catalyst.util.list_bashify(myfiles),env=self.env)
- except CatalystError:
- self.unbind()
- raise CatalystError,"netboot build aborting due to error."
-
-
- def create_netboot_files(self):
- # finish it all up
- try:
- cmd("/bin/bash "+self.settings["controller_file"]+" finish",env=self.env)
- except CatalystError:
- self.unbind()
- raise CatalystError,"netboot build aborting due to error."
-
- # end
- print "netboot: build finished !"
-
-
- def set_action_sequence(self):
- self.settings["action_sequence"]=["unpack","unpack_snapshot",
- "config_profile_link","setup_confdir","bind","chroot_setup",\
- "setup_environment","build_packages","build_busybox",\
- "build_kernel","copy_files_to_image",\
- "clean","create_netboot_files","unbind","clear_autoresume"]
-
-__target_map = {"netboot":netboot_target}
+++ /dev/null
-#!/bin/bash
-
-source /tmp/chroot-functions.sh
-
-# START BUILD
-run_merge "${clst_packages}"
+++ /dev/null
-#!/bin/bash
-
-. ${clst_sharedir}/targets/support/chroot-functions.sh
-. ${clst_sharedir}/targets/support/functions.sh
-. ${clst_sharedir}/targets/support/filesystem-functions.sh
-
-update_env_settings
-
-setup_myfeatures
-
-# Ssetup our environment
-export FEATURES="${clst_myfeatures}"
-
-# First install the boot package that we need
-booter=""
-case ${clst_hostarch} in
- alpha)
- booter=""
- ;;
- arm)
- booter=""
- ;;
- hppa)
- booter=palo
- ;;
- sparc*)
- booter=sparc-utils
- ;;
- x86|amd64)
- booter=netboot
- ;;
- *)
- exit 1
- ;;
-esac
-
-#if [ ! -z "${booter}" ] ; then
-# run_merge ${booter} || exit 1
-#fi
-
-extract_kernels ${clst_chroot_path}/tmp
-
-# Then generate the netboot image ! :D
-for kname in ${clst_boot_kernel}
-do
- mkdir -p ${clst_chroot_path}/tmp/staging/initrd-${kname}
- cp -r ${clst_chroot_path}/tmp/image ${clst_chroot_path}/tmp/staging/initrd-${kname}
- extract_modules ${clst_chroot_path}/tmp/staging/initrd-${kname} ${kname}
- create_normal_loop ${clst_chroot_path}/tmp/staging/initrd-${kname} ${clst_target_path} initrd-${kname}.igz
- rm -r ${clst_chroot_path}/tmp/staging/initrd-${kname}
-
- case ${clst_hostarch} in
- alpha)
- # Until aboot is patched this is broken currently.
- # please use catalyst 1.1.5 or older
-
- #TEST TEST TEST TEST
- #http://lists.debian.org/debian-alpha/2004/07/msg00094.html
- #make \
- # -C /usr/src/linux \
- # INITRD=/initrd.gz \
- # HPATH="/usr/src/linux/include" \
- # vmlinux bootpfile \
- # || exit 1
- #cp /usr/src/linux/arch/alpha/boot/bootpfile /netboot.alpha || exit 1
- ;;
- arm)
- #TEST TEST TEST TEST
- cp /${clst_chroot_path}/tmp/${kname} /netboot-${kname}.arm || exit 1
- cat /${clst_target_path}/initrd-${kname}.igz >> /${clst_target_path}/netboot-${kname}.arm || exit 1
- #make \
- # -C /usr/src/linux \
- # INITRD=/initrd.gz \
- # bootpImage \
- # || exit 1
- ;;
- hppa)
- # We have to remove the previous image because the file is
- # considered as a tape by palo and then not truncated but rewritten.
- #TEST TEST TEST TEST
- rm -f /netboot-${kname}.hppa
-
- palo \
- -k /${clst_chroot_path}/tmp/${kname} \
- -r /${clst_target_path}/initrd-${kname}.igz \
- -s /${clst_target_path}/netboot-${kname}.hppa \
- -f foo \
- -b /usr/share/palo/iplboot \
- -c "0/vmlinux root=/dev/ram0 ${cmdline_opts}" \
- || exit 1
- ;;
- sparc*)
- #TEST TEST TEST TEST
- #elftoaout -o /netboot-${kname}.${clst_hostarch} /usr/src/linux/vmlinux
- #elftoaout -o /netboot-${kname}.${clst_hostarch} /${kname}
- #piggy=${clst_hostarch/sparc/piggyback}
- #${piggy} /netboot-${kname}.${clst_hostarch} /usr/src/linux/System.map /initrd-${kname}.igz
- ;;
- x86)
- mknbi-linux \
- -k /${clst_chroot_path}/tmp/${kname} \
- -r /${clst_target_path}/initrd-${kname}.igz \
- -o /${clst_target_path}/netboot-${kname}.x86 \
- -x \
- -a "root=/dev/ram0 ${cmdline_opts}" \
- || exit 1
- ;;
- *)
- exit 1
- ;;
- esac
-done
+++ /dev/null
-#!/bin/bash
-
-. ${clst_sharedir}/targets/support/functions.sh
-. ${clst_sharedir}/targets/support/filesystem-functions.sh
-
-
-case ${1} in
- #### Couldnt busybox step be in packages ....
- build_packages)
- shift
- clst_root_path="/" \
- clst_packages="$*" \
- exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
- ;;
- busybox)
- # Custom busybox config support
- if [ -f "${clst_netboot_busybox_config}" ]
- then
- mkdir -p ${clst_chroot_path}/etc/busybox/${clst_CHOST}
- cp -v ${clst_netboot_busybox_config} \
- ${clst_chroot_path}/etc/busybox/${clst_CHOST}/busybox.config
- clst_use="savedconfig"
- fi
-
- # Main Busybox emerge
- clst_root_path="/" \
- clst_use="${clst_use} netboot make-busybox-symlinks" \
- clst_myemergeopts="${clst_myemergeopts} -O" \
- clst_packages="busybox" \
- exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.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"
- export clst_root_path="/"
- #exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
- #exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
- #exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
- #extract_kernels kernels
- ;;
- image)
- #Creates the base initrd image for the netboot
- shift
- # Could this step be a parameter in case there is a different
- # baselayout to add???
- clst_myemergeopts="${clst_myemergeopts} --nodeps" \
- clst_packages="netboot-base" \
- exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
-
- clst_files="${@}" \
- exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-image.sh
- ;;
- finish)
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-combine.sh
- ;;
- clean)
- exit 0;;
- *)
- exit 1;;
-esac
-
-exit $?
+++ /dev/null
-#!/bin/bash
-
-source /tmp/chroot-functions.sh
-
-update_env_settings
-
-echo "Copying files to ${clst_root_path}"
-clst_files="/bin/busybox ${clst_files} "
-for f in ${clst_files}
-do
- copy_file ${f}
-done
-echo "Done copying files"