From 23e20007a9966258a11ff9943376eb73862ff987 Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Tue, 28 Jun 2011 08:20:05 -0400 Subject: [PATCH] Make it so no kernel is compiled if a kernel is installed in /boot and an emerge will only install the same kernel. This (and other) logic really needs to be moved out of Makefile and into a shell script where it can be better maintained and not look so ugly. --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c9ee5bf..21f011f 100644 --- a/Makefile +++ b/Makefile @@ -168,18 +168,23 @@ kernel: base_system $(KERNEL_CONFIG) $(inroot) cp /usr/share/zoneinfo/$(TIMEZONE) /etc/localtime echo $(TIMEZONE) > "$(CHROOT)"/etc/timezone ifneq ($(EXTERNAL_KERNEL),YES) - $(inroot) $(EMERGE) $(USEPKG) sys-kernel/$(KERNEL) - cp $(KERNEL_CONFIG) $(CHROOT)/usr/src/linux/.config - $(gcc_config) - $(inroot) make $(MAKEOPTS) -C /usr/src/linux oldconfig - $(inroot) make $(MAKEOPTS) -C /usr/src/linux - $(inroot) rm -rf /lib/modules/* - $(inroot) make $(MAKEOPTS) -C /usr/src/linux modules_install - $(inroot) rm -f /boot/vmlinuz* - $(inroot) make $(MAKEOPTS) -C /usr/src/linux install + if [ -e "$(CHROOT)/boot/vmlinuz" ] && $(inroot) emerge -pq sys-kernel/$(KERNEL)|grep '^\[.*R.*\]' >/dev/null ; \ + then \ + /bin/true ; \ + else \ + $(inroot) $(EMERGE) $(USEPKG) sys-kernel/$(KERNEL) ; \ + cp $(KERNEL_CONFIG) $(CHROOT)/usr/src/linux/.config ; \ + $(gcc_config) ; \ + $(inroot) make $(MAKEOPTS) -C /usr/src/linux oldconfig ; \ + $(inroot) make $(MAKEOPTS) -C /usr/src/linux ; \ + $(inroot) rm -rf /lib/modules/* ; \ + $(inroot) make $(MAKEOPTS) -C /usr/src/linux modules_install ; \ + $(inroot) rm -f /boot/vmlinuz* ; \ + $(inroot) make $(MAKEOPTS) -C /usr/src/linux install ; \ cd $(CHROOT)/boot ; \ k=`/bin/ls -1 --sort=time vmlinuz-*|head -n 1` ; \ - ln -nsf $$k vmlinuz + ln -nsf $$k vmlinuz ; \ + fi endif touch kernel