public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] stage4 kernel config for genkernel?
@ 2013-02-09 12:15 W. Trevor King
  2013-02-09 12:56 ` Chris White
  0 siblings, 1 reply; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 12:15 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]

The handbook steps for setting up genkernel are [1]:

  # emerge gentoo-sources genkernel
  # genkernel --menuconfig all  # optional
  # genkernel all

If you stay conservative (e.g. ext2/3 boot partition), there's no need
for the menuconfig step.  However, when I try and build a stage4
using:

  # cat default-stage4-i686-2013.1.spec
  …
  boot/kernel: gentoo
  boot/kernel/gentoo/sources: gentoo-sources
  # catalyst -f spec/default-stage4-i686-2013.1.spec

I get:

  /proc is still mounted; performing auto-bind-umount... Auto-unbind successful...
  Traceback (most recent call last):
  File "/usr/lib/catalyst/catalyst", line 214, in build_target
      mytarget.run()
  File "modules/generic_stage_target.py", line 1290, in run
      apply(getattr(self,x))
  File "modules/generic_stage_target.py", line 1420, in build_kernel
      if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
  KeyError: 'boot/kernel/gentoo/config'
  !!! catalyst: Error encountered during run of target stage4

What's changed?  Why do I need to seed catalyst with a config file,
when I don't need to from the handbook instructions?  Maybe this usage
is just unimplemented because nobody has needed it yet?

Thanks,
Trevor

[1]: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7#doc_chap4

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-catalyst] stage4 kernel config for genkernel?
  2013-02-09 12:15 [gentoo-catalyst] stage4 kernel config for genkernel? W. Trevor King
@ 2013-02-09 12:56 ` Chris White
  2013-02-09 13:18   ` W. Trevor King
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
  0 siblings, 2 replies; 12+ messages in thread
From: Chris White @ 2013-02-09 12:56 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

> What's changed?  Why do I need to seed catalyst with a config file,
> when I don't need to from the handbook instructions?  Maybe this usage
> is just unimplemented because nobody has needed it yet?
>
> Thanks,
> Trevor
>
> [1]:
> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7#doc_chap4
>

It's a TODO[1] right now. Personally though I recommend setting up a config
manually, as it's a lot easier to debug kernel setup related issues when
you're the one who configured everything and not genkernel.

[1] http://preview.tinyurl.com/axt5ycz

- Chris

[-- Attachment #2: Type: text/html, Size: 1081 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-catalyst] stage4 kernel config for genkernel?
  2013-02-09 12:56 ` Chris White
@ 2013-02-09 13:18   ` W. Trevor King
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
  1 sibling, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 13:18 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

On Sat, Feb 09, 2013 at 04:56:43AM -0800, Chris White wrote:
> It's a TODO[1] right now.

Ah, thanks.

> Personally though I recommend setting up a config manually, as it's
> a lot easier to debug kernel setup related issues when you're the
> one who configured everything and not genkernel.

I configure my own kernels for my personal boxes, but I'm looking to
use Catalyst to build bootable USB sticks for teaching.  If a student
shows up with a borked system, I just want to hand them a USB stick
and say, “Boot this for class today, and we'll sort out your native
installation problems later”.  I think genkernel has a better shot
when I have no idea what hardware will be on the target machine (and
likely, neither does the student ;).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional
  2013-02-09 12:56 ` Chris White
  2013-02-09 13:18   ` W. Trevor King
@ 2013-02-09 20:45   ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel() W. Trevor King
                       ` (5 more replies)
  1 sibling, 6 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

On Sat, Feb 09, 2013 at 04:56:43AM -0800, Chris White wrote:
> > What's changed?  Why do I need to seed catalyst with a config file,
> > when I don't need to from the handbook instructions?  Maybe this usage
> > is just unimplemented because nobody has needed it yet?
> > …
>
> It's a TODO[1] right now. Personally though I recommend setting up a config
> manually, as it's a lot easier to debug kernel setup related issues when
> you're the one who configured everything and not genkernel.

