[Patch] make installkernel configurable from command line (was Re:how to avoid that install.sh goes mad, if I am not root?)

From: AmÃrico Wang
Date: Mon Jan 24 2011 - 05:22:14 EST


On Fri, Jan 21, 2011 at 11:08:10PM +0100, Harald Dunkel wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On 01/21/11 13:49, WANG Cong wrote:
>> On Thu, 20 Jan 2011 22:47:56 +0100, Mikael Pettersson wrote:
>>>
>>> First, at least on x86, the kernel will look for the 'installkernel'
>>> executable first in your own ~/bin/, so if you have that then it will
>>> override /sbin/installkernel.
>>>
>>
>> That still doesn't look like a good solution.
>>
>
>Same for me.
>
>Obviously running /sbin/installkernel is not reasonable for
>UID != 0 (or if $FAKEROOTKEY is set), so I would suggest to
>skip /sbin/installkernel and the default Lilo setup in
>install.sh for this case.
>

Will the patch below work for you?

With this patch, you should be able to specify your own installkernel
by "make INSTALLKERNEL=/your/installkernel install".

Signed-off-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

---
diff --git a/Makefile b/Makefile
index 1f47495..44abded 100644
--- a/Makefile
+++ b/Makefile
@@ -327,7 +327,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
AWK = awk
GENKSYMS = scripts/genksyms/genksyms
-INSTALLKERNEL := installkernel
+INSTALLKERNEL ?= /sbin/installkernel
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
PERL = perl
diff --git a/arch/x86/boot/install.sh b/arch/x86/boot/install.sh
index d13ec1c..c41f2b8 100644
--- a/arch/x86/boot/install.sh
+++ b/arch/x86/boot/install.sh
@@ -33,8 +33,7 @@ verify "$3"

# User may have a custom install script

-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+if [ -x "${INSTALLKERNEL}" ]; then exec "${INSTALLKERNEL}" "$@"; fi

# Default install - same as make zlilo


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/