From c6351704e6dce4bc146c7aec0d5119fd6901068f Mon Sep 17 00:00:00 2001 From: "John P. Davis" Date: Tue, 23 Nov 2004 00:02:57 +0000 Subject: [PATCH] fixes for bugs #49819 and #71033. Partial fix for #67289 git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@484 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 10 +++++- modules/embedded_target.py | 31 ++++++++++------- modules/generic_stage_target.py | 4 +-- targets/embedded/cramfs-runscript.sh | 25 -------------- targets/embedded/embedded-fs-runscript.sh | 42 +++++++++++++++++++++++ targets/livecd-stage2/unmerge.sh | 4 +-- targets/stage1/stage1-chroot.sh | 4 +-- targets/stage2/stage2-chroot.sh | 4 +-- targets/stage3/stage3-chroot.sh | 4 +-- 9 files changed, 80 insertions(+), 48 deletions(-) delete mode 100644 targets/embedded/cramfs-runscript.sh create mode 100644 targets/embedded/embedded-fs-runscript.sh diff --git a/ChangeLog b/ChangeLog index a973a0fa..7056fcf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.113 2004/11/19 18:19:23 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.114 2004/11/23 00:02:56 zhen Exp $ + + 22 Nov 2004; John Davis modules/embedded_target.py, + modules/generic_stage_target.py, -targets/embedded/cramfs-runscript.sh, + +targets/embedded/embedded-fs-runscript.sh, + targets/livecd-stage2/unmerge.sh, targets/stage1/stage1-chroot.sh, + targets/stage2/stage2-chroot.sh, targets/stage3/stage3-chroot.sh: + fixes for bugs #49819 and #71033. Partial fix for #67289 - waiting on a patch + from mutex@gentoo.org for modules/embedded.py 19 Nov 2004; Chris Gianelloni livecd/files/gamecd-xinitrc, livecd/runscript-support/gamecdfs-update.sh, diff --git a/modules/embedded_target.py b/modules/embedded_target.py index 84a5c6d0..68a69245 100644 --- a/modules/embedded_target.py +++ b/modules/embedded_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.2 2004/10/15 02:27:58 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.3 2004/11/23 00:02:57 zhen Exp $ """ This class works like a 'stage3'. A stage2 tarball is unpacked, but instead @@ -8,7 +8,7 @@ of building a stage3, it emerges a 'system' into another directory inside the 'stage2' system. This way we do not have to emerge gcc/portage into the staged system. -It sounds real complicated but basically it's a it runs +It sounds real complicated but basically it runs ROOT=/tmp/submerge emerge --blahblah foo bar """ @@ -22,8 +22,10 @@ class embedded_target(generic_stage_target): def __init__(self,spec,addlargs): self.required_values=[] self.valid_values=[] - #self.required_values.extend(["embedded/packages"]); - self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/runscript","embedded/mergeroot","embedded/packages","embedded/use"]) + self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/runscript","embedded/mergeroot","embedded/packages","embedded/use","embedded/fstype"]) + + if addlargs.has_key("embedded/fstype"): + self.valid_values.append("embedded/fsops") generic_stage_target.__init__(self,spec,addlargs) self.settings["image_path"]=self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/image" @@ -50,6 +52,16 @@ class embedded_target(generic_stage_target): for x in self.settings["embedded/rm"]: print "Removing "+x os.system("rm -rf "+self.settings["chroot_path"]+"/tmp/mergeroot"+x) + + def build_fs(self): + try: + if self.settings.has_key("embedded/fstype"): + cmd("/bin/bash "+self.settings["sharedir"]+"/targets/embedded/embedded.sh package","filesystem packaging failed") + except CatalystError: + self.unbind() + raise CatalystError, "embedded filesystem created aborting due to error." + + def run_local(self): mypackages=list_bashify(self.settings["embedded/packages"]) print "Merging embedded image" @@ -60,13 +72,8 @@ class embedded_target(generic_stage_target): raise CatalystError, "Embedded build aborted due to error." self.unmerge() self.clean() - try: - if self.settings.has_key("embedded/runscript"): - cmd("/bin/bash "+self.settings["embedded/runscript"]+" run ","runscript failed") - except CatalystError: - self.unbind() - raise CatalystError, "embedded runscript aborting due to error." + self.build_fs() def register(foo): - foo.update({"embedded":embedded_target}) - return foo + foo.update({"embedded":embedded_target}) + return foo diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 57dfdbcd..382fc783 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.16 2004/10/15 02:27:58 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.17 2004/11/23 00:02:57 zhen Exp $ """ This class does all of the chroot setup, copying of files, etc. It is @@ -57,7 +57,7 @@ class generic_stage_target(generic_target): "mips" : "mips", "mips64" : "mips", "arm" : "arm", - "arm" : "armv4l" + "armv4l" : "arm" } mymachine=os.uname()[4] diff --git a/targets/embedded/cramfs-runscript.sh b/targets/embedded/cramfs-runscript.sh deleted file mode 100644 index 897963b4..00000000 --- a/targets/embedded/cramfs-runscript.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright david@futuretel.com -# puts a the embedded image into a cramfs - -root_fs_path="${clst_chroot_path}/tmp/mergeroot" - -die() { - echo "$1" - exit 1 -} - -case $1 in - run) - install -d $clst_image_path - mkcramfs $root_fs_path $clst_image_path/root.img - imagesize=`du -sk $clst_image_path/root.img | cut -f1` - echo "Created cramfs image at ${clst_image_path}/root.img" - echo "Image size: ${imagesize}k" - ;; - - preclean) - ;; - -esac -exit 0 diff --git a/targets/embedded/embedded-fs-runscript.sh b/targets/embedded/embedded-fs-runscript.sh new file mode 100644 index 00000000..36c3e139 --- /dev/null +++ b/targets/embedded/embedded-fs-runscript.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +die() { + echo "$1" + exit 1 +} + +# 1 = mkfs path, 2 = fs name, 3 = pkg name +fs_check() { + if [ ! -e ${1} ]; then + die "You must install ${3} in order to produce ${2} images" + fi +} + +case $1 in + jffs) + fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd + mkfs.jffs -d ${root_fs_path} -o ${clst_image_path}/root.img \ + ${clst_embedded_fsops} || die "Could not create a jffs filesystem" + ;; + jffs2) + fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd + mkfs.jffs2 --root=${root_fs_path} --output=${clst_image_path}/root.img\ + ${clst_embedded_fsops} || die "Could not create a jffs2 filesystem" + ;; + + cramfs) + fs_check /sbin/mkcramfs cramfs sys-fs/cramfs + mkcramfs ${clst_embedded_fsops} ${root_fs_path} \ + ${clst_image_path}/root.img || die "Could not create a cramfs filesystem" + ;; + + squashfs) + fs_check /usr/sbin/mksquashfs squashfs sys-fs/squashfs-tools + mksquashfs ${root_fs_path} ${clst_image_path}/root.img \ + ${clst_embedded_fsops} || die "Could not create a squashfs filesystem" + ;; + *) + ;; +esac diff --git a/targets/livecd-stage2/unmerge.sh b/targets/livecd-stage2/unmerge.sh index 8ef99809..74842472 100644 --- a/targets/livecd-stage2/unmerge.sh +++ b/targets/livecd-stage2/unmerge.sh @@ -1,8 +1,8 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/Attic/unmerge.sh,v 1.5 2004/10/22 04:23:16 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/livecd-stage2/Attic/unmerge.sh,v 1.6 2004/11/23 00:02:57 zhen Exp $ -$clst_CHROOT $clst_chroot_path /bin/bash << EOF +${clst_CHROOT} ${clst_chroot_path} /bin/bash << EOF EMERGE_WARNING_DELAY=0 emerge -C $* EOF exit 0 diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh index 5f099308..c756c8ac 100755 --- a/targets/stage1/stage1-chroot.sh +++ b/targets/stage1/stage1-chroot.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.24 2004/10/15 02:46:58 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.25 2004/11/23 00:02:57 zhen Exp $ /usr/sbin/env-update source /etc/profile @@ -34,7 +34,7 @@ install -d ${ROOT} ## START BUILD export clst_buildpkgs="$(/tmp/build.py)" -STAGE1_USE="$(source /etc/make.profile/make.defaults ; echo ${STAGE1_USE})" +STAGE1_USE="$(portageq envvar STAGE1_USE)" # duplicate line to below - why is this here?? #USE="-* build ${STAGE1_USE}" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1 diff --git a/targets/stage2/stage2-chroot.sh b/targets/stage2/stage2-chroot.sh index 89799bd5..48b4115c 100755 --- a/targets/stage2/stage2-chroot.sh +++ b/targets/stage2/stage2-chroot.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.8 2004/10/15 02:46:58 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.9 2004/11/23 00:02:57 zhen Exp $ /usr/sbin/env-update source /etc/profile @@ -27,7 +27,7 @@ then export bootstrap_opts="-r" fi -GRP_STAGE23_USE="$(source /etc/make.profile/make.defaults ; echo ${GRP_STAGE23_USE})" +GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)" ## setup the environment diff --git a/targets/stage3/stage3-chroot.sh b/targets/stage3/stage3-chroot.sh index d4a26598..90f9d8e4 100755 --- a/targets/stage3/stage3-chroot.sh +++ b/targets/stage3/stage3-chroot.sh @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.12 2004/10/15 02:46:58 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.13 2004/11/23 00:02:57 zhen Exp $ /usr/sbin/env-update source /etc/profile @@ -27,7 +27,7 @@ then export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg --newuse" fi -GRP_STAGE23_USE="$(source /etc/make.profile/make.defaults ; echo ${GRP_STAGE23_USE})" +GRP_STAGE23_USE="$(portageq envvar GRP_STAGE23_USE)" # setup the build environment export FEATURES="${clst_myfeatures}" -- 2.26.2