Now it's done ;).  I tested it today, and genkernel (unsurprisingly),
built its kernel fine without a seed config.

W. Trevor King (6):
  generic_stage_target: Split ._build_kernel() out of .build_kernel()
  generic_stage_target: Split ._copy_kernel_config() from
    ._build_kernel()
  generic_stage_target.py: Dedent the bulk of ._build_kernel()
  generic_stage_target: Split ._copy_initramfs_overlay() from
    ._build_kernel()
  generic_stage_target: Handle unspecified boot/kernel/<kname>/config
  kmerge.sh: Make /var/tmp/${clst_kname}.config optional

 modules/generic_stage_target.py | 198 ++++++++++++++++++++--------------------
 targets/support/kmerge.sh       |  21 +++--
 2 files changed, 114 insertions(+), 105 deletions(-)

-- 
1.8.1.336.g94702dd



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel()
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 2/6] generic_stage_target: Split ._copy_kernel_config() from ._build_kernel() W. Trevor King
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

The indentation was getting too deep ;).  This also makes the
single-kernel-building code more digestible, by removing the
multiple-kernel looping and error handling from the function you're
reading.
---
 modules/generic_stage_target.py | 196 ++++++++++++++++++++--------------------
 1 file changed, 99 insertions(+), 97 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 952fa4b..af7cbe7 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1395,6 +1395,7 @@ class generic_stage_target(generic_target):
 							"build aborting due to error."
 
 	def build_kernel(self):
+		"Build all configured kernels"
 		if "AUTORESUME" in self.settings \
 			and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
 			print "Resume point detected, skipping build_kernel operation..."
@@ -1410,110 +1411,111 @@ class generic_stage_target(generic_target):
 					cmd("/bin/bash "+self.settings["controller_file"]+\
 						" pre-kmerge ","Runscript pre-kmerge failed",\
 						env=self.env)
-
 					for kname in mynames:
-						if "AUTORESUME" in self.settings \
-							and os.path.exists(self.settings["autoresume_path"]\
-								+"build_kernel_"+kname):
-							print "Resume point detected, skipping build_kernel for "+kname+" operation..."
-						else: # TODO: make this not require a kernel config
-							try:
-								if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
-									self.unbind()
-									raise CatalystError,\
-										"Can't find kernel config: "+\
-										self.settings["boot/kernel/"+kname+\
-										"/config"]
-
-							except TypeError:
-								raise CatalystError,\
-									"Required value boot/kernel/config not specified"
-
-							try:
-								cmd("cp "+self.settings["boot/kernel/"+kname+\
-									"/config"]+" "+\
-									self.settings["chroot_path"]+"/var/tmp/"+\
-									kname+".config",\
-									"Couldn't copy kernel config: "+\
-									self.settings["boot/kernel/"+kname+\
-									"/config"],env=self.env)
-
-							except CatalystError:
-								self.unbind()
-
-							"""
-							If we need to pass special options to the bootloader
-							for this kernel put them into the environment
-							"""
-							if "boot/kernel/"+kname+"/kernelopts" in self.settings:
-								myopts=self.settings["boot/kernel/"+kname+\
-									"/kernelopts"]
-
-								if type(myopts) != types.StringType:
-									myopts = string.join(myopts)
-									self.env[kname+"_kernelopts"]=myopts
-
-								else:
-									self.env[kname+"_kernelopts"]=""
-
-							if "boot/kernel/"+kname+"/extraversion" not in self.settings:
-								self.settings["boot/kernel/"+kname+\
-									"/extraversion"]=""
-
-							self.env["clst_kextraversion"]=\
-								self.settings["boot/kernel/"+kname+\
-								"/extraversion"]
-
-							if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-								if os.path.exists(self.settings["boot/kernel/"+\
-									kname+"/initramfs_overlay"]):
-									print "Copying initramfs_overlay dir "+\
-										self.settings["boot/kernel/"+kname+\
-										"/initramfs_overlay"]
-
-									cmd("mkdir -p "+\
-										self.settings["chroot_path"]+\
-										"/tmp/initramfs_overlay/"+\
-										self.settings["boot/kernel/"+kname+\
-										"/initramfs_overlay"],env=self.env)
-
-									cmd("cp -R "+self.settings["boot/kernel/"+\
-										kname+"/initramfs_overlay"]+"/* "+\
-										self.settings["chroot_path"]+\
-										"/tmp/initramfs_overlay/"+\
-										self.settings["boot/kernel/"+kname+\
-										"/initramfs_overlay"],env=self.env)
-
-							""" Execute the script that builds the kernel """
-							cmd("/bin/bash "+self.settings["controller_file"]+\
-								" kernel "+kname,\
-								"Runscript kernel build failed",env=self.env)
-
-							if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-								if os.path.exists(self.settings["chroot_path"]+\
-									"/tmp/initramfs_overlay/"):
-									print "Cleaning up temporary overlay dir"
-									cmd("rm -R "+self.settings["chroot_path"]+\
-										"/tmp/initramfs_overlay/",env=self.env)
-
-							touch(self.settings["autoresume_path"]+\
-								"build_kernel_"+kname)
-
-							"""
-							Execute the script that cleans up the kernel build
-							environment
-							"""
-							cmd("/bin/bash "+self.settings["controller_file"]+\
-								" post-kmerge ",
-								"Runscript post-kmerge failed",env=self.env)
-
+						self._build_kernel(kname=kname)
 					touch(self.settings["autoresume_path"]+"build_kernel")
-
 				except CatalystError:
 					self.unbind()
 					raise CatalystError,\
 						"build aborting due to kernel build error."
 
+	def _build_kernel(self, kname):
+		"Build a single configured kernel by name"
+		if "AUTORESUME" in self.settings \
+			and os.path.exists(self.settings["autoresume_path"]\
+				+"build_kernel_"+kname):
+			print "Resume point detected, skipping build_kernel for "+kname+" operation..."
+		else: # TODO: make this not require a kernel config
+			try:
+				if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
+					self.unbind()
+					raise CatalystError,\
+						"Can't find kernel config: "+\
+						self.settings["boot/kernel/"+kname+\
+						"/config"]
+
+			except TypeError:
+				raise CatalystError,\
+					"Required value boot/kernel/config not specified"
+
+			try:
+				cmd("cp "+self.settings["boot/kernel/"+kname+\
+					"/config"]+" "+\
+					self.settings["chroot_path"]+"/var/tmp/"+\
+					kname+".config",\
+					"Couldn't copy kernel config: "+\
+					self.settings["boot/kernel/"+kname+\
+					"/config"],env=self.env)
+
+			except CatalystError:
+				self.unbind()
+
+			"""
+			If we need to pass special options to the bootloader
+			for this kernel put them into the environment
+			"""
+			if "boot/kernel/"+kname+"/kernelopts" in self.settings:
+				myopts=self.settings["boot/kernel/"+kname+\
+					"/kernelopts"]
+
+				if type(myopts) != types.StringType:
+					myopts = string.join(myopts)
+					self.env[kname+"_kernelopts"]=myopts
+
+				else:
+					self.env[kname+"_kernelopts"]=""
+
+			if "boot/kernel/"+kname+"/extraversion" not in self.settings:
+				self.settings["boot/kernel/"+kname+\
+					"/extraversion"]=""
+
+			self.env["clst_kextraversion"]=\
+				self.settings["boot/kernel/"+kname+\
+				"/extraversion"]
+
+			if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+				if os.path.exists(self.settings["boot/kernel/"+\
+					kname+"/initramfs_overlay"]):
+					print "Copying initramfs_overlay dir "+\
+						self.settings["boot/kernel/"+kname+\
+						"/initramfs_overlay"]
+
+					cmd("mkdir -p "+\
+						self.settings["chroot_path"]+\
+						"/tmp/initramfs_overlay/"+\
+						self.settings["boot/kernel/"+kname+\
+						"/initramfs_overlay"],env=self.env)
+
+					cmd("cp -R "+self.settings["boot/kernel/"+\
+						kname+"/initramfs_overlay"]+"/* "+\
+						self.settings["chroot_path"]+\
+						"/tmp/initramfs_overlay/"+\
+						self.settings["boot/kernel/"+kname+\
+						"/initramfs_overlay"],env=self.env)
+
+			""" Execute the script that builds the kernel """
+			cmd("/bin/bash "+self.settings["controller_file"]+\
+				" kernel "+kname,\
+				"Runscript kernel build failed",env=self.env)
+
+			if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+				if os.path.exists(self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"):
+					print "Cleaning up temporary overlay dir"
+					cmd("rm -R "+self.settings["chroot_path"]+\
+						"/tmp/initramfs_overlay/",env=self.env)
+
+			touch(self.settings["autoresume_path"]+\
+				"build_kernel_"+kname)
+
+			"""
+			Execute the script that cleans up the kernel build
+			environment
+			"""
+			cmd("/bin/bash "+self.settings["controller_file"]+\
+				" post-kmerge ",
+				"Runscript post-kmerge failed",env=self.env)
+
 	def bootloader(self):
 		if "AUTORESUME" in self.settings \
 			and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 2/6] generic_stage_target: Split ._copy_kernel_config() from ._build_kernel()
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel() W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 3/6] generic_stage_target.py: Dedent the bulk of ._build_kernel() W. Trevor King
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

