# 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.16 2004/02/11 03:31:55 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.17 2004/02/11 19:12:07 drobbins Exp $
+
+ 11 Feb 2004; Daniel Robbins <drobbins@gentoo.org>: removed file for
+ livecd-stage2 target, as this is handled by the runscript now. Added support
+ for "/boot/kernel/foo/use", "/boot/kernel/foo/packages," and made
+ "/boot/kernel/foo/extraversion" an optional rather than required parameter.
+ The aforementioned "packages" is used to specify kernel-related packages
+ (like module ebuilds) to merge with each kernel, and the new "use" option is
+ used to specify the USE settings you'd like exported to the environment
+ during kernel as well as kernel "packages" build.
10 Feb 2004; John Davis <zhen@gentoo.org> README, TODO, catalyst,
modules/builder.py, modules/catalyst_support.py, modules/targets.py,
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/default-runscript.sh,v 1.12 2004/02/02 04:00:40 brad_mssw Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/examples/livecd/runscript/Attic/default-runscript.sh,v 1.13 2004/02/11 19:12:07 drobbins Exp $
#return codes to be used by archscript
shift
numkernels="$1"
shift
+ $clst_CHROOT $clst_chroot_path /bin/bash << EOF
+ env-update
+ source /etc/profile
+ export CONFIG_PROTECT="-*"
+ [ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
+ emerge genkernel
+ install -d /tmp/binaries
+EOF
+ [ $? -ne 0 ] && exit 1
count=0
while [ $count -lt $numkernels ]
do
clst_kextversion="$1"
shift
$clst_CHROOT $clst_chroot_path /bin/bash << EOF
- # SCRIPT TO BUILD EACH KERNEL. THIS GETS EXECUTED IN CHROOT
- env-update
+ # Script to build each kernel, kernel-related packages
source /etc/profile
- export CONFIG_PROTECT="-*"
- install -d /tmp/binaries
- emerge genkernel
+ [ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
rm -f /usr/src/linux
- emerge -C $clst_ksource
- export USE="-* build"
- if [ -n "${clst_PKGCACHE}" ]
+ [ -e /var/tmp/$clst_kname.use ] && export USE="\$( cat /var/tmp/$clst_kname.use )" || unset USE
+ # Don't use pkgcache here, as the kernel source may get emerge with different USE variables
+ # (and thus different patches enabled/disabled.) Also, there's no real benefit in using the
+ # pkgcache for kernel source ebuilds.
+ emerge --noreplace $clst_ksource || exit 1
+ [ ! -e /usr/src/linux ] && die "Can't find required directory /usr/src/linux"
+ #if catalyst has set NULL_VALUE, extraversion wasn't specified so we skip this part
+ if [ "$clst_kextversion" != "NULL_VALUE" ]
then
- emerge --usepkg --buildpkg --noreplace $clst_ksource || exit 1
- else
- emerge --noreplace $clst_ksource || exit 1
+ # Append Extraversion
+ sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextversion}:" /usr/src/linux/Makefile
fi
- # Append Extraversion
- [ ! -e /usr/src/linux ] && exit 1
- sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextversion}:" /usr/src/linux/Makefile
genkernel ${genkernel_args} --kerneldir=/usr/src/linux --kernel-config=/var/tmp/$clst_kname.config --minkernpackage=/tmp/binaries/$clst_kname.tar.bz2 all || exit 1
- emerge -C genkernel $clst_ksource
- # END OF SCRIPT TO BUILD EACH KERNEL
+ #now we merge any kernel-dependent packages
+ if [ -e /var/tmp/$clst_kname.packages ]
+ then
+ for x in "\$( cat /var/tmp/$clst_kname.packages )"
+ do
+ # we don't want to use the pkgcache for these since the results
+ # are kernel-dependent.
+ emerge "\$x"
+ done
+ fi
+ cd /usr/src/linux
+ #mrproper cleans out the tree and allows full unmerging of all subdirs
+ make mrproper
+ cd /usr/src
+ #now the unmerge...
+ emerge -C $clst_ksource
+ unset USE
EOF
[ $? -ne 0 ] && exit 1
count=$(( $count + 1 ))
done
+ $clst_CHROOT $clst_chroot_path /bin/bash << EOF
+ #cleanup steps
+ source /etc/profile
+ emerge -C genkernel
+ /sbin/depscan.sh
+ find /lib/modules -name modules.dep -exec touch {} \;
+EOF
+ [ $? -ne 0 ] && exit 1
;;
preclean)
rc-update add metalog default
rc-update add modules default
[ -e /etc/init.d/bootsplash ] && rc-update add bootsplash default
- /sbin/depscan.sh
rm -rf /etc/localtime
cp /usr/share/zoneinfo/GMT /etc/localtime
echo "livecd" > /etc/hostname
boot/kernel: gentoo
boot/kernel/gentoo/sources: =sys-kernel/gentoo-dev-sources-2.6.1-r1
boot/kernel/gentoo/config: examples/livecd/x86/config-2.6.1-x86
+#this next line sets any USE settings you want exported to the environment for
+#your kernel build *and* during the build of any kernel-dependent packages
+boot/kernel/gentoo/use: pcmcia
+#use this next option to add an extension to the name of your kernel. This
+#allows you to have 2 identical kernels on the livecd built with different
+#options, and each with their own modules dir in /lib/modules (otherwise
+#the second kernel would overwrite the first modules directory.
boot/kernel/gentoo/extraversion: livecd
+#this next line is for merging kernel-dependent packages after your kernel
+#is built. This is where you merge third-party ebuilds that contain kernel
+#modules.
+boot/kernel/gentoo/packages: =sys-apps/pcmcia-cs-3.2.5-r1
livecd/unmerge:
autoconf automake bin86 binutils libtool m4 bison ld.so make perl patch linux-headers man-pages
sash bison flex gettext texinfo ccache addpatches man groff lib-compat gcc python miscfiles ucl
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/Attic/targets.py,v 1.81 2004/02/11 17:07:57 tigger Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/Attic/targets.py,v 1.82 2004/02/11 19:12:07 drobbins Exp $
import os,string,imp,types,shutil
from catalyst_support import *
class livecd_stage2_target(generic_stage_target):
def __init__(self,spec,addlargs):
self.required_values=["boot/kernel","livecd/cdfstype","livecd/archscript","livecd/runscript"]
+ self.valid_values=[]
if not addlargs.has_key("boot/kernel"):
raise CatalystError, "Required value boot/kernel not specified."
if type(addlargs["boot/kernel"]) == types.StringType:
for x in loopy:
self.required_values.append("boot/kernel/"+x+"/sources")
self.required_values.append("boot/kernel/"+x+"/config")
- self.required_values.append("boot/kernel/"+x+"/extraversion")
- self.valid_values=self.required_values[:]
+ self.valid_values.append("boot/kernel/"+x+"/extraversion")
+ self.valid_values.append("boot/kernel/"+x+"/packages")
+ self.valid_values.append("boot/kernel/"+x+"/use")
+ self.valid_values.extend(self.required_values)
self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm","livecd/unmerge"])
generic_stage_target.__init__(self,spec,addlargs)
file_locate(self.settings, ["livecd/cdtar","livecd/archscript","livecd/runscript"])
mynames=[mynames]
args=[]
args.append(`len(mynames)`)
- for x in mynames:
- args.append(x)
- args.append(self.settings["boot/kernel/"+x+"/sources"])
- if not os.path.exists(self.settings["boot/kernel/"+x+"/config"]):
+ for kname in mynames:
+ args.append(kname)
+ args.append(self.settings["boot/kernel/"+kname+"/sources"])
+ if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
self.unbind()
- raise CatalystError, "Can't find kernel config: "+self.settings["boot/kernel/"+x+"/config"]
+ raise CatalystError, "Can't find kernel config: "+self.settings["boot/kernel/"+kname+"/config"]
# We must support multiple configs for the same kernel, so we must manually edit the
# EXTRAVERSION on the kernel to allow them to coexist. The extraversion field gets appended
# and on PPC64 we need a seperate pSeries, iSeries, and PPC970 (G5) kernels, all compiled off the
# same source, without having to release a seperate livecd for each (since other than the kernel,
# they are all binary compatible)
- args.append(self.settings["boot/kernel/"+x+"/extraversion"])
- retval=os.system("cp "+self.settings["boot/kernel/"+x+"/config"]+" "+self.settings["chroot_path"]+"/var/tmp/"+x+".config")
+ if self.settings.has_key("boot/kernel/"+kname+"/extraversion"):
+ #extraversion is now an optional parameter, so that don't need to worry about it unless
+ #they have to
+ args.append(self.settings["boot/kernel/"+kname+"/extraversion"])
+ else
+ #this value will be detected on the bash side and indicate that EXTRAVERSION processing
+ #should be skipped
+ args.append("NULL_VALUE")
+ #write out /var/tmp/kname.(use|packages) files, used for kernel USE and extra packages settings
+ for extra in ["use","packages"]:
+ if self.settings.has_key("boot/kernel/"+kname+"/"+extra):
+ myex=self.settings["boot/kernel/"+kname+"/"+extra]
+ if type(myex)=ListType:
+ myex=string.join(myex)
+ try:
+ myf=open(self.settings["chroot_path"]+"/var/tmp"+kname+"."+extra,"w")
+ except:
+ self.unbind()
+ raise CatalystError,"Couldn't create file /var/tmp/"+kname+"."+extra+" in chroot."
+ if extra=="use":
+ myf.write("export USE=\""+myex+"\"\n")
+ else:
+ myf.write(myex+"\n")
+ myf.close
+
+ retval=os.system("cp "+self.settings["boot/kernel/"+kname+"/config"]+" "+self.settings["chroot_path"]+"/var/tmp/"+kname+".config")
if retval!=0:
self.unbind()
- raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+x+"/config"]
+ raise CatalystError, "Couldn't copy kernel config: "+self.settings["boot/kernel/"+kname+"/config"]
try:
cmd("/bin/bash "+self.settings["livecd/runscript"]+" kernel "+list_bashify(args),"runscript kernel build failed")
cmd("/bin/bash "+self.settings["livecd/runscript"]+" bootloader","bootloader runscript failed.")
except CatalystError:
self.unbind()
- raise CatalystError,"livecd-stage2 build aborting due to error."
+ raise CatalystError,"runscript aborting due to error."
def register(foo):
foo.update({"stage1":stage1_target,"stage2":stage2_target,"stage3":stage3_target,
+++ /dev/null
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/Attic/livecd-stage2.sh,v 1.5 2004/02/11 03:31:55 zhen Exp $
-
-case $1 in
-enter)
- $clst_CHROOT $clst_chroot_path
- ;;
-run)
- shift
- numkernels="$1"
- shift
- count=0
- while [ $count -lt $numkernels ]
- do
- clst_kname="$1"
- shift
- clst_ksource="$1"
- shift
- $clst_CHROOT $clst_chroot_path /bin/bash << EOF
- env-update
- source /etc/profile
- if [ -n "${clst_ENVSCRIPT}" ]
- then
- source /tmp/envscript
- rm -f /tmp/envscript
- fi
- export CONFIG_PROTECT="-*"
- emerge genkernel
- rm -f /usr/src/linux
- export USE="-* build"
- if [ -n "${clst_PKGCACHE}" ]
- then
- emerge --usepkg --buildpkg --noreplace $clst_ksource || exit 1
- else
- emerge --noreplace $clst_ksource || exit 1
- fi
- genkernel --no-bootsplash --kerneldir=/usr/src/linux --kernel-config=/var/tmp/$clst_kname.config --minkernpackage=/tmp/binaries/$clst_kname.tar.bz2 all || exit 1
- emerge -C genkernel $clst_ksource
-EOF
- [ $? -ne 0 ] && exit 1
- count=$(( $count + 1 ))
- done
- ;;
-*)
- exit 1
- ;;
-esac
-exit 0