add support for installation of linux kernel headers
this feature is still experimental and requires manually setting a LINUX_ARCH make variable matching the target. automatic mapping will be added later. if LINUX_ARCH is not set, header installation is skipped.
This commit is contained in:
parent
75b8346bed
commit
9bd379f80b
|
@ -8,3 +8,4 @@
|
||||||
/mpc-*/
|
/mpc-*/
|
||||||
/mpfr-*/
|
/mpfr-*/
|
||||||
/build-*/
|
/build-*/
|
||||||
|
/linux-*/
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -9,6 +9,7 @@ MUSL_VER = 1.1.14
|
||||||
GMP_VER = 6.1.0
|
GMP_VER = 6.1.0
|
||||||
MPC_VER = 1.0.3
|
MPC_VER = 1.0.3
|
||||||
MPFR_VER = 3.1.4
|
MPFR_VER = 3.1.4
|
||||||
|
LINUX_VER = 4.4.10
|
||||||
|
|
||||||
GNU_SITE = https://ftp.gnu.org/pub/gnu
|
GNU_SITE = https://ftp.gnu.org/pub/gnu
|
||||||
GCC_SITE = $(GNU_SITE)/gcc
|
GCC_SITE = $(GNU_SITE)/gcc
|
||||||
|
@ -20,6 +21,8 @@ MPFR_SITE = $(GNU_SITE)/mpfr
|
||||||
MUSL_SITE = https://www.musl-libc.org/releases
|
MUSL_SITE = https://www.musl-libc.org/releases
|
||||||
MUSL_REPO = git://git.musl-libc.org/musl
|
MUSL_REPO = git://git.musl-libc.org/musl
|
||||||
|
|
||||||
|
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
|
||||||
|
|
||||||
BUILD_DIR = build-$(TARGET)
|
BUILD_DIR = build-$(TARGET)
|
||||||
|
|
||||||
-include config.mak
|
-include config.mak
|
||||||
|
@ -27,7 +30,8 @@ BUILD_DIR = build-$(TARGET)
|
||||||
SRC_DIRS = gcc-$(GCC_VER) binutils-$(BINUTILS_VER) musl-$(MUSL_VER) \
|
SRC_DIRS = gcc-$(GCC_VER) binutils-$(BINUTILS_VER) musl-$(MUSL_VER) \
|
||||||
$(if $(GMP_VER),gmp-$(GMP_VER)) \
|
$(if $(GMP_VER),gmp-$(GMP_VER)) \
|
||||||
$(if $(MPC_VER),mpc-$(MPC_VER)) \
|
$(if $(MPC_VER),mpc-$(MPC_VER)) \
|
||||||
$(if $(MPFR_VER),mpfr-$(MPFR_VER))
|
$(if $(MPFR_VER),mpfr-$(MPFR_VER)) \
|
||||||
|
$(if $(LINUX_VER),linux-$(LINUX_VER))
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
|
@ -49,6 +53,7 @@ $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/mpfr*)): SITE = $(MPFR_S
|
||||||
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/binutils*)): SITE = $(BINUTILS_SITE)
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/binutils*)): SITE = $(BINUTILS_SITE)
|
||||||
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@)))
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@)))
|
||||||
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/musl*)): SITE = $(MUSL_SITE)
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/musl*)): SITE = $(MUSL_SITE)
|
||||||
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux*)): SITE = $(LINUX_SITE)/v$(patsubst linux-%,%,$(basename $(basename $(basename $(basename $(notdir $@)))))).x
|
||||||
|
|
||||||
$(SOURCES):
|
$(SOURCES):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
@ -102,6 +107,17 @@ musl-git-%:
|
||||||
mv $@.tmp/$@ $@
|
mv $@.tmp/$@ $@
|
||||||
rm -rf $@.tmp
|
rm -rf $@.tmp
|
||||||
|
|
||||||
|
%: $(SOURCES)/%.tar.xz | $(SOURCES)/config.sub
|
||||||
|
rm -rf $@.tmp
|
||||||
|
mkdir $@.tmp
|
||||||
|
( cd $@.tmp && tar Jxvf - ) < $<
|
||||||
|
test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp/$@ && patch -p1 )
|
||||||
|
test ! -f $@.tmp/$@/config.sub || cp -f $(SOURCES)/config.sub $@.tmp/$@
|
||||||
|
rm -rf $@
|
||||||
|
touch $@.tmp/$@
|
||||||
|
mv $@.tmp/$@ $@
|
||||||
|
rm -rf $@.tmp
|
||||||
|
|
||||||
|
|
||||||
# Rules for building.
|
# Rules for building.
|
||||||
|
|
||||||
|
@ -127,6 +143,7 @@ $(BUILD_DIR)/config.mak: | $(BUILD_DIR)
|
||||||
$(if $(GMP_VER),"GMP_SRCDIR = ../gmp-$(GMP_VER)") \
|
$(if $(GMP_VER),"GMP_SRCDIR = ../gmp-$(GMP_VER)") \
|
||||||
$(if $(MPC_VER),"MPC_SRCDIR = ../mpc-$(MPC_VER)") \
|
$(if $(MPC_VER),"MPC_SRCDIR = ../mpc-$(MPC_VER)") \
|
||||||
$(if $(MPFR_VER),"MPFR_SRCDIR = ../mpfr-$(MPFR_VER)") \
|
$(if $(MPFR_VER),"MPFR_SRCDIR = ../mpfr-$(MPFR_VER)") \
|
||||||
|
$(if $(LINUX_VER),"LINUX_SRCDIR = ../linux-$(LINUX_VER)") \
|
||||||
"-include ../config.mak"
|
"-include ../config.mak"
|
||||||
|
|
||||||
all: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak
|
all: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
03b45399a93ae8bc18f1f27ad72f3e98c6bba5c8 linux-4.4.10.tar.xz
|
|
@ -156,6 +156,29 @@ install-toolchain: | obj_toolchain/.lc_built
|
||||||
cd obj_toolchain && $(MAKE) MAKE="$(MAKE)" LC_ROOT=$(PWD) DESTDIR=$(DESTDIR)$(OUTPUT) install
|
cd obj_toolchain && $(MAKE) MAKE="$(MAKE)" LC_ROOT=$(PWD) DESTDIR=$(DESTDIR)$(OUTPUT) install
|
||||||
ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
|
ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
|
||||||
|
|
||||||
|
ifneq ($(LINUX_SRCDIR),)
|
||||||
|
ifneq ($(LINUX_ARCH),)
|
||||||
|
all: kernel-headers
|
||||||
|
install: install-kernel-headers
|
||||||
|
kernel-headers: | obj_kernel_headers
|
||||||
|
src_kernel_headers: | $(LINUX_SRCDIR)
|
||||||
|
mkdir -p $@.tmp/arch/$(LINUX_ARCH)
|
||||||
|
cp -R $(LINUX_SRCDIR)/arch/$(LINUX_ARCH)/include $@.tmp/arch/$(LINUX_ARCH)
|
||||||
|
cp -R $(LINUX_SRCDIR)/arch/$(LINUX_ARCH)/Makefile $@.tmp/arch/$(LINUX_ARCH)
|
||||||
|
cp -R $(LINUX_SRCDIR)/include $@.tmp
|
||||||
|
cp -R $(LINUX_SRCDIR)/scripts $@.tmp
|
||||||
|
cp -R $(LINUX_SRCDIR)/Makefile $@.tmp
|
||||||
|
mv $@.tmp $@
|
||||||
|
obj_kernel_headers: | src_kernel_headers
|
||||||
|
rm -rf $@.tmp
|
||||||
|
cd src_kernel_headers && $(MAKE) ARCH=$(LINUX_ARCH) INSTALL_HDR_PATH=$(PWD)/$@.tmp headers_install
|
||||||
|
mv $@.tmp $@
|
||||||
|
install-kernel-headers: | obj_kernel_headers
|
||||||
|
mkdir -p $(DESTDIR)$(OUTPUT)$(SYSROOT)/include
|
||||||
|
cp -R obj_kernel_headers/include/* $(DESTDIR)$(OUTPUT)$(SYSROOT)/include
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
Loading…
Reference in New Issue