diff --git a/Makefile b/Makefile index 00639ae59535ee9cbebf08681878e654d471bbf8..9cac37a730fc0f7526eeb832b84fed7057c5cfa3 100644 --- a/Makefile +++ b/Makefile @@ -180,35 +180,32 @@ PREBUILT_QEMU := $(PREBUILT_DIR)/qemu #QEMU_GIT ?= https://github.com/qemu/qemu.git QEMU_GIT ?= https://gitee.com/mirrors/qemu.git _QEMU_GIT := $(QEMU_GIT) -_QEMU_SRC ?= qemu +_QEMU_SRC ?= $(if $(QEMU_FORK),$(call _lc,$(QEMU_FORK)-qemu),qemu) QEMU_SRC ?= $(_QEMU_SRC) #UBOOT_GIT ?= https://github.com/u-boot/u-boot.git UBOOT_GIT ?= https://gitee.com/mirrors/u-boot.git _UBOOT_GIT := $(UBOOT_GIT) -_UBOOT_SRC ?= u-boot +_UBOOT_SRC ?= $(if $(UBOOT_FORK),$(call _lc,$(UBOOT_FORK)-uboot),u-boot) UBOOT_SRC ?= $(_UBOOT_SRC) +# could switch to other kernel fork for example openEuler #KERNEL_GIT ?= https://github.com/tinyclub/linux-stable.git #KERNEL_GIT ?= https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git KERNEL_GIT ?= https://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/stable/linux.git #KERNEL_GIT ?= git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git _KERNEL_GIT := $(KERNEL_GIT) -_KERNEL_SRC ?= linux-stable +_KERNEL_SRC ?= $(if $(KERNEL_FORK),$(call _lc,$(KERNEL_FORK)-kernel),linux-stable) KERNEL_SRC ?= $(_KERNEL_SRC) # Use faster mirror instead of git://git.buildroot.net/buildroot.git #ROOT_GIT ?= https://github.com/buildroot/buildroot ROOT_GIT ?= https://gitee.com/mirrors/buildroot.git _ROOT_GIT := $(ROOT_GIT) -_ROOT_SRC ?= buildroot +_ROOT_SRC ?= $(if $(ROOT_FORK),$(call _lc,$(ROOT_FORK)-buildroot),buildroot) ROOT_SRC ?= $(_ROOT_SRC) -_LINUX=$(LINUX) -KERNEL_ABS_SRC := $(TOP_SRC)/$(KERNEL_SRC) -ROOT_ABS_SRC := $(TOP_SRC)/$(ROOT_SRC) -UBOOT_ABS_SRC := $(TOP_SRC)/$(UBOOT_SRC) -QEMU_ABS_SRC := $(TOP_SRC)/$(QEMU_SRC) +_LINUX = $(LINUX) BOARD_MAKEFILE := $(BOARD_DIR)/Makefile @@ -233,7 +230,7 @@ $($(1)[$(2)_$($(2))$(if $($(3)),$(comma)$(3)_$($(3)))]) endef define __v -$(if $($(3)),$(if $(call ___v,$1,$2,$3),$(call ___v,$1,$2,$3),$(call ___v,$1,$2)),$(call ___v,$1,$2)) +$(if $($(3)),$(if $(call ___v,$1,$2,$3),$(call ___v,$1,$2,$3),$(if $(call ___v,$1,$2),$(call ___v,$1,$2),$(call ___v,$1,$3))),$(call ___v,$1,$2)) endef define _v @@ -329,6 +326,12 @@ ifneq ($(BOARD),) # include $(BOARD_DIR)/.labinit $(eval $(call _bi,labinit)) $(eval $(call _bi,labconfig)) + + _QEMU_FORK := $(if $(QEMU_FORK),$(call _lc,$(QEMU_FORK))/,) + _UBOOT_FORK := $(if $(UBOOT_FORK),$(call _lc,$(UBOOT_FORK))/,) + _KERNEL_FORK := $(if $(KERNEL_FORK),$(call _lc,$(KERNEL_FORK))/,) + _ROOT_FORK := $(if $(ROOT_FORK),$(call _lc,$(ROOT_FORK))/,) + ifeq ($(BOARD_MAKEFILE), $(wildcard $(BOARD_MAKEFILE))) include $(BOARD_MAKEFILE) endif @@ -337,8 +340,20 @@ ifneq ($(BOARD),) endif # Customize kernel git repo and local dir -$(eval $(call __vs,KERNEL_SRC,LINUX)) -$(eval $(call __vs,KERNEL_GIT,LINUX)) +$(eval $(call __vs,KERNEL_SRC,LINUX,KERNEL_FORK)) +$(eval $(call __vs,KERNEL_GIT,LINUX,KERNEL_FORK)) +$(eval $(call __vs,ROOT_SRC,BUILDROOT,ROOT_FORK)) +$(eval $(call __vs,ROOT_GIT,BUILDROOT,ROOT_FORK)) +$(eval $(call __vs,UBOOT_SRC,UBOOT,UBOOT_FORK)) +$(eval $(call __vs,UBOOT_GIT,UBOOT,UBOOT_FORK)) +$(eval $(call __vs,QEMU_SRC,QEMU,QEMU_FORK)) +$(eval $(call __vs,QEMU_GIT,QEMU,QEMU_FORK)) + +# Allow boards to customize source and repos +KERNEL_ABS_SRC := $(TOP_SRC)/$(KERNEL_SRC) +ROOT_ABS_SRC := $(TOP_SRC)/$(ROOT_SRC) +UBOOT_ABS_SRC := $(TOP_SRC)/$(UBOOT_SRC) +QEMU_ABS_SRC := $(TOP_SRC)/$(QEMU_SRC) $(eval $(call __vs,DTS,LINUX)) $(eval $(call __vs,DTB,LINUX)) @@ -662,10 +677,10 @@ _QTOOL := $(QTOOL) # Core build: for building in standalone directories TOP_BUILD := $(TOP_DIR)/build TOP_BUILD_ARCH := $(TOP_BUILD)/$(XARCH) -QEMU_BUILD := $(TOP_BUILD_ARCH)/qemu-$(QEMU)-$(MACH) -UBOOT_BUILD := $(TOP_BUILD_ARCH)/uboot-$(UBOOT)-$(MACH) -KERNEL_BUILD := $(TOP_BUILD_ARCH)/linux-$(LINUX)-$(MACH) -ROOT_BUILD := $(TOP_BUILD_ARCH)/buildroot-$(BUILDROOT)-$(MACH) +QEMU_BUILD := $(TOP_BUILD_ARCH)/$(_QEMU_FORK)qemu-$(QEMU)-$(MACH) +UBOOT_BUILD := $(TOP_BUILD_ARCH)/$(_UBOOT_FORK)uboot-$(UBOOT)-$(MACH) +KERNEL_BUILD := $(TOP_BUILD_ARCH)/$(_KERNEL_FORK)linux-$(LINUX)-$(MACH) +ROOT_BUILD := $(TOP_BUILD_ARCH)/$(_ROOT_FORK)buildroot-$(BUILDROOT)-$(MACH) BSP_BUILD := $(TOP_BUILD_ARCH)/bsp-$(MACH) # Cross Compiler toolchains @@ -901,13 +916,13 @@ endif # Prebuilt path (not top dir) setting ifneq ($(_BIMAGE),) - PREBUILT_UBOOT_DIR ?= $(dir $(_BIMAGE)) + PREBUILT_UBOOT_DIR ?= $(subst //,,$(dir $(_BIMAGE))/) endif ifneq ($(_KIMAGE),) - PREBUILT_KERNEL_DIR ?= $(dir $(_KIMAGE)) + PREBUILT_KERNEL_DIR ?= $(subst //,,$(dir $(_KIMAGE))/) endif ifneq ($(_ROOTFS),) - PREBUILT_ROOT_DIR ?= $(dir $(_ROOTFS)) + PREBUILT_ROOT_DIR ?= $(subst //,,$(dir $(_ROOTFS))/) endif ifneq ($(_QTOOL),) PREBUILT_QEMU_DIR ?= $(patsubst %/bin/,%,$(dir $(_QTOOL))) @@ -1434,7 +1449,7 @@ $$(call _stamp_$(1),source): $$(call _stamp_$(1),outdir) @echo $$(Q)if [ -e $$($(call _uc,$(1))_SRC_FULL)/.git ]; then \ [ -d $$($(call _uc,$(1))_SRC_FULL) ] && cd $$($(call _uc,$(1))_SRC_FULL); \ - if [ $$(shell [ -d $$($(call _uc,$(1))_SRC_FULL) ] && cd $$($(call _uc,$(1))_SRC_FULL) && git show --pretty=oneline -q $(or $$(__$(call _uc,$(2))),$$(_$(call _uc,$(2)))) >/dev/null 2>&1; echo $$$$?) -ne 0 ]; then \ + if [ $$(shell [ -d $$($(call _uc,$(1))_SRC_FULL) ] && cd $$($(call _uc,$(1))_SRC_FULL) && git show --pretty=oneline -q $$(or $$(__$(call _uc,$(2))),$$(_$(call _uc,$(2)))) >/dev/null 2>&1; echo $$$$?) -ne 0 ]; then \ $$($(call _uc,$(1))_GITADD); \ git fetch --tags $$(or $$($(call _uc,$(1))_GITREPO),origin) && touch $$@; \ fi; \ @@ -1560,7 +1575,7 @@ __stamp_$(1)=$$(_stamp_$(1)) endif endif -$(call _uc,$1)_CONFIG_FILE ?= $(2)_$$($(call _uc,$(2)))_defconfig +$(call _uc,$1)_CONFIG_FILE ?= $$(_$(call _uc,$(1))_FORK)$(2)_$$($(call _uc,$(2)))_defconfig $(3)CFG ?= $$($(call _uc,$1)_CONFIG_FILE) ifeq ($$($(3)CFG),$$($(call _uc,$1)_CONFIG_FILE)) diff --git a/boards/aarch64/virt/Makefile b/boards/aarch64/virt/Makefile index 7cb9420f639636f3fdb082fd11c3a8a2cb07ab90..4da3022d63f86342901f2a80278b3fae32dbb2ff 100644 --- a/boards/aarch64/virt/Makefile +++ b/boards/aarch64/virt/Makefile @@ -19,6 +19,9 @@ CCORI[UBOOT_v2019.10,OS_focal] = internal LINUX ?= v5.1 BUILDROOT?= 2019.11.1 +# git repos for other kernel fork +KERNEL_GIT[KERNEL_FORK_openeuler] := https://gitee.com/openeuler/kernel.git + NETDEV_LIST := virtio NETDEV ?= virtio @@ -47,7 +50,7 @@ ROOTDEV ?= /dev/vda FSTYPE ?= ext2 ORIIMG ?= arch/$(ARCH)/boot/Image -KIMAGE ?= $(BSP_KERNEL)/$(LINUX)/Image +KIMAGE ?= $(BSP_KERNEL)/$(_KERNEL_FORK)$(LINUX)/Image # Get DRAM start & size via `bdinfo` KRN_ADDR?= 0x45000000 @@ -78,6 +81,10 @@ endif # Run uboot as bios, use -bios instead of -kernel UBOOT_BIOS ?= 1 +BSP_ROOT := $(BSP_DIR)/root/$(_ROOT_FORK) +BSP_KERNEL := $(BSP_DIR)/kernel/$(_KERNEL_FORK) +BSP_UBOOT := $(BSP_DIR)/uboot/$(_UBOOT_FORK) +BSP_QEMU := $(BSP_DIR)/qemu/$(_QEMU_FORK) BIMAGE ?= $(BSP_UBOOT)/$(UBOOT)/$(LINUX)/u-boot.bin DTS ?= $(BSP_KERNEL)/$(LINUX)/virt-gicv3.dts # DTB is loaded by QEMU automatically at start of RAM, we load a new one for easier customization diff --git a/boards/aarch64/virt/bsp b/boards/aarch64/virt/bsp index b2d22ae4079162cf8200e71a10170b98843a91af..d6c0ff98a5b86c3eece2da2a767305baaf06759d 160000 --- a/boards/aarch64/virt/bsp +++ b/boards/aarch64/virt/bsp @@ -1 +1 @@ -Subproject commit b2d22ae4079162cf8200e71a10170b98843a91af +Subproject commit d6c0ff98a5b86c3eece2da2a767305baaf06759d diff --git a/boards/x86_64/pc/Makefile b/boards/x86_64/pc/Makefile index 2f568bf047ec7d714c321d1495023a30cb0cd91d..cd1f1376ec3d4d2a5c5c5222d83bd2acd4525d6a 100644 --- a/boards/x86_64/pc/Makefile +++ b/boards/x86_64/pc/Makefile @@ -9,6 +9,9 @@ MEM ?= 128M SMP ?= 4 LINUX ?= v5.1 +# git repos for other kernel fork +KERNEL_GIT[KERNEL_FORK_openeuler] := https://gitee.com/openeuler/kernel.git + GCC = 9 GCC[LINUX_v3.2] = 4.8 GCC[LINUX_v2.6.12.6] = 4.8 @@ -36,6 +39,8 @@ ROOTDEV_LIST := /dev/hda /dev/ram0 /dev/nfs ROOTDEV_LIST[LINUX_v3.2] := /dev/sda /dev/ram0 /dev/nfs ROOTDEV ?= /dev/ram0 +BSP_ROOT := $(BSP_DIR)/root/$(_ROOT_FORK) +BSP_KERNEL := $(BSP_DIR)/kernel/$(_KERNEL_FORK) KIMAGE ?= $(BSP_KERNEL)/$(LINUX)/bzImage ROOTFS ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs.cpio.gz ROOTFS[LINUX_v2.6.12.6] ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs32.cpio.gz diff --git a/boards/x86_64/pc/bsp b/boards/x86_64/pc/bsp index a1c040c22c655b469a5a49c5533485d1d28f29bf..0078bd0a6b85cfa958f66e226bb248b43c842997 160000 --- a/boards/x86_64/pc/bsp +++ b/boards/x86_64/pc/bsp @@ -1 +1 @@ -Subproject commit a1c040c22c655b469a5a49c5533485d1d28f29bf +Subproject commit 0078bd0a6b85cfa958f66e226bb248b43c842997 diff --git a/src/linux-stable b/src/linux-stable index 92d21ac74a9e3c09b0b01c764e530657e4c85c49..e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd 160000 --- a/src/linux-stable +++ b/src/linux-stable @@ -1 +1 @@ -Subproject commit 92d21ac74a9e3c09b0b01c764e530657e4c85c49 +Subproject commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd