diff --git a/.gitignore b/.gitignore index bb828c6..2032466 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /mpc-*/ /mpfr-*/ /build-*/ +/linux-*/ diff --git a/Makefile b/Makefile index e85ccba..ae2423f 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ MUSL_VER = 1.1.14 GMP_VER = 6.1.0 MPC_VER = 1.0.3 MPFR_VER = 3.1.4 +LINUX_VER = 4.4.10 GNU_SITE = https://ftp.gnu.org/pub/gnu GCC_SITE = $(GNU_SITE)/gcc @@ -20,6 +21,8 @@ MPFR_SITE = $(GNU_SITE)/mpfr MUSL_SITE = https://www.musl-libc.org/releases MUSL_REPO = git://git.musl-libc.org/musl +LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel + BUILD_DIR = build-$(TARGET) -include config.mak @@ -27,7 +30,8 @@ BUILD_DIR = build-$(TARGET) SRC_DIRS = gcc-$(GCC_VER) binutils-$(BINUTILS_VER) musl-$(MUSL_VER) \ $(if $(GMP_VER),gmp-$(GMP_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: @@ -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/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@))) $(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): mkdir -p $@ @@ -102,6 +107,17 @@ musl-git-%: mv $@.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. @@ -127,6 +143,7 @@ $(BUILD_DIR)/config.mak: | $(BUILD_DIR) $(if $(GMP_VER),"GMP_SRCDIR = ../gmp-$(GMP_VER)") \ $(if $(MPC_VER),"MPC_SRCDIR = ../mpc-$(MPC_VER)") \ $(if $(MPFR_VER),"MPFR_SRCDIR = ../mpfr-$(MPFR_VER)") \ + $(if $(LINUX_VER),"LINUX_SRCDIR = ../linux-$(LINUX_VER)") \ "-include ../config.mak" all: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak diff --git a/hashes/linux-4.4.10.tar.xz.sha1 b/hashes/linux-4.4.10.tar.xz.sha1 new file mode 100644 index 0000000..22ae6bf --- /dev/null +++ b/hashes/linux-4.4.10.tar.xz.sha1 @@ -0,0 +1 @@ +03b45399a93ae8bc18f1f27ad72f3e98c6bba5c8 linux-4.4.10.tar.xz diff --git a/litecross/Makefile b/litecross/Makefile index e55b390..316a8ed 100644 --- a/litecross/Makefile +++ b/litecross/Makefile @@ -156,6 +156,29 @@ install-toolchain: | obj_toolchain/.lc_built cd obj_toolchain && $(MAKE) MAKE="$(MAKE)" LC_ROOT=$(PWD) DESTDIR=$(DESTDIR)$(OUTPUT) install 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 clean: