diff --git a/Makefile b/Makefile index 8fc21cae..5fb2567b 100755 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ include make/gstreamer.mk include make/host-tools.mk include make/image-update.mk include make/images.mk -include make/kernel-$(BOXTYPE).mk +include make/linux-kernel.mk include make/neutrino.mk include make/plugins-extra.mk include make/plugins.mk diff --git a/make/bootstrap.mk b/make/bootstrap.mk index 6e342ba5..8365e192 100644 --- a/make/bootstrap.mk +++ b/make/bootstrap.mk @@ -16,6 +16,7 @@ BOOTSTRAP += includes BOOTSTRAP += libs BOOTSTRAP += firmware BOOTSTRAP += modules +#BOOTSTRAP += kernel.do_prepare BOOTSTRAP += host-preqs ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2 hd51)) diff --git a/make/environment-build.mk b/make/environment-build.mk index 402cb4f8..46029560 100644 --- a/make/environment-build.mk +++ b/make/environment-build.mk @@ -177,14 +177,11 @@ DEBUG ?= no # ----------------------------------------------------------------------------- -KERNEL_NAME = NI $(shell echo $(BOXMODEL) | sed 's/.*/\u&/') Kernel - ifeq ($(BOXSERIES), hd1) - KERNEL_VERSION = 2.6.34.13 KERNEL_VERSION_MAJOR = 2.6.34 + KERNEL_VERSION = 2.6.34.13 KERNEL_VERSION_FULL = $(KERNEL_VERSION)-$(BOXMODEL) - KERNEL_BRANCH = ni/2.6.34.x - KERNEL_DTB = + DRIVERS_DIR = nevis CORTEX-STRINGS = TARGET = arm-cx2450x-linux-gnueabi @@ -195,16 +192,14 @@ ifeq ($(BOXSERIES), hd1) CXX11_ABI = else ifeq ($(BOXSERIES), hd2) - KERNEL_VERSION = 3.10.93 KERNEL_VERSION_MAJOR = 3.10 + KERNEL_VERSION = 3.10.93 KERNEL_VERSION_FULL = $(KERNEL_VERSION) - KERNEL_BRANCH = ni/3.10.x + ifeq ($(BOXFAMILY), apollo) - KERNEL_DTB = hd849x DRIVERS_DIR = apollo endif ifeq ($(BOXFAMILY), kronos) - KERNEL_DTB = en75x1 DRIVERS_DIR = kronos endif CORTEX-STRINGS = -lcortex-strings @@ -224,8 +219,7 @@ else ifeq ($(BOXSERIES), hd51) KERNEL_VERSION_MAJOR = 4.10 KERNEL_VERSION = 4.10.12 KERNEL_VERSION_FULL = $(KERNEL_VERSION) - KERNEL_BRANCH = ni/4.10.x - KERNEL_DTB = bcm7445-bcm97445svmb + DRIVERS_DIR = hd51 CORTEX-STRINGS = -lcortex-strings TARGET = arm-cortex-linux-gnueabihf @@ -234,6 +228,7 @@ else ifeq ($(BOXSERIES), hd51) TARGET_EXTRA_CFLAGS = TARGET_EXTRA_LDFLAGS = CXX11_ABI = + endif STATIC_LIB_DIR = $(STATIC_DIR)/lib @@ -288,6 +283,9 @@ MKDIR = mkdir -p $(BUILD_TMP) TOUCH = @touch $@ STRIP = $(TARGET)-strip +# empty variable EMPTY for smoother comparisons +EMPTY = + BUILDENV = \ CC=$(TARGET)-gcc \ CXX=$(TARGET)-g++ \ diff --git a/make/images.mk b/make/images.mk index e5149a03..07acc52f 100644 --- a/make/images.mk +++ b/make/images.mk @@ -117,7 +117,7 @@ flash-image-armbox: IMAGE_MD5FILE=$(IMAGE_TYPE_STRING)-$(IMAGE_SUFFIX).txt flash-image-armbox: IMAGE_DATE=$(shell cat $(ROOTFS)/.version | grep "^version=" | cut -d= -f2 | cut -c 5-) flash-image-armbox: mkdir -p $(IMAGE_BUILD_TMP)/$(BOXMODEL) - cp $(ZIMAGE_DTB) $(IMAGE_BUILD_TMP)/$(BOXMODEL)/kernel.bin + cp $(KERNEL_ZIMAGE_DTB) $(IMAGE_BUILD_TMP)/$(BOXMODEL)/kernel.bin cd $(ROOTFS); \ tar -cvf $(IMAGE_BUILD_TMP)/$(BOXMODEL)/rootfs.tar -C $(ROOTFS) . > /dev/null 2>&1; \ bzip2 $(IMAGE_BUILD_TMP)/$(BOXMODEL)/rootfs.tar @@ -190,13 +190,13 @@ flash-image-armbox-multi: mcopy -i $(IMAGE_BUILD_TMP)/$(HD51_BOOT_IMAGE) -v $(IMAGE_BUILD_TMP)/STARTUP_3 :: mcopy -i $(IMAGE_BUILD_TMP)/$(HD51_BOOT_IMAGE) -v $(IMAGE_BUILD_TMP)/STARTUP_4 :: dd conv=notrunc if=$(IMAGE_BUILD_TMP)/$(HD51_BOOT_IMAGE) of=$(EMMC_IMAGE) bs=$(BLOCK_SIZE) seek=$(shell expr $(IMAGE_ROOTFS_ALIGNMENT) \* $(BLOCK_SECTOR)) - dd conv=notrunc if=$(ZIMAGE_DTB) of=$(EMMC_IMAGE) bs=$(BLOCK_SIZE) seek=$(shell expr $(KERNEL_PARTITION_OFFSET) \* $(BLOCK_SECTOR)) + dd conv=notrunc if=$(KERNEL_ZIMAGE_DTB) of=$(EMMC_IMAGE) bs=$(BLOCK_SIZE) seek=$(shell expr $(KERNEL_PARTITION_OFFSET) \* $(BLOCK_SECTOR)) resize2fs $(IMAGE_BUILD_TMP)/$(HD51_IMAGE_LINK) $(ROOTFS_PARTITION_SIZE_MULTI)k # Truncate on purpose dd if=$(IMAGE_BUILD_TMP)/$(HD51_IMAGE_LINK) of=$(EMMC_IMAGE) bs=$(BLOCK_SIZE) seek=$(shell expr $(ROOTFS_PARTITION_OFFSET) \* $(BLOCK_SECTOR)) # Create final USB-image mkdir -p $(IMAGE_DIR)/$(BOXMODEL) - cp $(ZIMAGE_DTB) $(IMAGE_DIR)/$(BOXMODEL)/kernel.bin + cp $(KERNEL_ZIMAGE_DTB) $(IMAGE_DIR)/$(BOXMODEL)/kernel.bin cp $(EMMC_IMAGE) $(IMAGE_DIR)/$(BOXMODEL) cd $(ROOTFS); \ tar -cvf $(IMAGE_DIR)/$(BOXMODEL)/rootfs.tar -C $(ROOTFS) . > /dev/null 2>&1; \ diff --git a/make/kernel-armbox.mk b/make/kernel-armbox.mk deleted file mode 100644 index 627cf025..00000000 --- a/make/kernel-armbox.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# makefile to build armbox kernel -# -# ----------------------------------------------------------------------------- - -DTB = $(BUILD_TMP)/linux-$(KERNEL_VERSION)/arch/$(BOXARCH)/boot/dts/$(KERNEL_DTB).dtb -ZIMAGE = $(BUILD_TMP)/linux-$(KERNEL_VERSION)/arch/$(BOXARCH)/boot/zImage -ZIMAGE_DTB = $(BUILD_TMP)/linux-$(KERNEL_VERSION)/arch/$(BOXARCH)/boot/zImage_DTB -MODULES_DIR = $(BUILD_TMP)/linux-$(KERNEL_VERSION)-modules/lib/modules/$(KERNEL_VERSION_FULL) - -KERNEL_MAKEVARS := \ - ARCH=$(BOXARCH) \ - CROSS_COMPILE=$(TARGET)- \ - INSTALL_MOD_PATH=$(BUILD_TMP)/linux-$(KERNEL_VERSION)-modules - -# ----------------------------------------------------------------------------- - -$(D)/kernel-armbox: $(SOURCE_DIR)/$(NI_LINUX-KERNEL) | $(TARGET_DIR) - $(REMOVE)/linux-$(KERNEL_VERSION) - cd $(SOURCE_DIR)/$(NI_LINUX-KERNEL); \ - git checkout $(KERNEL_BRANCH) - tar -C $(SOURCE_DIR) -cp $(NI_LINUX-KERNEL) --exclude-vcs | tar -C $(BUILD_TMP) -x - cd $(BUILD_TMP); \ - mv $(NI_LINUX-KERNEL) linux-$(KERNEL_VERSION) - $(CHDIR)/linux-$(KERNEL_VERSION); \ - touch .scmversion; \ - cp $(CONFIGS)/kernel-$(KERNEL_VERSION_MAJOR)-$(BOXFAMILY).config $(BUILD_TMP)/linux-$(KERNEL_VERSION)/.config; \ - $(MKDIR)/linux-$(KERNEL_VERSION)-modules; \ - $(MAKE) $(KERNEL_MAKEVARS) silentoldconfig; \ - $(MAKE) $(KERNEL_MAKEVARS) $(DTB_VER); \ - $(MAKE) $(KERNEL_MAKEVARS) zImage; \ - cat $(ZIMAGE) $(DTB) > $(ZIMAGE_DTB); \ - $(MAKE) $(KERNEL_MAKEVARS) modules; \ - $(MAKE) $(KERNEL_MAKEVARS) modules_install - $(TOUCH) - -kernel-armbox-modules: $(D)/kernel-armbox - cp -a $(MODULES_DIR)/kernel $(TARGET_MODULES_DIR) - cp -a $(MODULES_DIR)/modules.builtin $(TARGET_MODULES_DIR) - cp -a $(MODULES_DIR)/modules.order $(TARGET_MODULES_DIR) - make depmod-armbox - -depmod-armbox: - PATH=$(PATH):/sbin:/usr/sbin depmod -b $(TARGET_DIR) $(KERNEL_VERSION_FULL) diff --git a/make/kernel-coolstream.mk b/make/kernel-coolstream.mk deleted file mode 100644 index f7b0ede7..00000000 --- a/make/kernel-coolstream.mk +++ /dev/null @@ -1,144 +0,0 @@ -# -# makefile to build coolstream kernel -# -# ----------------------------------------------------------------------------- - -DTB = $(SOURCE_DIR)/$(NI_DRIVERS-BIN)/$(BOXTYPE)/$(DRIVERS_DIR)/kernel-dtb/$(KERNEL_DTB).dtb -IMAGE = $(BUILD_TMP)/linux-$(KERNEL_VERSION)/arch/$(BOXARCH)/boot/Image -ZIMAGE = $(BUILD_TMP)/linux-$(KERNEL_VERSION)/arch/$(BOXARCH)/boot/zImage -MODULES_DIR = $(BUILD_TMP)/linux-$(KERNEL_VERSION)-modules/lib/modules/$(KERNEL_VERSION_FULL) - -ifneq ($(wildcard $(SKEL_ROOT)-$(BOXFAMILY)),) - KERNEL_DESTDIR = $(SKEL_ROOT)-$(BOXFAMILY)/var/update -else - KERNEL_DESTDIR = $(SKEL_ROOT)/var/update -endif - -KERNEL_MAKEVARS := \ - ARCH=$(BOXARCH) \ - CROSS_COMPILE=$(TARGET)- \ - INSTALL_MOD_PATH=$(BUILD_TMP)/linux-$(KERNEL_VERSION)-modules - -# ----------------------------------------------------------------------------- - -kernel-coolstream: kernel-coolstream-$(BOXSERIES) -kernel-coolstream-install: kernel-coolstream-install-$(BOXSERIES) - -kernel-coolstream-install-all: - make clean BOXFAMILY=nevis - $(MAKE) kernel-coolstream-hd1 BOXFAMILY=nevis - make kernel-coolstream-install-hd1 BOXFAMILY=nevis - # - make clean BOXFAMILY=apollo - $(MAKE) kernel-coolstream-hd2 BOXFAMILY=apollo - make kernel-coolstream-install-hd2 BOXFAMILY=apollo - # - make clean BOXFAMILY=kronos - $(MAKE) kernel-coolstream-hd2 BOXFAMILY=kronos - make kernel-coolstream-install-hd2 BOXFAMILY=kronos - # - make clean BOXFAMILY=nevis > /dev/null 2>&1 - make get-update-info-hd1 BOXFAMILY=nevis - # - make clean BOXFAMILY=apollo > /dev/null 2>&1 - make get-update-info-hd2 BOXFAMILY=apollo - # - make clean BOXFAMILY=kronos > /dev/null 2>&1 - make get-update-info-hd2 BOXFAMILY=kronos - # - make clean > /dev/null 2>&1 - -$(D)/kernel-coolstream-hd2: $(SOURCE_DIR)/$(NI_LINUX-KERNEL) $(SOURCE_DIR)/$(NI_DRIVERS-BIN) | $(TARGET_DIR) - $(REMOVE)/linux-$(KERNEL_VERSION) - cd $(SOURCE_DIR)/$(NI_LINUX-KERNEL); \ - git checkout $(KERNEL_BRANCH) - tar -C $(SOURCE_DIR) -cp $(NI_LINUX-KERNEL) --exclude-vcs | tar -C $(BUILD_TMP) -x - cd $(BUILD_TMP); \ - mv $(NI_LINUX-KERNEL) linux-$(KERNEL_VERSION) - $(CHDIR)/linux-$(KERNEL_VERSION); \ - touch .scmversion; \ - cp $(CONFIGS)/kernel-$(KERNEL_VERSION_MAJOR)-$(BOXFAMILY).config $(BUILD_TMP)/linux-$(KERNEL_VERSION)/.config; \ - sed -i -e 's/SUBLEVEL = 108/SUBLEVEL = 93/g' Makefile; \ - $(MKDIR)/linux-$(KERNEL_VERSION)-modules; \ - $(MAKE) $(KERNEL_MAKEVARS) silentoldconfig; \ - $(MAKE) $(KERNEL_MAKEVARS) zImage; \ - $(MAKE) $(KERNEL_MAKEVARS) modules; \ - $(MAKE) $(KERNEL_MAKEVARS) modules_install; \ - cat $(ZIMAGE) $(DTB) > zImage_DTB; \ - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "$(KERNEL_NAME)" -d zImage_DTB $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz -ifeq ($(BOXFAMILY), apollo) - ifeq ($(BOXMODEL), apollo) - cp -a $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-shiner-vmlinux.ub.gz - else ifeq ($(BOXMODEL), shiner) - cp -a $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-apollo-vmlinux.ub.gz - endif -endif - $(TOUCH) - -kernel-coolstream-install-hd2: $(D)/kernel-coolstream-hd2 - cp -af $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(KERNEL_DESTDIR)/vmlinux.ub.gz - -$(D)/kernel-coolstream-hd1: $(SOURCE_DIR)/$(NI_LINUX-KERNEL) | $(TARGET_DIR) - $(REMOVE)/linux-$(KERNEL_VERSION) - cd $(SOURCE_DIR)/$(NI_LINUX-KERNEL); \ - git checkout $(KERNEL_BRANCH) - tar -C $(SOURCE_DIR) -cp $(NI_LINUX-KERNEL) --exclude-vcs | tar -C $(BUILD_TMP) -x - cd $(BUILD_TMP); \ - mv $(NI_LINUX-KERNEL) linux-$(KERNEL_VERSION) - $(CHDIR)/linux-$(KERNEL_VERSION); \ - touch .scmversion; \ - cp $(CONFIGS)/kernel-$(KERNEL_VERSION_MAJOR)-$(BOXFAMILY).config $(BUILD_TMP)/linux-$(KERNEL_VERSION)/.config; \ - sed -i -e 's/EXTRAVERSION = .15/EXTRAVERSION = .13/g' Makefile; \ - $(MKDIR)/linux-$(KERNEL_VERSION)-modules; \ - $(MAKE) $(KERNEL_MAKEVARS) silentoldconfig; \ - $(MAKE) $(KERNEL_MAKEVARS) zImage; \ - $(MAKE) $(KERNEL_MAKEVARS) modules; \ - $(MAKE) $(KERNEL_MAKEVARS) modules_install; \ - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(IMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-uImage.img; \ - mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(ZIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img - $(TOUCH) - -kernel-coolstream-install-hd1: $(D)/kernel-coolstream-hd1 - cp -af $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img $(KERNEL_DESTDIR)/zImage - -kernel-coolstream-modules: kernel-coolstream-modules-$(BOXSERIES) - -kernel-coolstream-modules-hd1: kernel-coolstream - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/mtd/devices/mtdram.ko - cp -af $(MODULES_DIR)/kernel/drivers/mtd/devices/mtdram.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/mtd/devices/block2mtd.ko - cp -af $(MODULES_DIR)/kernel/drivers/mtd/devices/block2mtd.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/net/tun.ko - cp -af $(MODULES_DIR)/kernel/drivers/net/tun.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/staging/rt2870/rt2870sta.ko - cp -af $(MODULES_DIR)/kernel/drivers/staging/rt2870/rt2870sta.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.ko - cp -af $(MODULES_DIR)/kernel/drivers/usb/serial/ftdi_sio.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.ko - cp -af $(MODULES_DIR)/kernel/drivers/usb/serial/pl2303.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.ko - cp -af $(MODULES_DIR)/kernel/drivers/usb/serial/usbserial.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/fs/autofs4/autofs4.ko - cp -af $(MODULES_DIR)/kernel/fs/autofs4/autofs4.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/fs/cifs/cifs.ko - cp -af $(MODULES_DIR)/kernel/fs/cifs/cifs.ko $(TARGET_MODULES_DIR) - $(TARGET)-objcopy --strip-unneeded $(MODULES_DIR)/kernel/fs/fuse/fuse.ko - cp -af $(MODULES_DIR)/kernel/fs/fuse/fuse.ko $(TARGET_MODULES_DIR) - rm -rf $(TARGET_MODULES_DIR)/usb-storage.ko # builtin already - make depmod-hd1 - -kernel-coolstream-modules-hd2: kernel-coolstream - rm -rf $(TARGET_MODULES_DIR)/kernel # nuke coolstream kernel-drivers but leave coolstream extra-drivers - cp -a $(MODULES_DIR)/kernel $(TARGET_MODULES_DIR) # copy own kernel-drivers - cp -a $(MODULES_DIR)/modules.builtin $(TARGET_MODULES_DIR) - cp -a $(MODULES_DIR)/modules.order $(TARGET_MODULES_DIR) - make depmod-hd2 - -depmod-hd1: - PATH=$(PATH):/sbin:/usr/sbin depmod -b $(TARGET_DIR) $(KERNEL_VERSION_FULL) - mv $(TARGET_MODULES_DIR)/modules.dep $(TARGET_MODULES_DIR)/.modules.dep - rm $(TARGET_MODULES_DIR)/modules.* - mv $(TARGET_MODULES_DIR)/.modules.dep $(TARGET_MODULES_DIR)/modules.dep - -depmod-hd2: - PATH=$(PATH):/sbin:/usr/sbin depmod -b $(TARGET_DIR) $(KERNEL_VERSION_FULL) diff --git a/make/linux-kernel.mk b/make/linux-kernel.mk new file mode 100644 index 00000000..b5091a6b --- /dev/null +++ b/make/linux-kernel.mk @@ -0,0 +1,188 @@ +# +# makefile to build linux-kernel +# +# ----------------------------------------------------------------------------- + +KERNEL_NAME = NI $(shell echo $(BOXMODEL) | sed 's/.*/\u&/') Kernel +KERNEL_BRANCH = ni/$(KERNEL_VERSION_MAJOR).x + +KERNEL_SRC = linux-$(KERNEL_VERSION) +KERNEL_OBJ = linux-$(KERNEL_VERSION)-obj +KERNEL_MODULES = linux-$(KERNEL_VERSION)-modules + +KERNEL_MODULES_DIR = $(BUILD_TMP)/$(KERNEL_MODULES)/lib/modules/$(KERNEL_VERSION_FULL) +KERNEL_CONFIG = $(CONFIGS)/kernel-$(KERNEL_VERSION_MAJOR)-$(BOXFAMILY).config + +KERNEL_UIMAGE = $(BUILD_TMP)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/Image +KERNEL_ZIMAGE = $(BUILD_TMP)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/zImage +KERNEL_ZIMAGE_DTB = $(BUILD_TMP)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/zImage_dtb + +# ----------------------------------------------------------------------------- + +KERNEL_DTB = $(EMPTY) +ifeq ($(BOXSERIES)-$(BOXFAMILY), hd2-apollo) + KERNEL_DTB = $(SOURCE_DIR)/$(NI_DRIVERS-BIN)/$(BOXTYPE)/$(DRIVERS_DIR)/kernel-dtb/hd849x.dtb +else ifeq ($(BOXSERIES)-$(BOXFAMILY), hd2-kronos) + KERNEL_DTB = $(SOURCE_DIR)/$(NI_DRIVERS-BIN)/$(BOXTYPE)/$(DRIVERS_DIR)/kernel-dtb/en75x1.dtb +else ifeq ($(BOXSERIES), hd51) + KERNEL_DTB = $(BUILD_TMP)/$(KERNEL_OBJ)/arch/$(BOXARCH)/boot/dts/bcm7445-bcm97445svmb.dtb +endif + +# ----------------------------------------------------------------------------- + +KERNEL_MAKEVARS := \ + ARCH=$(BOXARCH) \ + CROSS_COMPILE=$(TARGET)- \ + INSTALL_MOD_PATH=$(BUILD_TMP)/$(KERNEL_MODULES) \ + LOCALVERSION= \ + O=$(BUILD_TMP)/$(KERNEL_OBJ) + +# ----------------------------------------------------------------------------- + +kernel.do_checkout: $(SOURCE_DIR)/$(NI_LINUX-KERNEL) + cd $(SOURCE_DIR)/$(NI_LINUX-KERNEL); \ + git checkout $(KERNEL_BRANCH) + +$(D)/kernel.do_prepare: kernel.do_checkout + $(REMOVE)/$(KERNEL_SRC) + $(REMOVE)/$(KERNEL_OBJ) + $(REMOVE)/$(KERNEL_MODULES) + tar -C $(SOURCE_DIR) -cp $(NI_LINUX-KERNEL) --exclude-vcs | tar -C $(BUILD_TMP) -x + cd $(BUILD_TMP); \ + mv $(NI_LINUX-KERNEL) $(KERNEL_SRC) + $(MKDIR)/$(KERNEL_OBJ) + $(MKDIR)/$(KERNEL_MODULES) + install -m 644 $(KERNEL_CONFIG) $(BUILD_TMP)/$(KERNEL_OBJ)/.config +ifeq ($(BOXTYPE)-$(BOXSERIES), coolstream-hd1) + sed -i -e 's/EXTRAVERSION = .15/EXTRAVERSION = .13/g' $(BUILD_TMP)/$(KERNEL_SRC)/Makefile +else ifeq ($(BOXTYPE)-$(BOXSERIES), coolstream-hd2) + sed -i -e 's/SUBLEVEL = 108/SUBLEVEL = 93/g' $(BUILD_TMP)/$(KERNEL_SRC)/Makefile +endif + $(TOUCH) + +$(D)/kernel.do_compile: $(D)/kernel.do_prepare + $(CHDIR)/$(KERNEL_SRC); \ + $(MAKE) $(KERNEL_MAKEVARS) silentoldconfig; \ + $(MAKE) $(KERNEL_MAKEVARS); \ + $(MAKE) $(KERNEL_MAKEVARS) modules_install +ifneq ($(KERNEL_DTB), $(EMPTY)) + cat $(KERNEL_ZIMAGE) $(KERNEL_DTB) > $(KERNEL_ZIMAGE_DTB) +endif + $(TOUCH) + +# ----------------------------------------------------------------------------- + +$(D)/kernel-coolstream: $(D)/kernel-coolstream-$(BOXSERIES) + $(TOUCH) + +$(D)/kernel-coolstream-hd1: $(D)/kernel.do_compile + mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_UIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-uImage.img + mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x48000 -e 0x48000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img + $(TOUCH) + +$(D)/kernel-coolstream-hd2: $(D)/kernel.do_compile + mkimage -A $(BOXARCH) -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "$(KERNEL_NAME)" -d $(KERNEL_ZIMAGE_DTB) $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz +ifeq ($(BOXFAMILY), apollo) + ifeq ($(BOXMODEL), apollo) + cp -a $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-shiner-vmlinux.ub.gz + else ifeq ($(BOXMODEL), shiner) + cp -a $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-apollo-vmlinux.ub.gz + endif +endif + $(TOUCH) + +$(D)/kernel-armbox: $(D)/kernel.do_compile + $(TOUCH) + +# ----------------------------------------------------------------------------- + +kernel-modules-coolstream: kernel-modules-coolstream-$(BOXSERIES) + +STRIP-MODULES-COOLSTREAM-HD1 = +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/mtd/devices/mtdram.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/mtd/devices/block2mtd.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/net/tun.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/staging/rt2870/rt2870sta.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/usb/serial/ftdi_sio.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/usb/serial/pl2303.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/drivers/usb/serial/usbserial.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/fs/autofs4/autofs4.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/fs/cifs/cifs.ko +STRIP-MODULES-COOLSTREAM-HD1 += kernel/fs/fuse/fuse.ko + +kernel-modules-coolstream-hd1: kernel-coolstream + for module in $(STRIP-MODULES-COOLSTREAM-HD1); do \ + mkdir -p $(TARGET_MODULES_DIR)/$$(dirname "$$module"); \ + $(TARGET)-objcopy --strip-unneeded $(KERNEL_MODULES_DIR)/$$module $(TARGET_MODULES_DIR)/$$module; \ + done; + rm -f $(TARGET_MODULES_DIR)/usb-storage.ko # already builtin + make depmod + +kernel-modules-coolstream-hd2: kernel-coolstream + rm -rf $(TARGET_MODULES_DIR)/kernel # nuke coolstream kernel-drivers but leave coolstream extra-drivers + cp -a $(KERNEL_MODULES_DIR)/kernel $(TARGET_MODULES_DIR) # copy own kernel-drivers + cp -a $(KERNEL_MODULES_DIR)/modules.builtin $(TARGET_MODULES_DIR) + cp -a $(KERNEL_MODULES_DIR)/modules.order $(TARGET_MODULES_DIR) + make depmod + +kernel-modules-armbox: kernel-armbox + cp -a $(KERNEL_MODULES_DIR)/kernel $(TARGET_MODULES_DIR) + cp -a $(KERNEL_MODULES_DIR)/modules.builtin $(TARGET_MODULES_DIR) + cp -a $(KERNEL_MODULES_DIR)/modules.order $(TARGET_MODULES_DIR) + make depmod + +# ----------------------------------------------------------------------------- + +depmod: + PATH=$(PATH):/sbin:/usr/sbin depmod -b $(TARGET_DIR) $(KERNEL_VERSION_FULL) +ifeq ($(BOXSERIES), hd1) + mv $(TARGET_MODULES_DIR)/modules.dep $(TARGET_MODULES_DIR)/.modules.dep + rm $(TARGET_MODULES_DIR)/modules.* + mv $(TARGET_MODULES_DIR)/.modules.dep $(TARGET_MODULES_DIR)/modules.dep +endif + +# ----------------------------------------------------------------------------- + +# install coolstream kernels to skel-root + +ifneq ($(wildcard $(SKEL_ROOT)-$(BOXFAMILY)),) + KERNEL_DESTDIR = $(SKEL_ROOT)-$(BOXFAMILY)/var/update +else + KERNEL_DESTDIR = $(SKEL_ROOT)/var/update +endif + +kernel-install-coolstream: kernel-install-coolstream-$(BOXSERIES) + +kernel-install-coolstream-hd1: $(D)/kernel-coolstream-hd1 + cp -af $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-zImage.img $(KERNEL_DESTDIR)/zImage + +kernel-install-coolstream-hd2: $(D)/kernel-coolstream-hd2 + cp -af $(IMAGE_DIR)/kernel-$(BOXTYPE_SC)-$(BOXMODEL)-vmlinux.ub.gz $(KERNEL_DESTDIR)/vmlinux.ub.gz + +kernel-install-coolstream-all: + make clean BOXFAMILY=nevis + $(MAKE) kernel-coolstream-hd1 BOXFAMILY=nevis + make kernel-install-coolstream-hd1 BOXFAMILY=nevis + # + make clean BOXFAMILY=apollo + $(MAKE) kernel-coolstream-hd2 BOXFAMILY=apollo + make kernel-install-coolstream-hd2 BOXFAMILY=apollo + # + make clean BOXFAMILY=kronos + $(MAKE) kernel-coolstream-hd2 BOXFAMILY=kronos + make kernel-install-coolstream-hd2 BOXFAMILY=kronos + # + make clean BOXFAMILY=nevis > /dev/null 2>&1 + make get-update-info-hd1 BOXFAMILY=nevis + # + make clean BOXFAMILY=apollo > /dev/null 2>&1 + make get-update-info-hd2 BOXFAMILY=apollo + # + make clean BOXFAMILY=kronos > /dev/null 2>&1 + make get-update-info-hd2 BOXFAMILY=kronos + # + make clean > /dev/null 2>&1 + +# ----------------------------------------------------------------------------- + +PHONY += kernel.do_checkout diff --git a/make/ni.mk b/make/ni.mk index f2bd8cb3..0a5d8a6e 100644 --- a/make/ni.mk +++ b/make/ni.mk @@ -76,7 +76,7 @@ ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2 hd51)) $(MAKE) gdb endif endif - $(MAKE) kernel-$(BOXTYPE)-modules + $(MAKE) kernel-modules-$(BOXTYPE) make autofs5 make scripts make init-scripts