From b15f5f9b56f8e9a63f57ad3073cba99a1c6800f0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 16 Mar 2021 23:06:22 +0100 Subject: [PATCH] - rework crosstools targets --- Makefile | 1 - make/buildsystem-helpers.mk | 2 +- make/crosstool.mk | 134 ------------------ make/environment-build.mk | 4 +- make/environment-linux.mk | 33 +++-- make/linux-drivers.mk | 4 +- make/linux-kernel.mk | 31 ++-- make/target-tools.mk | 4 +- package/crosstool-ng/crosstool-ng.mk | 81 +++++++++++ package/crosstool-ng/crosstools.mk | 47 ++++++ .../crosstool-ng/files/ct-ng-armbox.config | 12 +- .../files/ct-ng-coolstream-hd1.config | 12 +- .../files/ct-ng-coolstream-hd2.config | 12 +- .../crosstool-ng/files/ct-ng-mipsbox.config | 12 +- .../files/ct-ng-uClibc-1.0.24.config | 2 +- ...-version.patch => 0001-bash-version.patch} | 0 16 files changed, 196 insertions(+), 195 deletions(-) delete mode 100644 make/crosstool.mk create mode 100644 package/crosstool-ng/crosstool-ng.mk create mode 100644 package/crosstool-ng/crosstools.mk rename package/crosstool-ng/patches/{crosstool-ng-bash-version.patch => 0001-bash-version.patch} (100%) diff --git a/Makefile b/Makefile index 79d60316..c8108921 100755 --- a/Makefile +++ b/Makefile @@ -188,7 +188,6 @@ include make/buildsystem-clean.mk include make/buildsystem-helpers.mk include make/buildsystem-prerequisites.mk include make/buildsystem-update.mk -include make/crosstool.mk include make/flash-updates.mk include make/flash-images.mk include make/linux-kernel.mk diff --git a/make/buildsystem-helpers.mk b/make/buildsystem-helpers.mk index 80822241..64ccfc37 100644 --- a/make/buildsystem-helpers.mk +++ b/make/buildsystem-helpers.mk @@ -55,7 +55,7 @@ define apply_patches for i in $(1); do \ if [ -e $$i -o -e $(PKG_PATCHES_DIR)/$$i ]; then \ if [ -d $$i ]; then \ - for p in $$i/*; do \ + for p in $$i/*.patch; do \ $(call MESSAGE,"Applying $${p#$(PKG_PATCHES_DIR)/}"); \ if [ $${p:0:1} == "/" ]; then \ patch -p$$l -i $$p; \ diff --git a/make/crosstool.mk b/make/crosstool.mk deleted file mode 100644 index 6bf3ca32..00000000 --- a/make/crosstool.mk +++ /dev/null @@ -1,134 +0,0 @@ -# -# makefile to build crosstools -# -# ----------------------------------------------------------------------------- - -crosstool: $(CROSS_DIR) - -crosstools: - for boxseries in hd1 hd2 hd5x hd6x vusolo4k vuduo4k vuduo4kse vuultimo4k vuzero4k vuuno4k vuuno4kse vuduo; do \ - echo "make crosstool-ng for $${boxseries}"; \ - make BOXSERIES=$${boxseries} crosstool || exit; \ - done; - -# ----------------------------------------------------------------------------- - -CROSSTOOL_BACKUP = $(DL_DIR)/crosstool-ng-$(TARGET_ARCH)-linux-$(KERNEL_VERSION)-backup.tar.gz - -$(CROSSTOOL_BACKUP): - $(call draw_line); - @echo "CROSSTOOL_BACKUP does not exist. You probably need to run 'make crosstool-backup' first." - $(call draw_line); - @false - -crosstool-backup: - $(CD) $(CROSS_DIR); \ - tar -czvf $(CROSSTOOL_BACKUP) * - -crosstool-restore: $(CROSSTOOL_BACKUP) - make cross-clean - mkdir -p $(CROSS_DIR) - tar -xzvf $(CROSSTOOL_BACKUP) -C $(CROSS_DIR) - -# ----------------------------------------------------------------------------- - -crosstools-renew: - for boxseries in hd1 hd2 hd5x hd6x vusolo4k vuduo4k vuduo4kse vuultimo4k vuzero4k vuuno4k vuuno4kse vuduo; do \ - make BOXSERIES=$${boxseries} ccache-clean || exit; \ - done; - make host-clean - make static-base-clean - make cross-base-clean - make crosstools - make clean - -# ----------------------------------------------------------------------------- - -# wrapper for manually call -kernel-tarball: $(BUILD_DIR)/linux-$(KERNEL_VERSION).tar - -# create kernel-tarball -$(BUILD_DIR)/linux-$(KERNEL_VERSION).tar: | $(BUILD_DIR) - $(MAKE) kernel.do_prepare_$(if $(filter $(KERNEL_SOURCE),git),git,tar) - tar cf $(@) --exclude-vcs -C $(BUILD_DIR)/$(KERNEL_DIR) . - -# ----------------------------------------------------------------------------- - -CROSSTOOL_NG_VERSION = git -CROSSTOOL_NG_DIR = crosstool-ng.$(CROSSTOOL_NG_VERSION) -CROSSTOOL_NG_SOURCE = crosstool-ng.$(CROSSTOOL_NG_VERSION) -CROSSTOOL_NG_SITE = https://github.com/neutrino-images - -CROSSTOOL_NG_PATCH = crosstool-ng-bash-version.patch - -CROSSTOOL_NG_CONFIG = $(PACKAGE_DIR)/crosstool-ng/files/ct-ng-$(BOXTYPE).config -ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) - CROSSTOOL_NG_CONFIG = $(PACKAGE_DIR)/crosstool-ng/files/ct-ng-$(BOXTYPE)-$(BOXSERIES).config -endif - -# crosstool for hd2 depends on gcc-linaro -GCC_LINARO_VERSION = 4.9-2017.01 -GCC_LINARO_SOURCE = gcc-linaro-$(GCC_LINARO_VERSION).tar.xz -GCC_LINARO_SITE = https://releases.linaro.org/components/toolchain/gcc-linaro/$(GCC_LINARO_VERSION) - -$(DL_DIR)/$(GCC_LINARO_SOURCE): - $(DOWNLOAD) $(GCC_LINARO_SITE)/$(GCC_LINARO_SOURCE) - -UCLIBC_VERSION = 1.0.24 - -# ----------------------------------------------------------------------------- - -# crosstool for arm-hd2 depends on gcc-linaro -$(CROSS_BASE)/arm/hd2: $(DL_DIR)/$(GCC_LINARO_SOURCE) - -$(CROSS_DIR): | $(BUILD_DIR) - make $(BUILD_DIR)/linux-$(KERNEL_VERSION).tar - # - $(REMOVE)/$(CROSSTOOL_NG_DIR) - $(GET-GIT-SOURCE) $(CROSSTOOL_NG_SITE)/$(CROSSTOOL_NG_SOURCE) $(DL_DIR)/$(CROSSTOOL_NG_SOURCE) - $(CPDIR)/$(CROSSTOOL_NG_SOURCE) -ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) - $(CHDIR)/$(CROSSTOOL_NG_DIR); \ - git checkout 1dbb06f2; \ - $(call apply_patches,$(PACKAGE_DIR)/crosstool-ng/patches/$(CROSSTOOL_NG_PATCH)) - ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd2)) - $(CHDIR)/$(CROSSTOOL_NG_DIR); \ - $(INSTALL_COPY) $(PACKAGE_DIR)/crosstool-ng/patches/gcc/* patches/gcc/linaro-6.3-2017.02 - endif -endif - $(CHDIR)/$(CROSSTOOL_NG_DIR); \ - unset CONFIG_SITE LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE; \ - $(INSTALL_DATA) $(CROSSTOOL_NG_CONFIG) .config; \ - $(SED) "s|^CT_PARALLEL_JOBS=.*|CT_PARALLEL_JOBS=$(PARALLEL_JOBS)|" .config; \ - export NI_LOCAL_TARBALLS_DIR=$(DL_DIR); \ - export NI_PREFIX_DIR=$(@); \ - export NI_KERNEL_VERSION=$(KERNEL_VERSION); \ - export NI_KERNEL_LOCATION=$(BUILD_DIR)/linux-$(KERNEL_VERSION).tar; \ - export NI_LIBC_UCLIBC_CONFIG_FILE=$(PACKAGE_DIR)/crosstool-ng/files/ct-ng-uClibc-$(UCLIBC_VERSION).config; \ - export LD_LIBRARY_PATH=; \ - test -f ./configure || ./bootstrap; \ - ./configure --enable-local; \ - MAKELEVEL=0 make; \ - chmod 0755 ct-ng; \ - ./ct-ng oldconfig; \ - ./ct-ng build -ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) - test -e $(CROSS_DIR)/$(TARGET)/lib && mv $(CROSS_DIR)/$(TARGET)/lib $(CROSS_DIR)/$(TARGET)/lib.x -endif - test -e $(CROSS_DIR)/$(TARGET)/lib || ln -sf sys-root/lib $(CROSS_DIR)/$(TARGET)/ - rm -f $(CROSS_DIR)/$(TARGET)/sys-root/lib/libstdc++.so.6.0.*-gdb.py - $(REMOVE)/$(CROSSTOOL_NG_DIR) - -# ----------------------------------------------------------------------------- - -get-gccversion: - @echo "" - @$(TARGET_CC) --version - -# ----------------------------------------------------------------------------- - -PHONY += crosstool -PHONY += crosstools -PHONY += crosstools-renew - -PHONY += get-gccversion diff --git a/make/environment-build.mk b/make/environment-build.mk index 7a908c0e..fd18731f 100644 --- a/make/environment-build.mk +++ b/make/environment-build.mk @@ -113,9 +113,9 @@ STAGING_DIR = $(BASE_DIR)/staging IMAGE_DIR = $(STAGING_DIR)/images UPDATE_DIR = $(STAGING_DIR)/updates CROSS_BASE = $(BASE_DIR)/cross -CROSS_DIR ?= $(CROSS_BASE)/$(TARGET_ARCH)-linux-$(KERNEL_VERSION) +CROSS_DIR ?= $(CROSS_BASE)/$(TARGET_ARCH)-$(TARGET_OS)-$(KERNEL_VERSION) STATIC_BASE = $(BASE_DIR)/static -STATIC_DIR = $(STATIC_BASE)/$(TARGET_ARCH)-linux-$(KERNEL_VERSION) +STATIC_DIR = $(STATIC_BASE)/$(TARGET_ARCH)-$(TARGET_OS)-$(KERNEL_VERSION) CONFIGS = $(BASE_DIR)/configs PATCHES = $(BASE_DIR)/patches SKEL_ROOT = $(BASE_DIR)/skel-root/$(BOXSERIES) diff --git a/make/environment-linux.mk b/make/environment-linux.mk index 7724fb32..b124552b 100644 --- a/make/environment-linux.mk +++ b/make/environment-linux.mk @@ -34,7 +34,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd51 bre2ze4k h7)) KERNEL_SITE = http://downloads.mutant-digital.net KERNEL_BRANCH = $(empty) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/bcm7445-bcm97445svmb.dtb + KERNEL_DTB = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/dts/bcm7445-bcm97445svmb.dtb KERNEL_CONFIG = $(PKG_FILES_DIR)/kernel-hd5x.defconfig BOOT_PARTITION = 1 @@ -47,7 +47,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd60)) KERNEL_SITE = http://source.mynonpublic.com/gfutures KERNEL_BRANCH = $(empty) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb + KERNEL_DTB = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb KERNEL_CONFIG = $(PKG_FILES_DIR)/kernel-hd6x.defconfig BOOT_PARTITION = 4 @@ -60,7 +60,7 @@ else ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd61)) KERNEL_SITE = http://source.mynonpublic.com/gfutures KERNEL_BRANCH = $(empty) - KERNEL_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb + KERNEL_DTB = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/dts/hi3798mv200.dtb KERNEL_CONFIG = $(PKG_FILES_DIR)/kernel-hd6x.defconfig BOOT_PARTITION = 4 @@ -190,35 +190,38 @@ endif KERNEL_PATCH = $($(call UPPERCASE,$(BOXMODEL))_PATCH) -KERNEL_OBJ = linux-$(KERNEL_VERSION)-obj +KERNEL_OBJ = linux-$(KERNEL_VERSION)-obj +KERNEL_OBJ_DIR = $(BUILD_DIR)/$(KERNEL_OBJ) KERNEL_MODULES = linux-$(KERNEL_VERSION)-modules +KERNEL_MODULES_DIR = $(BUILD_DIR)/$(KERNEL_MODULES) KERNEL_HEADERS = linux-$(KERNEL_VERSION)-headers +KERNEL_HEADERS_DIR = $(BUILD_DIR)/$(KERNEL_HEADERS) KERNEL_CONFIG ?= $(PKG_FILES_DIR)/kernel-$(BOXMODEL).defconfig KERNEL_NAME = NI $(shell echo $(BOXFAMILY) | sed 's/.*/\u&/') Kernel # ----------------------------------------------------------------------------- -KERNEL_modulesdir = $(BUILD_DIR)/$(KERNEL_MODULES)/lib/modules/$(KERNEL_VERSION) +KERNEL_modulesdir = $(KERNEL_MODULES_DIR)/lib/modules/$(KERNEL_VERSION) ifeq ($(BOXMODEL),nevis) - KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/Image + KERNEL_UIMAGE = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/Image else - KERNEL_UIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/uImage + KERNEL_UIMAGE = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/uImage endif -KERNEL_ZIMAGE = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/zImage -KERNEL_ZIMAGE_DTB = $(BUILD_DIR)/$(KERNEL_OBJ)/arch/$(TARGET_ARCH)/boot/zImage_dtb -KERNEL_VMLINUX = $(BUILD_DIR)/$(KERNEL_OBJ)/vmlinux +KERNEL_ZIMAGE = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/zImage +KERNEL_ZIMAGE_DTB = $(KERNEL_OBJ_DIR)/arch/$(TARGET_ARCH)/boot/zImage_dtb +KERNEL_VMLINUX = $(KERNEL_OBJ_DIR)/vmlinux # ----------------------------------------------------------------------------- KERNEL_MAKE_VARS = \ ARCH=$(TARGET_ARCH) \ CROSS_COMPILE=$(TARGET_CROSS) \ - INSTALL_MOD_PATH=$(BUILD_DIR)/$(KERNEL_MODULES) \ - INSTALL_HDR_PATH=$(BUILD_DIR)/$(KERNEL_HEADERS) \ + INSTALL_MOD_PATH=$(KERNEL_MODULES_DIR) \ + INSTALL_HDR_PATH=$(KERNEL_HEADERS_DIR) \ LOCALVERSION= \ - O=$(BUILD_DIR)/$(KERNEL_OBJ) + O=$(KERNEL_OBJ_DIR) # Compatibility variables KERNEL_MAKE_VARS += \ @@ -239,3 +242,7 @@ KERNEL_MAKE_TARGETS = $(KERNEL_IMAGE) ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd51 bre2ze4k h7 hd60 hd61)) KERNEL_MAKE_TARGETS += $(notdir $(KERNEL_DTB)) endif + +# ----------------------------------------------------------------------------- + +KERNEL_TARBALL = $(BUILD_DIR)/linux-$(KERNEL_VERSION).tar diff --git a/make/linux-drivers.mk b/make/linux-drivers.mk index a2e8f20e..380423c9 100644 --- a/make/linux-drivers.mk +++ b/make/linux-drivers.mk @@ -86,8 +86,8 @@ hd6x-mali-drivers: kernel-$(BOXTYPE) hd6x-libgles-headers $(DL_DIR)/$(HD6x_MALI_ $(UNTAR)/$(HD6x_MALI_DRIVERS_SOURCE) $(CHDIR)/$(HD6x_MALI_DRIVERS_DIR); \ $(APPLY_PATCHES); \ - $(MAKE) -C $(BUILD_DIR)/$(KERNEL_OBJ) $(KERNEL_MAKE_VARS) $(HD6x_MALI_DRIVERS_MAKE_VARS); \ - $(MAKE) -C $(BUILD_DIR)/$(KERNEL_OBJ) $(KERNEL_MAKE_VARS) $(HD6x_MALI_DRIVERS_MAKE_VARS) INSTALL_MOD_PATH=$(TARGET_DIR) modules_install + $(MAKE) -C $(KERNEL_OBJ_DIR) $(KERNEL_MAKE_VARS) $(HD6x_MALI_DRIVERS_MAKE_VARS); \ + $(MAKE) -C $(KERNEL_OBJ_DIR) $(KERNEL_MAKE_VARS) $(HD6x_MALI_DRIVERS_MAKE_VARS) INSTALL_MOD_PATH=$(TARGET_DIR) modules_install make depmod $(REMOVE)/$(HD6x_MALI_DRIVERS_DIR) $(TOUCH) diff --git a/make/linux-kernel.mk b/make/linux-kernel.mk index eb6c16a6..e396f217 100644 --- a/make/linux-kernel.mk +++ b/make/linux-kernel.mk @@ -202,18 +202,17 @@ kernel.do_checkout: $(SOURCE_DIR)/$(NI_LINUX_KERNEL) $(CD) $(SOURCE_DIR)/$(NI_LINUX_KERNEL); \ git checkout $(KERNEL_BRANCH) -kernel.do_prepare: +kernel.do_prepare: | $(DEPS_DIR) $(BUILD_DIR) $(MAKE) kernel.do_prepare_$(if $(filter $(KERNEL_SOURCE),git),git,tar) # $(REMOVE)/$(KERNEL_OBJ) $(REMOVE)/$(KERNEL_MODULES) - $(REMOVE)/$(KERNEL_HEADERS) $(MKDIR)/$(KERNEL_OBJ) $(MKDIR)/$(KERNEL_MODULES) - $(MKDIR)/$(KERNEL_HEADERS) - $(INSTALL_DATA) $(KERNEL_CONFIG) $(BUILD_DIR)/$(KERNEL_OBJ)/.config + $(INSTALL_DATA) $(KERNEL_CONFIG) $(KERNEL_OBJ_DIR)/.config + $(MAKE) -C $(BUILD_DIR)/$(KERNEL_DIR) $(KERNEL_MAKE_VARS) silentoldconfig ifeq ($(BOXMODEL),$(filter $(BOXMODEL),hd51 bre2ze4k h7 hd60 hd61)) - $(INSTALL_DATA) $(PKG_FILES_DIR)/initramfs-subdirboot.cpio.gz $(BUILD_DIR)/$(KERNEL_OBJ) + $(INSTALL_DATA) $(PKG_FILES_DIR)/initramfs-subdirboot.cpio.gz $(KERNEL_OBJ_DIR) endif $(TOUCH) @@ -232,11 +231,8 @@ kernel.do_prepare_tar: $(DL_DIR)/$(KERNEL_SOURCE) $(call apply_patches,$(addprefix $(PKG_PATCHES_DIR)/,$(KERNEL_PATCH))) kernel.do_compile: kernel.do_prepare - $(CHDIR)/$(KERNEL_DIR); \ - $(MAKE) $(KERNEL_MAKE_VARS) silentoldconfig; \ - $(MAKE) $(KERNEL_MAKE_VARS) modules $(KERNEL_MAKE_TARGETS); \ - $(MAKE) $(KERNEL_MAKE_VARS) modules_install; \ - $(MAKE) $(KERNEL_MAKE_VARS) headers_install + $(MAKE) -C $(BUILD_DIR)/$(KERNEL_DIR) $(KERNEL_MAKE_VARS) modules $(KERNEL_MAKE_TARGETS) + $(MAKE) -C $(BUILD_DIR)/$(KERNEL_DIR) $(KERNEL_MAKE_VARS) modules_install ifneq ($(KERNEL_DTB),$(empty)) cat $(KERNEL_ZIMAGE) $(KERNEL_DTB) > $(KERNEL_ZIMAGE_DTB) endif @@ -272,11 +268,6 @@ endif $(TOUCH) kernel-armbox: kernel.do_compile | $(IMAGE_DIR) -#ifneq ($(KERNEL_DTB),$(empty)) -# $(INSTALL_DATA) $(KERNEL_ZIMAGE_DTB) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL).bin -#else -# $(INSTALL_DATA) $(KERNEL_ZIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL).bin -#endif $(TOUCH) kernel-mipsbox: kernel.do_compile | $(IMAGE_DIR) @@ -361,4 +352,14 @@ endif # ----------------------------------------------------------------------------- +kernel-headers: $(KERNEL_HEADERS_DIR) +$(KERNEL_HEADERS_DIR): kernel.do_prepare + $(MAKE) -C $(BUILD_DIR)/$(KERNEL_DIR) $(KERNEL_MAKE_VARS) headers_install + +kernel-tarball: $(KERNEL_TARBALL) +$(KERNEL_TARBALL): kernel.do_prepare + tar cf $(@) -C $(BUILD_DIR)/$(KERNEL_DIR) . + +# ----------------------------------------------------------------------------- + PHONY += kernel.do_checkout diff --git a/make/target-tools.mk b/make/target-tools.mk index 9fba6778..631b04a0 100644 --- a/make/target-tools.mk +++ b/make/target-tools.mk @@ -1839,10 +1839,10 @@ DVB_APPS_DIR = dvb-apps.$(DVB_APPS_VERSION) DVB_APPS_SOURCE = dvb-apps.$(DVB_APPS_VERSION) DVB_APPS_SITE = https://github.com/openpli-arm -DVB_APPS_DEPENDENCIES = kernel libiconv +DVB_APPS_DEPENDENCIES = kernel-headers libiconv DVB_APPS_MAKE_OPTS = \ - KERNEL_HEADERS=$(BUILD_DIR)/$(KERNEL_HEADERS) \ + KERNEL_HEADERS=$(KERNEL_HEADERS_DIR) \ enable_shared=no \ PERL5LIB=$(PKG_BUILD_DIR)/util/scan \ diff --git a/package/crosstool-ng/crosstool-ng.mk b/package/crosstool-ng/crosstool-ng.mk new file mode 100644 index 00000000..b4c40fdc --- /dev/null +++ b/package/crosstool-ng/crosstool-ng.mk @@ -0,0 +1,81 @@ +################################################################################ +# +# crosstool-ng +# +################################################################################ + +CROSSTOOL_NG_VERSION = git +CROSSTOOL_NG_DIR = crosstool-ng.$(CROSSTOOL_NG_VERSION) +CROSSTOOL_NG_SOURCE = crosstool-ng.$(CROSSTOOL_NG_VERSION) +CROSSTOOL_NG_SITE = https://github.com/neutrino-images + +CROSSTOOL_NG_DEPS = kernel-tarball + +CROSSTOOL_NG_CONFIG = $(PACKAGE_DIR)/crosstool-ng/files/ct-ng-$(BOXTYPE).config +ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) + CROSSTOOL_NG_CONFIG = $(PACKAGE_DIR)/crosstool-ng/files/ct-ng-$(BOXTYPE)-$(BOXSERIES).config +endif + +# crosstool-ng for hd2 depends on gcc-linaro and uses uclibc +ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd2)) + +CROSSTOOL_NG_PATCH = 0001-bash-version.patch + +GCC_LINARO_VERSION = 4.9-2017.01 +GCC_LINARO_SOURCE = gcc-linaro-$(GCC_LINARO_VERSION).tar.xz +GCC_LINARO_SITE = https://releases.linaro.org/components/toolchain/gcc-linaro/$(GCC_LINARO_VERSION) + +$(DL_DIR)/$(GCC_LINARO_SOURCE): + $(DOWNLOAD) $(GCC_LINARO_SITE)/$(GCC_LINARO_SOURCE) + +CROSSTOOL_NG_DEPS += $(DL_DIR)/$(GCC_LINARO_SOURCE) + +UCLIBC_VERSION = 1.0.24 + +CROSSTOOL_NG_DEPS += kernel-headers + +endif + +ifeq ($(wildcard $(CROSS_DIR)/build.log.bz2),) + +crosstool-ng: $(CROSSTOOL_NG_DEPS) | $(BUILD_DIR) + $(REMOVE)/$($(PKG)_DIR) + $(GET-GIT-SOURCE) $($(PKG)_SITE)/$($(PKG)_SOURCE) $(DL_DIR)/$($(PKG)_SOURCE) + $(CPDIR)/$($(PKG)_SOURCE) +ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) + $(CHDIR)/$($(PKG)_DIR); \ + git checkout 1dbb06f2; \ + $(APPLY_PATCHES) + ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd2)) + $(INSTALL_COPY) $(PKG_PATCHES_DIR)/gcc/* $(PKG_BUILD_DIR)/patches/gcc/linaro-6.3-2017.02 + endif +endif + $(CHDIR)/$($(PKG)_DIR); \ + unset CONFIG_SITE LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE; \ + $(INSTALL_DATA) $(CROSSTOOL_NG_CONFIG) .config; \ + $(SED) "s|^CT_PARALLEL_JOBS=.*|CT_PARALLEL_JOBS=$(PARALLEL_JOBS)|" .config; \ + export BS_LOCAL_TARBALLS_DIR=$(DL_DIR); \ + export BS_PREFIX_DIR=$(CROSS_DIR); \ + export BS_KERNEL_VERSION=$(KERNEL_VERSION); \ + export BS_KERNEL_LOCATION=$(KERNEL_TARBALL); \ + export BS_KERNEL_HEADERS=$(KERNEL_HEADERS_DIR); \ + export BS_LIBC_UCLIBC_CONFIG_FILE=$(PACKAGE_DIR)/crosstool-ng/files/ct-ng-uClibc-$(UCLIBC_VERSION).config; \ + export LD_LIBRARY_PATH=; \ + test -f ./configure || ./bootstrap; \ + ./configure --enable-local; \ + MAKELEVEL=0 make; \ + chmod 0755 ct-ng; \ + ./ct-ng oldconfig; \ + ./ct-ng build +ifeq ($(BOXSERIES),$(filter $(BOXSERIES),hd1 hd2)) + test -e $(CROSS_DIR)/$(TARGET)/lib && mv $(CROSS_DIR)/$(TARGET)/lib $(CROSS_DIR)/$(TARGET)/lib.x +endif + test -e $(CROSS_DIR)/$(TARGET)/lib || ln -sf sys-root/lib $(CROSS_DIR)/$(TARGET)/ + rm -f $(CROSS_DIR)/$(TARGET)/sys-root/lib/libstdc++.so.6.0.*-gdb.py + $(REMOVE)/$($(PKG)_DIR) + +else + +crosstool-ng: + +endif diff --git a/package/crosstool-ng/crosstools.mk b/package/crosstool-ng/crosstools.mk new file mode 100644 index 00000000..1aa5f8c2 --- /dev/null +++ b/package/crosstool-ng/crosstools.mk @@ -0,0 +1,47 @@ +################################################################################ +# +# crosstools +# +################################################################################ + +CROSSTOOL_BOXSERIES = \ + hd1 hd2 \ + hd5x hd6x \ + vusolo4k vuduo4k vuduo4kse vuultimo4k vuzero4k vuuno4k vuuno4kse \ + vuduo + +crosstool: build-clean deps-clean crosstool-ng crosstool-backup + +crosstools: + $(foreach boxseries,$(CROSSTOOL_BOXSERIES),\ + make BOXSERIES=$(boxseries) crosstool$(sep)) + +crosstools-renew: + $(foreach boxseries,$(CROSSTOOL_BOXSERIES),\ + make BOXSERIES=$(boxseries) ccache-clean$(sep)) + make host-clean + make static-base-clean + make cross-base-clean + make crosstools + make clean + +################################################################################ +# +# crosstool-backup +# +################################################################################ + +CROSSTOOL_BACKUP = $(DL_DIR)/crosstool-ng-$(TARGET_ARCH)-$(TARGET_OS)-$(KERNEL_VERSION)-backup.tar.gz + +$(CROSSTOOL_BACKUP): + $(call draw_line); + @echo "CROSSTOOL_BACKUP does not exist. You probably need to run 'make crosstool-backup' first." + $(call draw_line); + @false + +crosstool-backup: + tar czvf $(CROSSTOOL_BACKUP) -C $(CROSS_DIR) . + +crosstool-restore: $(CROSSTOOL_BACKUP) cross-clean + $(INSTALL) -d $(CROSS_DIR) + tar xzvf $(CROSSTOOL_BACKUP) -C $(CROSS_DIR) diff --git a/package/crosstool-ng/files/ct-ng-armbox.config b/package/crosstool-ng/files/ct-ng-armbox.config index 5e7670c8..ada1d51f 100644 --- a/package/crosstool-ng/files/ct-ng-armbox.config +++ b/package/crosstool-ng/files/ct-ng-armbox.config @@ -32,11 +32,11 @@ CT_EXPERIMENTAL=y # # Paths # -CT_LOCAL_TARBALLS_DIR="${NI_LOCAL_TARBALLS_DIR}" +CT_LOCAL_TARBALLS_DIR="${BS_LOCAL_TARBALLS_DIR}" CT_SAVE_TARBALLS=y CT_WORK_DIR="${CT_TOP_DIR}/targets" CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="${NI_PREFIX_DIR}" +CT_PREFIX_DIR="${BS_PREFIX_DIR}" CT_RM_RF_PREFIX_DIR=y CT_REMOVE_DOCS=y # CT_PREFIX_DIR_RO is not set @@ -223,12 +223,12 @@ CT_TOOLCHAIN_ENABLE_NLS=y # CT_KERNEL_SUPPORTS_SHARED_LIBS=y CT_KERNEL="linux" -CT_KERNEL_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_VERSION="${BS_KERNEL_VERSION}" # CT_KERNEL_bare_metal is not set CT_KERNEL_linux=y CT_KERNEL_LINUX_CUSTOM=y -CT_KERNEL_LINUX_CUSTOM_LOCATION="${NI_KERNEL_LOCATION}" -CT_KERNEL_LINUX_CUSTOM_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_LINUX_CUSTOM_LOCATION="${BS_KERNEL_LOCATION}" +CT_KERNEL_LINUX_CUSTOM_VERSION="${BS_KERNEL_VERSION}" # # Common kernel options @@ -357,7 +357,7 @@ CT_LIBC_ADDONS_LIST="" # CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y # CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_LIBC_GLIBC_MIN_KERNEL="${NI_KERNEL_VERSION}" +CT_LIBC_GLIBC_MIN_KERNEL="${BS_KERNEL_VERSION}" # # C compiler diff --git a/package/crosstool-ng/files/ct-ng-coolstream-hd1.config b/package/crosstool-ng/files/ct-ng-coolstream-hd1.config index 4590af24..ced32ed7 100644 --- a/package/crosstool-ng/files/ct-ng-coolstream-hd1.config +++ b/package/crosstool-ng/files/ct-ng-coolstream-hd1.config @@ -37,11 +37,11 @@ CT_DEBUG_CT=y # # Paths # -CT_LOCAL_TARBALLS_DIR="${NI_LOCAL_TARBALLS_DIR}" +CT_LOCAL_TARBALLS_DIR="${BS_LOCAL_TARBALLS_DIR}" CT_SAVE_TARBALLS=y CT_WORK_DIR="${CT_TOP_DIR}/targets" CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="${NI_PREFIX_DIR}" +CT_PREFIX_DIR="${BS_PREFIX_DIR}" CT_RM_RF_PREFIX_DIR=y CT_REMOVE_DOCS=y # CT_BUILD_MANUALS is not set @@ -227,12 +227,12 @@ CT_BUILD_SUFFIX="" # CT_KERNEL_SUPPORTS_SHARED_LIBS=y CT_KERNEL="linux" -CT_KERNEL_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_VERSION="${BS_KERNEL_VERSION}" # CT_KERNEL_bare_metal is not set CT_KERNEL_linux=y CT_KERNEL_LINUX_CUSTOM=y -CT_KERNEL_LINUX_CUSTOM_LOCATION="${NI_KERNEL_LOCATION}" -CT_KERNEL_LINUX_CUSTOM_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_LINUX_CUSTOM_LOCATION="${BS_KERNEL_LOCATION}" +CT_KERNEL_LINUX_CUSTOM_VERSION="${BS_KERNEL_VERSION}" # # Common kernel options @@ -351,7 +351,7 @@ CT_LIBC_ADDONS_LIST="" # CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y # CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_LIBC_GLIBC_MIN_KERNEL="${NI_KERNEL_VERSION}" +CT_LIBC_GLIBC_MIN_KERNEL="${BS_KERNEL_VERSION}" # # C compiler diff --git a/package/crosstool-ng/files/ct-ng-coolstream-hd2.config b/package/crosstool-ng/files/ct-ng-coolstream-hd2.config index 8c2f75e3..b5a16700 100644 --- a/package/crosstool-ng/files/ct-ng-coolstream-hd2.config +++ b/package/crosstool-ng/files/ct-ng-coolstream-hd2.config @@ -33,11 +33,11 @@ CT_EXPERIMENTAL=y # # Paths # -CT_LOCAL_TARBALLS_DIR="${NI_LOCAL_TARBALLS_DIR}" +CT_LOCAL_TARBALLS_DIR="${BS_LOCAL_TARBALLS_DIR}" CT_SAVE_TARBALLS=y CT_WORK_DIR="${CT_TOP_DIR}/targets" CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="${NI_PREFIX_DIR}" +CT_PREFIX_DIR="${BS_PREFIX_DIR}" CT_RM_RF_PREFIX_DIR=y CT_REMOVE_DOCS=y # CT_BUILD_MANUALS is not set @@ -226,12 +226,12 @@ CT_TOOLCHAIN_ENABLE_NLS=y # CT_KERNEL_SUPPORTS_SHARED_LIBS=y CT_KERNEL="linux" -CT_KERNEL_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_VERSION="${BS_KERNEL_VERSION}" # CT_KERNEL_bare_metal is not set CT_KERNEL_linux=y CT_KERNEL_LINUX_CUSTOM=y -CT_KERNEL_LINUX_CUSTOM_LOCATION="${NI_KERNEL_LOCATION}" -CT_KERNEL_LINUX_CUSTOM_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_LINUX_CUSTOM_LOCATION="${BS_KERNEL_LOCATION}" +CT_KERNEL_LINUX_CUSTOM_VERSION="${BS_KERNEL_VERSION}" # # Common kernel options @@ -325,7 +325,7 @@ CT_LIBC_UCLIBC_DEBUG_LEVEL_0=y # CT_LIBC_UCLIBC_DEBUG_LEVEL_2 is not set # CT_LIBC_UCLIBC_DEBUG_LEVEL_3 is not set CT_LIBC_UCLIBC_DEBUG_LEVEL=0 -CT_LIBC_UCLIBC_CONFIG_FILE="${NI_LIBC_UCLIBC_CONFIG_FILE}" +CT_LIBC_UCLIBC_CONFIG_FILE="${BS_LIBC_UCLIBC_CONFIG_FILE}" CT_LIBC_SUPPORT_THREADS_ANY=y CT_LIBC_SUPPORT_THREADS_NATIVE=y CT_LIBC_SUPPORT_THREADS_LT=y diff --git a/package/crosstool-ng/files/ct-ng-mipsbox.config b/package/crosstool-ng/files/ct-ng-mipsbox.config index 1be73827..f97383e9 100644 --- a/package/crosstool-ng/files/ct-ng-mipsbox.config +++ b/package/crosstool-ng/files/ct-ng-mipsbox.config @@ -32,11 +32,11 @@ CT_EXPERIMENTAL=y # # Paths # -CT_LOCAL_TARBALLS_DIR="${NI_LOCAL_TARBALLS_DIR}" +CT_LOCAL_TARBALLS_DIR="${BS_LOCAL_TARBALLS_DIR}" CT_SAVE_TARBALLS=y CT_WORK_DIR="${CT_TOP_DIR}/targets" CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="${NI_PREFIX_DIR}" +CT_PREFIX_DIR="${BS_PREFIX_DIR}" CT_RM_RF_PREFIX_DIR=y CT_REMOVE_DOCS=y # CT_PREFIX_DIR_RO is not set @@ -211,12 +211,12 @@ CT_TOOLCHAIN_ENABLE_NLS=y # CT_KERNEL_SUPPORTS_SHARED_LIBS=y CT_KERNEL="linux" -CT_KERNEL_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_VERSION="${BS_KERNEL_VERSION}" # CT_KERNEL_bare_metal is not set CT_KERNEL_linux=y CT_KERNEL_LINUX_CUSTOM=y -CT_KERNEL_LINUX_CUSTOM_LOCATION="${NI_KERNEL_LOCATION}" -CT_KERNEL_LINUX_CUSTOM_VERSION="${NI_KERNEL_VERSION}" +CT_KERNEL_LINUX_CUSTOM_LOCATION="${BS_KERNEL_LOCATION}" +CT_KERNEL_LINUX_CUSTOM_VERSION="${BS_KERNEL_VERSION}" # # Common kernel options @@ -341,7 +341,7 @@ CT_LIBC_ADDONS_LIST="" # CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y # CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_LIBC_GLIBC_MIN_KERNEL="${NI_KERNEL_VERSION}" +CT_LIBC_GLIBC_MIN_KERNEL="${BS_KERNEL_VERSION}" # # C compiler diff --git a/package/crosstool-ng/files/ct-ng-uClibc-1.0.24.config b/package/crosstool-ng/files/ct-ng-uClibc-1.0.24.config index 30c07be2..0303edf7 100644 --- a/package/crosstool-ng/files/ct-ng-uClibc-1.0.24.config +++ b/package/crosstool-ng/files/ct-ng-uClibc-1.0.24.config @@ -52,7 +52,7 @@ UCLIBC_HAS_FPU=y DO_C99_MATH=y # DO_XSI_MATH is not set # UCLIBC_HAS_FENV is not set -KERNEL_HEADERS="${NI_BASE_DIR}/source/ni-linux-kernel/include" +KERNEL_HEADERS="${BS_KERNEL_HEADERS}" HAVE_DOT_CONFIG=y # diff --git a/package/crosstool-ng/patches/crosstool-ng-bash-version.patch b/package/crosstool-ng/patches/0001-bash-version.patch similarity index 100% rename from package/crosstool-ng/patches/crosstool-ng-bash-version.patch rename to package/crosstool-ng/patches/0001-bash-version.patch