_copy_kernel_config() is one idea with a bunch of error handling.
Isolating it in its own function makes _build_kernel() easier to read.
---
 modules/generic_stage_target.py | 49 ++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index af7cbe7..2c32c00 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1426,29 +1426,7 @@ class generic_stage_target(generic_target):
 				+"build_kernel_"+kname):
 			print "Resume point detected, skipping build_kernel for "+kname+" operation..."
 		else: # TODO: make this not require a kernel config
-			try:
-				if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
-					self.unbind()
-					raise CatalystError,\
-						"Can't find kernel config: "+\
-						self.settings["boot/kernel/"+kname+\
-						"/config"]
-
-			except TypeError:
-				raise CatalystError,\
-					"Required value boot/kernel/config not specified"
-
-			try:
-				cmd("cp "+self.settings["boot/kernel/"+kname+\
-					"/config"]+" "+\
-					self.settings["chroot_path"]+"/var/tmp/"+\
-					kname+".config",\
-					"Couldn't copy kernel config: "+\
-					self.settings["boot/kernel/"+kname+\
-					"/config"],env=self.env)
-
-			except CatalystError:
-				self.unbind()
+			self._copy_kernel_config(kname=kname)
 
 			"""
 			If we need to pass special options to the bootloader
@@ -1516,6 +1494,31 @@ class generic_stage_target(generic_target):
 				" post-kmerge ",
 				"Runscript post-kmerge failed",env=self.env)
 
+	def _copy_kernel_config(self, kname):
+		try:
+			if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
+				self.unbind()
+				raise CatalystError,\
+					"Can't find kernel config: "+\
+					self.settings["boot/kernel/"+kname+\
+					"/config"]
+
+		except TypeError:
+			raise CatalystError,\
+				"Required value boot/kernel/config not specified"
+
+		try:
+			cmd("cp "+self.settings["boot/kernel/"+kname+\
+				"/config"]+" "+\
+				self.settings["chroot_path"]+"/var/tmp/"+\
+				kname+".config",\
+				"Couldn't copy kernel config: "+\
+				self.settings["boot/kernel/"+kname+\
+				"/config"],env=self.env)
+
+		except CatalystError:
+			self.unbind()
+
 	def bootloader(self):
 		if "AUTORESUME" in self.settings \
 			and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 3/6] generic_stage_target.py: Dedent the bulk of ._build_kernel()
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel() W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 2/6] generic_stage_target: Split ._copy_kernel_config() from ._build_kernel() W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 4/6] generic_stage_target: Split ._copy_initramfs_overlay() from ._build_kernel() W. Trevor King
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

At the beginning of the function, we check for an autoresume point.
If we find it, just return.  This allows us to dedent the `else` block
that had been handling the no-autoresume-found case.
---
 modules/generic_stage_target.py | 121 ++++++++++++++++++++--------------------
 1 file changed, 61 insertions(+), 60 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 2c32c00..337ab16 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1425,74 +1425,75 @@ class generic_stage_target(generic_target):
 			and os.path.exists(self.settings["autoresume_path"]\
 				+"build_kernel_"+kname):
 			print "Resume point detected, skipping build_kernel for "+kname+" operation..."
-		else: # TODO: make this not require a kernel config
-			self._copy_kernel_config(kname=kname)
+			return
+		# TODO: make this not require a kernel config
+		self._copy_kernel_config(kname=kname)
 
-			"""
-			If we need to pass special options to the bootloader
-			for this kernel put them into the environment
-			"""
-			if "boot/kernel/"+kname+"/kernelopts" in self.settings:
-				myopts=self.settings["boot/kernel/"+kname+\
-					"/kernelopts"]
+		"""
+		If we need to pass special options to the bootloader
+		for this kernel put them into the environment
+		"""
+		if "boot/kernel/"+kname+"/kernelopts" in self.settings:
+			myopts=self.settings["boot/kernel/"+kname+\
+				"/kernelopts"]
 
-				if type(myopts) != types.StringType:
-					myopts = string.join(myopts)
-					self.env[kname+"_kernelopts"]=myopts
+			if type(myopts) != types.StringType:
+				myopts = string.join(myopts)
+				self.env[kname+"_kernelopts"]=myopts
 
-				else:
-					self.env[kname+"_kernelopts"]=""
+			else:
+				self.env[kname+"_kernelopts"]=""
 
-			if "boot/kernel/"+kname+"/extraversion" not in self.settings:
-				self.settings["boot/kernel/"+kname+\
-					"/extraversion"]=""
+		if "boot/kernel/"+kname+"/extraversion" not in self.settings:
+			self.settings["boot/kernel/"+kname+\
+				"/extraversion"]=""
 
-			self.env["clst_kextraversion"]=\
-				self.settings["boot/kernel/"+kname+\
-				"/extraversion"]
-
-			if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-				if os.path.exists(self.settings["boot/kernel/"+\
-					kname+"/initramfs_overlay"]):
-					print "Copying initramfs_overlay dir "+\
-						self.settings["boot/kernel/"+kname+\
-						"/initramfs_overlay"]
-
-					cmd("mkdir -p "+\
-						self.settings["chroot_path"]+\
-						"/tmp/initramfs_overlay/"+\
-						self.settings["boot/kernel/"+kname+\
-						"/initramfs_overlay"],env=self.env)
-
-					cmd("cp -R "+self.settings["boot/kernel/"+\
-						kname+"/initramfs_overlay"]+"/* "+\
-						self.settings["chroot_path"]+\
-						"/tmp/initramfs_overlay/"+\
-						self.settings["boot/kernel/"+kname+\
-						"/initramfs_overlay"],env=self.env)
-
-			""" Execute the script that builds the kernel """
-			cmd("/bin/bash "+self.settings["controller_file"]+\
-				" kernel "+kname,\
-				"Runscript kernel build failed",env=self.env)
+		self.env["clst_kextraversion"]=\
+			self.settings["boot/kernel/"+kname+\
+			"/extraversion"]
+
+		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+			if os.path.exists(self.settings["boot/kernel/"+\
+				kname+"/initramfs_overlay"]):
+				print "Copying initramfs_overlay dir "+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"]
 
-			if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-				if os.path.exists(self.settings["chroot_path"]+\
-					"/tmp/initramfs_overlay/"):
-					print "Cleaning up temporary overlay dir"
-					cmd("rm -R "+self.settings["chroot_path"]+\
-						"/tmp/initramfs_overlay/",env=self.env)
+				cmd("mkdir -p "+\
+					self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"],env=self.env)
 
-			touch(self.settings["autoresume_path"]+\
-				"build_kernel_"+kname)
+				cmd("cp -R "+self.settings["boot/kernel/"+\
+					kname+"/initramfs_overlay"]+"/* "+\
+					self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"],env=self.env)
 
-			"""
-			Execute the script that cleans up the kernel build
-			environment
-			"""
-			cmd("/bin/bash "+self.settings["controller_file"]+\
-				" post-kmerge ",
-				"Runscript post-kmerge failed",env=self.env)
+		""" Execute the script that builds the kernel """
+		cmd("/bin/bash "+self.settings["controller_file"]+\
+			" kernel "+kname,\
+			"Runscript kernel build failed",env=self.env)
+
+		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+			if os.path.exists(self.settings["chroot_path"]+\
+				"/tmp/initramfs_overlay/"):
+				print "Cleaning up temporary overlay dir"
+				cmd("rm -R "+self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/",env=self.env)
+
+		touch(self.settings["autoresume_path"]+\
+			"build_kernel_"+kname)
+
+		"""
+		Execute the script that cleans up the kernel build
+		environment
+		"""
+		cmd("/bin/bash "+self.settings["controller_file"]+\
+			" post-kmerge ",
+			"Runscript post-kmerge failed",env=self.env)
 
 	def _copy_kernel_config(self, kname):
 		try:
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 4/6] generic_stage_target: Split ._copy_initramfs_overlay() from ._build_kernel()
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
                       ` (2 preceding siblings ...)
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 3/6] generic_stage_target.py: Dedent the bulk of ._build_kernel() W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 5/6] generic_stage_target: Handle unspecified boot/kernel/<kname>/config W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional W. Trevor King
  5 siblings, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

_copy_initramfs_overlay() is long enough that it makes reading
_build_kernel() difficult.
---
 modules/generic_stage_target.py | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 337ab16..e741fcd 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1452,25 +1452,7 @@ class generic_stage_target(generic_target):
 			self.settings["boot/kernel/"+kname+\
 			"/extraversion"]
 
-		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-			if os.path.exists(self.settings["boot/kernel/"+\
-				kname+"/initramfs_overlay"]):
-				print "Copying initramfs_overlay dir "+\
-					self.settings["boot/kernel/"+kname+\
-					"/initramfs_overlay"]
-
-				cmd("mkdir -p "+\
-					self.settings["chroot_path"]+\
-					"/tmp/initramfs_overlay/"+\
-					self.settings["boot/kernel/"+kname+\
-					"/initramfs_overlay"],env=self.env)
-
-				cmd("cp -R "+self.settings["boot/kernel/"+\
-					kname+"/initramfs_overlay"]+"/* "+\
-					self.settings["chroot_path"]+\
-					"/tmp/initramfs_overlay/"+\
-					self.settings["boot/kernel/"+kname+\
-					"/initramfs_overlay"],env=self.env)
+		self._copy_initramfs_overlay(kname=kname)
 
 		""" Execute the script that builds the kernel """
 		cmd("/bin/bash "+self.settings["controller_file"]+\
@@ -1520,6 +1502,27 @@ class generic_stage_target(generic_target):
 		except CatalystError:
 			self.unbind()
 
+	def _copy_initramfs_overlay(self, kname):
+		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
+			if os.path.exists(self.settings["boot/kernel/"+\
+				kname+"/initramfs_overlay"]):
+				print "Copying initramfs_overlay dir "+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"]
+
+				cmd("mkdir -p "+\
+					self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"],env=self.env)
+
+				cmd("cp -R "+self.settings["boot/kernel/"+\
+					kname+"/initramfs_overlay"]+"/* "+\
+					self.settings["chroot_path"]+\
+					"/tmp/initramfs_overlay/"+\
+					self.settings["boot/kernel/"+kname+\
+					"/initramfs_overlay"],env=self.env)
+
 	def bootloader(self):
 		if "AUTORESUME" in self.settings \
 			and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 5/6] generic_stage_target: Handle unspecified boot/kernel/<kname>/config
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
                       ` (3 preceding siblings ...)
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 4/6] generic_stage_target: Split ._copy_initramfs_overlay() from ._build_kernel() W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional W. Trevor King
  5 siblings, 0 replies; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

If boot/kernel/<kname>/config is not set, make _copy_kernel_config a
no-op.
---
 modules/generic_stage_target.py | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index e741fcd..31cb025 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1426,7 +1426,6 @@ class generic_stage_target(generic_target):
 				+"build_kernel_"+kname):
 			print "Resume point detected, skipping build_kernel for "+kname+" operation..."
 			return
-		# TODO: make this not require a kernel config
 		self._copy_kernel_config(kname=kname)
 
 		"""
@@ -1478,7 +1477,7 @@ class generic_stage_target(generic_target):
 			"Runscript post-kmerge failed",env=self.env)
 
 	def _copy_kernel_config(self, kname):
-		try:
+		if "boot/kernel/"+kname+"/config" in self.settings:
 			if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
 				self.unbind()
 				raise CatalystError,\
@@ -1486,21 +1485,17 @@ class generic_stage_target(generic_target):
 					self.settings["boot/kernel/"+kname+\
 					"/config"]
 
-		except TypeError:
-			raise CatalystError,\
-				"Required value boot/kernel/config not specified"
+			try:
+				cmd("cp "+self.settings["boot/kernel/"+kname+\
+					"/config"]+" "+\
+					self.settings["chroot_path"]+"/var/tmp/"+\
+					kname+".config",\
+					"Couldn't copy kernel config: "+\
+					self.settings["boot/kernel/"+kname+\
+					"/config"],env=self.env)
 
-		try:
-			cmd("cp "+self.settings["boot/kernel/"+kname+\
-				"/config"]+" "+\
-				self.settings["chroot_path"]+"/var/tmp/"+\
-				kname+".config",\
-				"Couldn't copy kernel config: "+\
-				self.settings["boot/kernel/"+kname+\
-				"/config"],env=self.env)
-
-		except CatalystError:
-			self.unbind()
+			except CatalystError:
+				self.unbind()
 
 	def _copy_initramfs_overlay(self, kname):
 		if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional
  2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
                       ` (4 preceding siblings ...)
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 5/6] generic_stage_target: Handle unspecified boot/kernel/<kname>/config W. Trevor King
@ 2013-02-09 20:45     ` W. Trevor King
  2013-03-01  5:57       ` [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf W. Trevor King
  5 siblings, 1 reply; 12+ messages in thread
From: W. Trevor King @ 2013-02-09 20:45 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

For users that don't want to specify a seed config.
---
 targets/support/kmerge.sh | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index b731373..ce1dddf 100644
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -109,8 +109,11 @@ genkernel_compile(){
 	else
 		genkernel ${GK_ARGS} || exit 1
 	fi
-	md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
-		/tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+	if [ -e /var/tmp/${clst_kname}.config ]
+	then
+		md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
+			/tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+	fi
 }
 
 build_kernel() {
@@ -177,15 +180,17 @@ then
 fi
 
 CONFIG_MATCH=0
-if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
+if [ -n "${clst_KERNCACHE}" -a
+     -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
 then
-	STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
-	STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
-	if [ "${STR1}" = "${STR2}" ]
+	if [ ! -e /var/tmp/${clst_kname}.config ]
 	then
-		if [ -n "${clst_KERNCACHE}" ]
+		CONFIG_MATCH=1
+	else
+		STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
+		STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
+		if [ "${STR1}" = "${STR2}" ]
 		then
-			#echo "CONFIG match"
 			CONFIG_MATCH=1
 		fi
 	fi
-- 
1.8.1.336.g94702dd



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf
  2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional W. Trevor King
@ 2013-03-01  5:57       ` W. Trevor King
  2013-03-01  6:06         ` Matt Turner
  0 siblings, 1 reply; 12+ messages in thread
From: W. Trevor King @ 2013-03-01  5:57 UTC (permalink / raw
  To: Catalyst; +Cc: Matt Turner, W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

In 9ceebbf (kmerge.sh: Make /var/tmp/${clst_kname}.config optional,
2013-02-09), I added a KERNCACHE check to a `[` test, wrapping the two
clauses in the test to avoid a very long line.  Unfortunately,
newlines do not appear to be legal in this position.  For example:

  $ if [ -n "a" -a
  > -n "b" ]; then echo "c"; fi
  bash: [: missing `]'
  bash: -n: command not found

