From: "Richard Yao" <ryao@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:ryao commit in: /
Date: Mon, 5 Nov 2012 18:30:25 +0000 (UTC) [thread overview]
Message-ID: <1350164899.79d7fa1948de033bf5a2523fe8eca25d7f1f4438.ryao@gentoo> (raw)
commit: 79d7fa1948de033bf5a2523fe8eca25d7f1f4438
Author: Łukasz Stelmach <stlman <AT> poczta <DOT> fm>
AuthorDate: Thu Sep 13 20:44:45 2012 +0000
Commit: Richard Yao <ryao <AT> gentoo <DOT> org>
CommitDate: Sat Oct 13 21:48:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=79d7fa19
Add --kernel-outputdir to save files outside the source tree.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
ChangeLog | 6 ++++++
gen_cmdline.sh | 5 +++++
gen_compile.sh | 6 +++++-
gen_configkernel.sh | 34 +++++++++++++++++-----------------
gen_determineargs.sh | 1 +
gen_funcs.sh | 3 ++-
genkernel | 4 +++-
7 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d3e7158..8660462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,12 @@
# Distributed under the GPL v2
# $Id$
+ 13 Oct 2012; Łukasz Stelmach <stlman@poczta.fm> gen_cmdline.sh,
+ gen_compile.sh, gen_configkernel.sh, gen_determineargs.sh, gen_funcs.sh,
+ genkernel:
+ Bug #435210 support external kernel output location, to allow pristine
+ source.
+
13 Oct 2012; Robin H. Johnson <robbat2@gentoo.org> gen_compile.sh:
Bug #397947: Run depmod on new modules to avoid need to run at every boot on
unionfs systems, or systemd that never runs it.
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index a305201..858b850 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -63,6 +63,7 @@ longusage() {
echo " --kernel-make=<makeprg> GNU Make to use for kernel"
echo " --kernel-target=<t> Override default make target (bzImage)"
echo " --kernel-binary=<path> Override default kernel binary path (arch/foo/boot/bar)"
+ echo " --kernel-outputdir=<path> Save output files outside the source tree."
echo " --utils-cc=<compiler> Compiler to use for utilities"
echo " --utils-as=<assembler> Assembler to use for utils"
@@ -214,6 +215,10 @@ parse_cmdline() {
CMD_KERNEL_CROSS_COMPILE=$(echo ${CMD_KERNEL_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
print_info 2 "CMD_KERNEL_CROSS_COMPILE: ${CMD_KERNEL_CROSS_COMPILE}"
;;
+ --kernel-outputdir=*)
+ CMD_KERNEL_OUTPUTDIR=`parse_opt "$*"`
+ print_info 2 "CMD_KERNEL_OUTPUTDIR: ${CMD_KERNEL_OUTPUTDIR}"
+ ;;
--utils-cc=*)
CMD_UTILS_CC=`parse_opt "$*"`
print_info 2 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
diff --git a/gen_compile.sh b/gen_compile.sh
index c923967..87fd586 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -25,6 +25,10 @@ compile_kernel_args() {
then
ARGS="${ARGS} ARCH=\"${KERNEL_ARCH}\""
fi
+ if [ -n "${KERNEL_OUTPUTDIR}" ]
+ then
+ ARGS="${ARGS} O=\"${KERNEL_OUTPUTDIR}\""
+ fi
fi
echo -n "${ARGS}"
}
@@ -318,7 +322,7 @@ compile_kernel() {
compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
fi
- local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL "${KERNEL_DIR}"/.config`
+ local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL "${KERNEL_OUTPUTDIR}"/.config`
if [ -n "${firmware_in_kernel_line}" -a "${firmware_in_kernel_line}" != CONFIG_FIRMWARE_IN_KERNEL=y ]
then
print_info 1 " >> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..."
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index b0837dd..6271ca0 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -32,14 +32,14 @@ config_kernel() {
cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
# Backup current kernel .config
- if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
+ if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_OUTPUTDIR}/.config" ]
then
print_info 1 "kernel: Using config from ${KERNEL_CONFIG}"
- if [ -f "${KERNEL_DIR}/.config" ]
+ if [ -f "${KERNEL_OUTPUTDIR}/.config" ]
then
NOW=`date +--%Y-%m-%d--%H-%M-%S`
- cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config${NOW}.bak" \
- || gen_die "Could not backup kernel config (${KERNEL_DIR}/.config)"
+ cp "${KERNEL_OUTPUTDIR}/.config" "${KERNEL_OUTPUTDIR}/.config${NOW}.bak" \
+ || gen_die "Could not backup kernel config (${KERNEL_OUTPUTDIR}/.config)"
print_info 1 " Previous config backed up to .config${NOW}.bak"
fi
fi
@@ -54,14 +54,14 @@ config_kernel() {
# If we're not cleaning a la mrproper, then we don't want to try to overwrite the configs
# or we might remove configurations someone is trying to test.
- if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
+ if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_OUTPUTDIR}/.config" ]
then
local message='Could not copy configuration file!'
if [[ "$(file --brief --mime-type "${KERNEL_CONFIG}")" == application/x-gzip ]]; then
# Support --kernel-config=/proc/config.gz, mainly
- zcat "${KERNEL_CONFIG}" > "${KERNEL_DIR}/.config" || gen_die "${message}"
+ zcat "${KERNEL_CONFIG}" > "${KERNEL_OUTPUTDIR}/.config" || gen_die "${message}"
else
- cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die "${message}"
+ cp "${KERNEL_CONFIG}" "${KERNEL_OUTPUTDIR}/.config" || gen_die "${message}"
fi
fi
@@ -106,21 +106,21 @@ config_kernel() {
then
# Make sure Ext2 support is on...
sed -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' \
- -i ${KERNEL_DIR}/.config
+ -i ${KERNEL_OUTPUTDIR}/.config
fi
# Make sure lvm modules are on if --lvm
if isTrue ${CMD_LVM}
then
- sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
- sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_SNAPSHOT is.*/CONFIG_DM_SNAPSHOT=m/g'
- sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MIRROR is.*/CONFIG_DM_MIRROR=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/#\? \?CONFIG_DM_SNAPSHOT is.*/CONFIG_DM_SNAPSHOT=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/#\? \?CONFIG_DM_MIRROR is.*/CONFIG_DM_MIRROR=m/g'
fi
# Make sure dmraid modules are on if --dmraid
if isTrue ${CMD_DMRAID}
then
- sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
fi
# Make sure iSCSI modules are enabled in the kernel, if --iscsi
@@ -128,15 +128,15 @@ config_kernel() {
# CONFIG_ISCSI_TCP
if isTrue ${CMD_ISCSI}
then
- sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_ISCSI_TCP is not set/CONFIG_ISCSI_TCP=m/g'
- sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_SCSI_ISCSI_ATTRS is not set/CONFIG_SCSI_ISCSI_ATTRS=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/\# CONFIG_ISCSI_TCP is not set/CONFIG_ISCSI_TCP=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/\# CONFIG_SCSI_ISCSI_ATTRS is not set/CONFIG_SCSI_ISCSI_ATTRS=m/g'
- sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_ISCSI_TCP=y/CONFIG_ISCSI_TCP=m/g'
- sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_SCSI_ISCSI_ATTRS=y/CONFIG_SCSI_ISCSI_ATTRS=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/CONFIG_ISCSI_TCP=y/CONFIG_ISCSI_TCP=m/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/CONFIG_SCSI_ISCSI_ATTRS=y/CONFIG_SCSI_ISCSI_ATTRS=m/g'
fi
if isTrue ${SPLASH}
then
- sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
+ sed -i ${KERNEL_OUTPUTDIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
fi
}
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 92a6458..eb822b3 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -90,6 +90,7 @@ determine_real_args() {
set_config_with_override STRING KERNEL_CROSS_COMPILE CMD_KERNEL_CROSS_COMPILE
set_config_with_override STRING UTILS_CROSS_COMPILE CMD_UTILS_CROSS_COMPILE
set_config_with_override STRING BOOTDIR CMD_BOOTDIR "/boot"
+ set_config_with_override STRING KERNEL_OUTPUTDIR CMD_KERNEL_OUTPUTDIR "${DEFAULT_KERNEL_SOURCE}"
set_config_with_override STRING MODPROBEDIR CMD_MODPROBEDIR "/etc/modprobe.d"
set_config_with_override BOOL SPLASH CMD_SPLASH
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 48a3382..4f0a0fc 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -298,6 +298,7 @@ copy_image_with_preserve() {
# Old product might be a different version. If so, we need to read
# the symlink to see what it's name is, if there are symlinks.
+ cd ${KERNEL_OUTPUTDIR}
if [ "${SYMLINK}" = '1' ]
then
print_info 4 "automatically managing symlinks and old images." 1 0
@@ -508,7 +509,7 @@ find_kernel_binary() {
local kernel_binary=$*
local curdir=$(pwd)
- cd "${KERNEL_DIR}"
+ cd "${KERNEL_OUTPUTDIR}"
for i in ${kernel_binary}
do
if [ -e "${i}" ]
diff --git a/genkernel b/genkernel
index 2c1a62d..1630cd6 100755
--- a/genkernel
+++ b/genkernel
@@ -236,7 +236,9 @@ then
then
print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}"
[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
- cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
+ cp "${KERNEL_OUTPUTDIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}" || \
+ print_warning "Unable to copy the kernel configuration file."
+ # Just a warning because ordinary users are not allowed to write in /etc
fi
fi
next reply other threads:[~2012-11-05 18:31 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 18:30 Richard Yao [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-10-02 12:43 [gentoo-commits] proj/genkernel:ryao commit in: / Richard Yao
2013-10-02 12:43 Richard Yao
2013-10-02 12:43 Richard Yao
2013-06-09 13:57 Richard Yao
2013-06-09 13:57 Richard Yao
2013-06-09 13:57 [gentoo-commits] proj/genkernel:master " Richard Yao
2013-06-09 13:57 ` [gentoo-commits] proj/genkernel:ryao " Richard Yao
2013-06-09 13:33 Richard Yao
2013-06-09 13:33 Richard Yao
2013-06-09 13:17 Richard Yao
2013-06-09 13:17 Richard Yao
2013-06-09 10:05 Richard Yao
2013-06-09 10:05 Richard Yao
2013-06-09 10:02 Richard Yao
2013-06-09 10:02 Richard Yao
2013-06-09 9:58 Richard Yao
2013-06-09 9:58 Richard Yao
2013-06-09 9:57 Richard Yao
2013-06-09 9:53 Richard Yao
2013-06-09 9:51 Richard Yao
2013-06-09 9:49 Richard Yao
2013-06-09 8:32 Richard Yao
2013-06-09 8:32 Richard Yao
2013-06-09 8:32 Richard Yao
2013-06-09 8:32 Richard Yao
2013-06-09 8:32 Richard Yao
2013-06-09 8:16 Richard Yao
2013-06-09 7:58 Richard Yao
2013-06-09 6:43 Richard Yao
2013-06-06 6:09 Richard Yao
2013-06-06 5:57 Richard Yao
2013-06-06 5:54 Richard Yao
2013-06-06 3:52 Richard Yao
2013-06-06 3:36 Richard Yao
2013-06-06 3:36 Richard Yao
2013-06-06 3:36 Richard Yao
2013-06-06 3:36 Richard Yao
2013-06-03 23:49 [gentoo-commits] proj/genkernel:master " Richard Yao
2013-06-06 3:36 ` [gentoo-commits] proj/genkernel:ryao " Richard Yao
2013-06-03 23:49 Richard Yao
2013-06-03 23:47 Richard Yao
2013-06-03 23:43 Richard Yao
2013-06-03 23:35 Richard Yao
2013-06-03 23:34 Richard Yao
2013-06-03 23:34 Richard Yao
2012-11-11 18:04 Richard Yao
2012-11-11 17:32 Richard Yao
2012-11-05 18:42 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-11-05 18:30 Richard Yao
2012-08-25 1:44 Richard Yao
2012-08-25 1:36 Richard Yao
2012-08-25 1:19 Richard Yao
2012-08-25 1:04 Richard Yao
2012-08-16 18:33 Richard Yao
2012-08-16 18:33 Richard Yao
2012-08-16 18:33 Richard Yao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350164899.79d7fa1948de033bf5a2523fe8eca25d7f1f4438.ryao@gentoo \
--to=ryao@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox