Makefile: Make the kernel target inside the chroot

This commit is contained in:
Albert Hopkins 2015-02-27 21:20:43 +00:00
parent 0c12afc476
commit 8ef1630fdb
1 changed files with 7 additions and 6 deletions

View File

@ -12,6 +12,7 @@ XVA_IMAGE = $(IMAGES)/$(APPLIANCE).xva
LST_FILE = $(IMAGES)/$(APPLIANCE)-packages.lst LST_FILE = $(IMAGES)/$(APPLIANCE)-packages.lst
STAGE3 = $(CHROOT)/tmp/stage3 STAGE3 = $(CHROOT)/tmp/stage3
COMPILE_OPTIONS = $(CHROOT)/tmp/compile_options COMPILE_OPTIONS = $(CHROOT)/tmp/compile_options
KERNEL = $(CHROOT)/tmp/kernel
STAGE4_TARBALL = $(CURDIR)/images/$(APPLIANCE).tar.xz STAGE4_TARBALL = $(CURDIR)/images/$(APPLIANCE).tar.xz
VIRTIO = NO VIRTIO = NO
TIMEZONE = UTC TIMEZONE = UTC
@ -37,7 +38,7 @@ M4C = $(M4) $(M4_DEFS)
USEPKG = --usepkg --binpkg-respect-use=y USEPKG = --usepkg --binpkg-respect-use=y
RSYNC_MIRROR = rsync://rsync.gtlib.gatech.edu/gentoo/ RSYNC_MIRROR = rsync://rsync.gtlib.gatech.edu/gentoo/
EMERGE_RSYNC = NO EMERGE_RSYNC = NO
KERNEL = gentoo-sources KERNEL_PKG = gentoo-sources
PACKAGE_FILES = $(wildcard appliances/$(APPLIANCE)/package.*) PACKAGE_FILES = $(wildcard appliances/$(APPLIANCE)/package.*)
WORLD = appliances/$(APPLIANCE)/world WORLD = appliances/$(APPLIANCE)/world
EXTRA_WORLD = EXTRA_WORLD =
@ -164,19 +165,19 @@ ifdef PACKAGE_FILES
endif endif
touch $(COMPILE_OPTIONS) touch $(COMPILE_OPTIONS)
kernel: $(COMPILE_OPTIONS) $(KERNEL_CONFIG) scripts/kernel.sh $(KERNEL): $(COMPILE_OPTIONS) $(KERNEL_CONFIG) scripts/kernel.sh
ifneq ($(EXTERNAL_KERNEL),YES) ifneq ($(EXTERNAL_KERNEL),YES)
@scripts/echo Configuring kernel @scripts/echo Configuring kernel
cp $(KERNEL_CONFIG) $(CHROOT)/root/kernel.config cp $(KERNEL_CONFIG) $(CHROOT)/root/kernel.config
cp scripts/kernel.sh $(CHROOT)/root/kernel.sh cp scripts/kernel.sh $(CHROOT)/root/kernel.sh
$(inroot) --setenv=KERNEL=$(KERNEL) \ $(inroot) --setenv=KERNEL=$(KERNEL_PKG) \
--setenv=EMERGE="$(EMERGE)" \ --setenv=EMERGE="$(EMERGE)" \
--setenv=USEPKG="$(USEPKG)" \ --setenv=USEPKG="$(USEPKG)" \
--setenv=MAKEOPTS="$(MAKEOPTS)" \ --setenv=MAKEOPTS="$(MAKEOPTS)" \
/bin/sh /root/kernel.sh /bin/sh /root/kernel.sh
rm -f $(CHROOT)/root/kernel.sh rm -f $(CHROOT)/root/kernel.sh
endif endif
touch kernel touch $(KERNEL)
$(SWAP_FILE): preproot $(SWAP_FILE): preproot
ifneq ($(SWAP_SIZE),0) ifneq ($(SWAP_SIZE),0)
@ -212,7 +213,7 @@ ifeq ($(DASH),YES)
endif endif
touch systools touch systools
grub: stage3 configs/grub.conf kernel scripts/grub-headless.sed grub: preproot configs/grub.conf $(KERNEL) scripts/grub-headless.sed
ifneq ($(EXTERNAL_KERNEL),YES) ifneq ($(EXTERNAL_KERNEL),YES)
@scripts/echo Installing Grub @scripts/echo Installing Grub
$(inroot) $(EMERGE) -nN $(USEPKG) sys-boot/grub-static $(inroot) $(EMERGE) -nN $(USEPKG) sys-boot/grub-static
@ -310,7 +311,7 @@ $(VMDK_IMAGE): image
vmdk: $(VMDK_IMAGE) vmdk: $(VMDK_IMAGE)
build_stage4: software kernel configs/rsync-excludes grub build_stage4: software $(KERNEL) configs/rsync-excludes grub
@scripts/echo Creating stage4 tarball: $(STAGE4_TARBALL) @scripts/echo Creating stage4 tarball: $(STAGE4_TARBALL)
mkdir -p $(IMAGES) mkdir -p $(IMAGES)
tar -acf "$(STAGE4_TARBALL).tmp.xz" --numeric-owner $(COPY_ARGS) -C $(CHROOT) --one-file-system . tar -acf "$(STAGE4_TARBALL).tmp.xz" --numeric-owner $(COPY_ARGS) -C $(CHROOT) --one-file-system .