This commit fixes the error by explicitly wrapping the line with a
backslash.
---
 targets/support/kmerge.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index ce1dddf..e78e0b4 100644
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -180,7 +180,7 @@ then
 fi
 
 CONFIG_MATCH=0
-if [ -n "${clst_KERNCACHE}" -a
+if [ -n "${clst_KERNCACHE}" -a \
      -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
 then
 	if [ ! -e /var/tmp/${clst_kname}.config ]
-- 
1.8.2.rc0.16.g20a599e



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf
  2013-03-01  5:57       ` [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf W. Trevor King
@ 2013-03-01  6:06         ` Matt Turner
  0 siblings, 0 replies; 12+ messages in thread
From: Matt Turner @ 2013-03-01  6:06 UTC (permalink / raw
  To: gentoo-catalyst; +Cc: W. Trevor King

On Thu, Feb 28, 2013 at 9:57 PM, W. Trevor King <wking@tremily.us> wrote:
> From: "W. Trevor King" <wking@tremily.us>
>
> In 9ceebbf (kmerge.sh: Make /var/tmp/${clst_kname}.config optional,
> 2013-02-09), I added a KERNCACHE check to a `[` test, wrapping the two
> clauses in the test to avoid a very long line.  Unfortunately,
> newlines do not appear to be legal in this position.  For example:
>
>   $ if [ -n "a" -a
>   > -n "b" ]; then echo "c"; fi
>   bash: [: missing `]'
>   bash: -n: command not found
>
> This commit fixes the error by explicitly wrapping the line with a
> backslash.
> ---
>  targets/support/kmerge.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
> index ce1dddf..e78e0b4 100644
> --- a/targets/support/kmerge.sh
> +++ b/targets/support/kmerge.sh
> @@ -180,7 +180,7 @@ then
>  fi
>
>  CONFIG_MATCH=0
> -if [ -n "${clst_KERNCACHE}" -a
> +if [ -n "${clst_KERNCACHE}" -a \
>       -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
>  then
>         if [ ! -e /var/tmp/${clst_kname}.config ]
> --
> 1.8.2.rc0.16.g20a599e
>
>

Thanks, pushed!


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-01  6:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-09 12:15 [gentoo-catalyst] stage4 kernel config for genkernel? W. Trevor King
2013-02-09 12:56 ` Chris White
2013-02-09 13:18   ` W. Trevor King
2013-02-09 20:45   ` [gentoo-catalyst] [PATCH 0/6] Make external kernel configs optional W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 1/6] generic_stage_target: Split ._build_kernel() out of .build_kernel() W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 2/6] generic_stage_target: Split ._copy_kernel_config() from ._build_kernel() W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 3/6] generic_stage_target.py: Dedent the bulk of ._build_kernel() W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 4/6] generic_stage_target: Split ._copy_initramfs_overlay() from ._build_kernel() W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 5/6] generic_stage_target: Handle unspecified boot/kernel/<kname>/config W. Trevor King
2013-02-09 20:45     ` [gentoo-catalyst] [PATCH 6/6] kmerge.sh: Make /var/tmp/${clst_kname}.config optional W. Trevor King
2013-03-01  5:57       ` [gentoo-catalyst] [PATCH] kmerge.sh: Fix line wrapping typo from 9ceebbf W. Trevor King
2013-03-01  6:06         ` Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox