Build kernel compatible to the official OpenWRT release

This commit is contained in:
Matthias Schiffer 2013-02-18 00:39:44 +01:00
parent e237cc561b
commit 3e923d0e6a
6 changed files with 3494 additions and 41 deletions

View File

@ -48,8 +48,10 @@ include $(TOPDIR)/include/host.mk
_SINGLE=export MAKEFLAGS=$(space);
override OPENWRT_BUILD=1
override REVISION:=$(shell $(GLUON_BUILDERDIR)/openwrt_rev.sh $(GLUONDIR))
GREP_OPTIONS=
export OPENWRT_BUILD GREP_OPTIONS
export OPENWRT_BUILD GREP_OPTIONS REVISION
include $(TOPDIR)/include/debug.mk
include $(TOPDIR)/include/depends.mk
include $(TOPDIR)/include/toplevel.mk
@ -81,7 +83,8 @@ include $(TOPDIR)/include/host.mk
include rules.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
include target/Makefile
include $(INCLUDE_DIR)/kernel.mk
include package/Makefile
include tools/Makefile
include toolchain/Makefile
@ -109,12 +112,7 @@ $(BUILD_DIR)/.prepared: Makefile
@touch $@
$(toolchain/stamp-install): $(tools/stamp-install)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(package/stamp-cleanup): $(target/stamp-compile)
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile)
$(package/stamp-rootfs-prepare): $(package/stamp-install)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
$(package/stamp-compile): $(package/stamp-cleanup)
feeds: FORCE
ln -sf $(GLUON_BUILDERDIR)/feeds.conf feeds.conf
@ -132,8 +130,19 @@ config: FORCE
$(SUBMAKE) defconfig OPENWRT_BUILD=0
toolchain: $(toolchain/stamp-install) $(tools/stamp-install)
target: $(target/stamp-compile)
kernel: FORCE
$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.image TARGET_BUILD=1
$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.modules TARGET_BUILD=1
packages: $(package/stamp-compile)
$(_SINGLE)$(SUBMAKE) -r package/index
prepare-image: FORCE
rm -rf $(BOARD_KDIR)
mkdir -p $(BOARD_KDIR)
cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/
$(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)"
prepare: FORCE
mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD)
@ -142,9 +151,9 @@ prepare: FORCE
$(GLUONMAKE) feeds
$(GLUONMAKE) config
$(GLUONMAKE) toolchain
$(GLUONMAKE) target
$(GLUONMAKE) kernel
$(GLUONMAKE) packages
$(SUBMAKE) -C $(GLUON_BUILDERDIR) prepare
$(GLUONMAKE) prepare-image
touch $(gluon_prepared_stamp)

View File

@ -17,10 +17,7 @@ include $(TOPDIR)/rules.mk
PACKAGE_DIR := $(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages
BIN_DIR := $(GLUON_IMAGEDIR)/$(BOARD)/$(PROFILE)
BOARD_BUILDDIR := $(GLUON_BUILDDIR)/$(BOARD)
PROFILE_BUILDDIR := $(BOARD_BUILDDIR)/$(PROFILE)
BOARD_KDIR := $(BOARD_BUILDDIR)/kernel
PROFILE_KDIR := $(PROFILE_BUILDDIR)/kernel
TMP_DIR := $(PROFILE_BUILDDIR)/tmp
@ -70,20 +67,10 @@ BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(PROFILE)_PACKAGE
BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
PACKAGES:=
include $(INCLUDE_DIR)/kernel-build.mk
prepare: FORCE
$(Kernel/CompileImage)
rm -rf $(BOARD_KDIR)
mkdir -p $(BOARD_KDIR)
cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/
$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)"
$(MAKE) package_index
image/%:: FORCE
$(MAKE) assemble_image PROFILE="$(patsubst image/%,%,$@)"
assemble_image:
assemble_image: FORCE
echo 'Building images for $(BOARD)$(if $($(PROFILE)_NAME), - $($(PROFILE)_NAME))'
echo 'Packages: $(BUILD_PACKAGES)'
echo
@ -91,19 +78,9 @@ assemble_image:
mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(TARGET_DIR)/tmp
$(OPKG) update
$(MAKE) package_install
ifneq ($(USER_FILES),)
$(MAKE) copy_files
endif
$(MAKE) package_postinst
$(MAKE) build_image
package_index: FORCE
@echo
@echo Building package index...
(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
gzip -9c Packages > Packages.gz \
) >/dev/null 2>/dev/null
package_install: FORCE
@echo
@echo Installing packages...
@ -153,12 +130,8 @@ build_image: FORCE
$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="gluon-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \
PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)"
image:
(unset PROFILE FILES PACKAGES MAKEFLAGS; \
$(MAKE) image/$(PROFILE) OPENWRT_VERBOSE="$(OPENWRT_VERBOSE)" \
$(if $(FILES),USER_FILES="$(FILES)") \
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
)
image: FORCE
$(MAKE) image/$(PROFILE) V="$(OPENWRT_VERBOSE)" $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")
.SILENT: prepare image

11
builder/Makefile.target Normal file
View File

@ -0,0 +1,11 @@
override define Kernel/Configure
cp $(GLUONDIR)/kernel/config-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) $(LINUX_DIR)/.config
$(MAKE) $(KERNEL_MAKEOPTS) oldnoconfig
$(call Kernel/SetInitramfs)
rm -rf $(KERNEL_BUILD_DIR)/modules
[ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
cp $(GLUONDIR)/kernel/vermagic-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) $(LINUX_DIR)/.vermagic
endef
# The Makefile included here is $(TOPDIR)/target/linux/$(BOARD)/Makefile
include Makefile

View File

@ -7,6 +7,9 @@ GLUON_OPENWRTDIR := $(GLUONDIR)/openwrt
GLUON_BUILDERDIR := $(GLUONDIR)/builder
GLUON_BUILDDIR := $(GLUONDIR)/build
BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(BOARD)
BOARD_KDIR = $(BOARD_BUILDDIR)/kernel
export GLUONDIR GLUON_SITEDIR GLUON_IMAGEDIR GLUON_OPENWRTDIR GLUON_BUILDERDIR GLUON_BUILDDIR
$(GLUON_SITEDIR)/site.mk:

3456
kernel/config-ar71xx-generic Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
5440da3a2c45184a32da6bba25b8dd2a