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.
This commit is contained in:
Albert Hopkins 2011-06-28 08:20:05 -04:00
parent 3077913344
commit 23e20007a9
1 changed files with 15 additions and 10 deletions

View File

@ -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