From 48054fc943e11467b0a2b93e0293a968dff09273 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 18 Jul 2015 21:21:06 +0200 Subject: [PATCH] Add update-vermagic make target --- Makefile | 21 +++++++++++++++++---- docs/dev/hardware.rst | 5 +++-- include/gluon.mk | 4 +++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 187a5acb..d19354d8 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,13 @@ manifest: FORCE mkdir -p $(GLUON_IMAGEDIR)/sysupgrade mv $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp $(GLUON_IMAGEDIR)/sysupgrade/$(GLUON_BRANCH).manifest +update-vermagic: FORCE + @$(CheckExternal) + +($(foreach GLUON_TARGET,$(GLUON_TARGETS), \ + $(GLUONMAKE_EARLY) maybe-prepare-target GLUON_TARGET='$(GLUON_TARGET)' V=s$(OPENWRT_VERBOSE) && \ + $(GLUONMAKE) update-vermagic GLUON_TARGET='$(GLUON_TARGET)' V=s$(OPENWRT_VERBOSE) && \ + ) :) + dirclean : FORCE for dir in build_dir dl staging_dir tmp; do \ rm -rf $(GLUON_ORIGOPENWRTDIR)/$$dir; \ @@ -364,9 +371,7 @@ package_install: FORCE if [ ! -x $(TARGET_DIR)/bin/opkg ]; then rm -rf $(TARGET_DIR)/usr/lib/opkg; fi -ifeq ($(GLUON_OPKG_CONFIG),1) include $(INCLUDE_DIR)/version.mk -endif opkg_config: FORCE cp $(GLUON_OPENWRTDIR)/package/system/opkg/files/opkg.conf $(TARGET_DIR)/etc/opkg.conf @@ -382,7 +387,7 @@ image: FORCE cp -r $(BOARD_KDIR) $(PROFILE_KDIR) +$(GLUONMAKE) package_install - +$(GLUONMAKE) opkg_config GLUON_OPKG_CONFIG=1 + +$(GLUONMAKE) opkg_config $(call Image/mkfs/prepare) $(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IMG_PREFIX=gluon \ @@ -418,7 +423,15 @@ manifest: FORCE ) : \ ) >> $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp +update-vermagic: FORCE + mkdir -p '$(BOARD_BUILDDIR)' + echo '$(DEFAULT_OPKG_REPO)' > '$(BOARD_BUILDDIR)/default_opkg_repo' + $(VERSION_SED) '$(BOARD_BUILDDIR)/default_opkg_repo' + wget -q -O- "$$(cat '$(BOARD_BUILDDIR)/default_opkg_repo')/base/Packages.gz" \ + | gzip -d \ + | awk '/Depends: kernel / { match($$3,/[[:xdigit:]]{32}/,m); print m[0]; exit }' \ + > $(GLUONDIR)/targets/$(GLUON_TARGET)/vermagic -.PHONY: all images prepare clean gluon-tools manifest +.PHONY: all images prepare clean gluon-tools manifest update-vermagic endif diff --git a/docs/dev/hardware.rst b/docs/dev/hardware.rst index d2f3424a..2e8e2491 100644 --- a/docs/dev/hardware.rst +++ b/docs/dev/hardware.rst @@ -84,8 +84,9 @@ The file ``config`` can be used to add additional, target-specific options to th The files ``vermagic`` must have the correct content so kernel modules from the upstream repositories can be installed without dependency issues. The OpenWrt version a Gluon release is based on is defined by the upstream package repo URL in ``include/gluon.mk`` -(in the variable ``CONFIG_VERSION_REPO``); at the time this documentation was written, this was ``barrier_breaker/14.07``; whenever -the package repo is updated, all ``vermagic`` files must be updated as well. +(in the variable ``DEFAULT_OPKG_REPO``); at the time this documentation was written, this was ``barrier_breaker/14.07``; whenever +the package repo is updated, all ``vermagic`` files must be updated as well. The command ``make update-vermagic`` can be used to get the correct +vermagic, or update the values when ``DEFAULT_OPKG_REPO`` has changed. The content is a hash which is part of the version number of the kernel package. So in the case of ``ar71xx-generic`` on ``barrier_breaker``, we look for the kernel package in the directory ``https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/``. diff --git a/include/gluon.mk b/include/gluon.mk index 5047eb68..3373ab29 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -35,7 +35,9 @@ export GLUON_LANGS ifeq ($(OPENWRT_BUILD),1) ifeq ($(GLUON_TOOLS),1) -CONFIG_VERSION_REPO := $(shell $(GLUONDIR)/scripts/site.sh opkg_repo || echo http://downloads.openwrt.org/chaos_calmer/15.05-rc2/%S/packages) +DEFAULT_OPKG_REPO := http://downloads.openwrt.org/chaos_calmer/15.05-rc2/%S/packages + +CONFIG_VERSION_REPO := $(shell $(GLUONDIR)/scripts/site.sh opkg_repo || echo '$(DEFAULT_OPKG_REPO)') export CONFIG_VERSION_REPO GLUON_SITE_CODE := $(shell $(GLUONDIR)/scripts/site.sh site_code)