Changeset 517 for trunk/openwrt


Ignore:
Timestamp:
Jun 26, 2013, 11:25:44 PM (6 years ago)
Author:
amain
Message:

Merge contrib branch 340:516. Main features added:

  • updated plugin architecture
  • improved patch system
  • bitten continous integration support
  • sever build fixed over time to remain in sync with OpenWrt
Location:
trunk
Files:
11 deleted
5 edited
17 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/openwrt

    • Property svn:ignore
      •  

        old new  
        77prepare
        88files-copy
         9unpatch
  • trunk/openwrt/openwrt-deliver.mk

    r332 r517  
    5050        @echo OPENWRT_LINUX_DIR=$(OPENWRT_LINUX_DIR)
    5151
    52 openwrt/deliver/check: ${OPENWRT_BIN_DIR} openwrt/deliver/import-config
     52openwrt/deliver/check: $(OPENWRT_BIN_DIR) openwrt/deliver/import-config
    5353  ifndef OPENWRT_PACKAGE_DIR
    5454        @echo OPENWRT_PACKAGE_DIR$(ERROR_MSG_NOCONF) && false
     
    7272openwrt/deliver/image: openwrt/deliver/prepare
    7373        mkdir -p $(INSTALL_DIR)
    74         find ${OPENWRT_BIN_DIR} -maxdepth 1 -type f | while read fname; do \
     74        find $(OPENWRT_BIN_DIR) -maxdepth 1 -type f | while read fname; do \
    7575                tfname=`basename $$fname`; \
    7676                tfname=`echo $$tfname | sed 's/openwrt/debwrt-firmware/'`; \
     
    8181        mkdir -p $(INSTALL_DIR) $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_OPENWRT_MODULES)
    8282        mkdir -p $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
    83         cp -r ${OPENWRT_TMP_DIR}/modules/lib/modules/${OPENWRT_LINUX_UNAME_VERSION} $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
    84         rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_UNAME_VERSION}/build
    85         rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_UNAME_VERSION}/source
     83        cp -r $(OPENWRT_TMP_DIR)/modules/lib/modules/$(OPENWRT_LINUX_UNAME_VERSION) $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
     84        rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/$(OPENWRT_LINUX_UNAME_VERSION)/build
     85        rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/$(OPENWRT_LINUX_UNAME_VERSION)/source
    8686        find $(OPENWRT_PACKAGE_DIR) -name "kmod-*" | while read fkmod; do \
    8787            $(SCRIPT_EXTRACT_KMODPKG) $$fkmod $(INSTALL_DIR_OPENWRT_MODULES) $(TMP_DIR) || true; \
    8888        done
    89         PATH="/sbin:/bin:/usr/sbin:/usr/bin" depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) ${OPENWRT_LINUX_UNAME_VERSION}
     89        PATH="/sbin:/bin:/usr/sbin:/usr/bin" depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) $(OPENWRT_LINUX_UNAME_VERSION)
    9090        tar czf $(INSTALL_DIR)/$(MODULES_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_MODULES) .
    9191
     
    9393        rm -rf $(INSTALL_DIR_OPENWRT_HEADERS)
    9494        mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)
    95         mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_UNAME_VERSION}
    96         cd $(OPENWRT_LINUX_DIR) && make headers_install ARCH=$(patsubst %el,%,$(TARGET_ARCH)) INSTALL_HDR_PATH=$(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_UNAME_VERSION}
     95        mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)
     96        cd $(OPENWRT_LINUX_DIR) && $(MAKE) headers_install ARCH=$(patsubst %el,%,$(TARGET_ARCH)) INSTALL_HDR_PATH=$(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)
    9797        # some overrides which are not cleanly installed by make headers_install
    98         cp $(OPENWRT_LINUX_DIR)/include/linux/switch.h $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_UNAME_VERSION}/include/linux/switch.h
    99         cp ${OPENWRT_LINUX_DIR}/.config $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_UNAME_VERSION}
     98        cp $(OPENWRT_LINUX_DIR)/include/linux/switch.h $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)/include/linux/switch.h
     99        cp $(OPENWRT_LINUX_DIR)/.config $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)
    100100        tar czf $(INSTALL_DIR)/$(HEADERS_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_HEADERS) .
    101101
     
    105105
    106106openwrt/deliver/config: openwrt/deliver/prepare
    107         cp ${TOPDIR}/.config $(INSTALL_DIR)/config-debwrt
    108         cp ${OPENWRT_BUILD_DIR}/.config $(INSTALL_DIR)/config-openwrt
    109         cp ${OPENWRT_LINUX_DIR}/.config $(INSTALL_DIR)/config-kernel-${OPENWRT_LINUX_VERSION}
     107        cp $(TOPDIR)/.config $(INSTALL_DIR)/config-debwrt
     108        cp $(OPENWRT_BUILD_DIR)/.config $(INSTALL_DIR)/config-openwrt
     109        cp $(OPENWRT_LINUX_DIR)/.config $(INSTALL_DIR)/config-kernel-$(OPENWRT_LINUX_VERSION)
    110110        $(SCRIPT_GET_SVN_REVISION) $(OPENWRT_LINUX_DIR) > $(INSTALL_DIR)/openwrt-svn-revision
    111111        $(SCRIPT_GET_SVN_REVISION) $(TOPDIR) > $(INSTALL_DIR)/debwrt-svn-revision
  • trunk/openwrt/openwrt.mk

    r336 r517  
    22#
    33# Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net>
     4#
     5# Copyright (C) 2012 Elliott Mitchell <ehem+debwrt@m5p.com>
     6#       2012-09-27  fixes to files-copy, rework checkout/update
     7#       2012-09-28  complete rewrite of patch/unpatch targets, new capabilities
     8#       2012-09-30  tweaking of patch/unpatch, now handles differing dir levels
    49#
    510# This program is free software: you can redistribute it and/or modify
     
    1722
    1823OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches
     24OPENWRT_PATCH_DIRS:= "$(OPENWRT_PATCHES_DIR)/all" \
     25        "$(OPENWRT_PATCHES_DIR)/$(OPENWRT_BRANCH)"
     26
     27get_patches = \
     28        if [ ! -d "$(OPENWRT_BUILD_DIR)" ]; then exit 1; fi ; \
     29        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
     30        find \
     31          $(OPENWRT_PATCH_DIRS) \
     32          -name .svn -prune -o \! -type d -printf %f/%p\\n | \
     33        gawk -F / '\
     34          BEGIN { OFS=FS } \
     35          match($$1, "^([[:digit:]]+)((-$(OPENWRT_BRANCH))|(-all))?(-([[:digit:]]*):([[:digit:]]*))?(_[^/]*)", revs) \
     36            { if(revs[6] <= '$${rev}' && (!length(revs[7]) || revs[7] >= '$${rev}')) \
     37              { $$1=revs[1] revs[8]; print } \
     38            }' | \
     39        sort $(1) | sed -e's/^[^/]\+\///'
     40
     41do_patches = \
     42        if [ ! -d "$(OPENWRT_BUILD_DIR)" ]; then exit 1; fi ; \
     43        $(call get_patches,$(1)) | while read patch ; \
     44        do \
     45                patchi=$$(echo $${patch} | sed -e's!$(TOPDIR)/!!') ; \
     46                if ! patch -b -d "$(OPENWRT_BUILD_DIR)" -p1 $(2) < "$${patch}" ; \
     47                then \
     48                        echo ">> fail: $${patchi}" > /dev/stderr ; \
     49                        $(if $(FORCE_PATCH),retval=1,exit 1) ; \
     50                else \
     51                        echo ">> success: $${patchi}" ; \
     52                fi ; \
     53        done
    1954
    2055openwrt/all: openwrt/build
     
    4277  openwrt/patch \
    4378  openwrt/files-copy \
    44   plugins/apply-openwrt \
    4579  openwrt/merge-config \
    46   openwrt/download-link \
    47   # end openwrt/prepare:
     80  openwrt/download-link
    4881        touch $@
    4982
     
    5386        cp $(CONFIG_DIR)/openwrt.defconfig $(TMP_DIR)/.config_openwrt
    5487        # Merge default OpenWrt settings with DebWrt menu config settings
    55         #cat .config | grep -v -e CONFIG_TARGET_BOARD -e "^#" >> $(TMP_DIR)/.config_openwrt
    56         cat .config | grep -v -e CONFIG_TARGET_BOARD >> $(TMP_DIR)/.config_openwrt
     88        grep -v -e CONFIG_TARGET_BOARD .config >> $(TMP_DIR)/.config_openwrt
    5789        # Merge default and menu settings with possibly altered settings in make menuconfig in OpenWrt
    5890        # note: settings manually made in OpenWrt menu config will be included!
     
    77109        touch $@
    78110
     111openwrt/patch/show: openwrt/checkout
     112        @$(call get_patches) | while read patch ;\
     113        do \
     114           echo $${patch}; \
     115        done
     116
     117openwrt/patch/force:
     118        rm -f $(TOPDIR)/openwrt/patch ; \
     119        $(MAKE) -C $(TOPDIR) openwrt/patch FORCE_PATCH=1 ; \
     120
    79121openwrt/patch: openwrt/checkout
    80         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    81           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    82 ifeq ($(IS_OPENWRT_TRUNK),y)
    83         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    84           < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config
    85         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    86           < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs
    87         #patch -d $(OPENWRT_BUILD_DIR) -p 1 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    88 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    89         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    90           < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
    91         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    92           < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
    93 endif
    94         #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    95           < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
    96         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    97           < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
     122        @$(call do_patches,,-N)
     123        rm -f openwrt/unpatch
    98124        touch $@
    99125
    100 openwrt/unpatch: openwrt/checkout
    101         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    102           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    103 ifeq ($(IS_OPENWRT_TRUNK),y)
    104         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    105           < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config
    106         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    107           < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs
    108         #-patch -R -d $(OPENWRT_BUILD_DIR) -p 1 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    109 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    110         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    111           < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
    112         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    113           < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
    114 endif
    115         #-patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    116           < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
    117         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    118           < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
     126openwrt/unpatch/show: openwrt/checkout
     127        @$(call get_patches,-r) | while read patch ;\
     128        do \
     129           echo $${patch}; \
     130        done
     131openwrt/unpatch/force:
     132        rm -f $(TOPDIR)/openwrt/unpatch ; \
     133        $(MAKE) -C $(TOPDIR) openwrt/unpatch FORCE_PATCH=1 ; \
     134
     135openwrt/unpatch:
     136        @if [ ! -f $(TOPDIR)/openwrt/patch ]; then \
     137           echo "E: can't unpatch if patches have not previously been applied"; \
     138           exit 1; \
     139        fi
     140        @$(call do_patches,-r,-R)
     141        rm -f openwrt/patch
    119142        touch $@
    120        
    121143
    122144openwrt/files-copy: openwrt/patch
    123         cd $(FILES_DIR_OPENWRT) && find -type f | while read f; do \
    124            mkdir -p $(OPENWRT_BUILD_DIR)/$$(dirname $$f); \
    125            cp -v $$f $(OPENWRT_BUILD_DIR)/$$(dirname $$f) ;\
    126         done
     145        tar -C $(FILES_DIR_OPENWRT) --exclude-vcs -cpf - . | \
     146          tar -C $(OPENWRT_BUILD_DIR) -xpf - && \
    127147        touch $@
     148
     149ifeq ($(OPENWRT_BRANCH),trunk)
     150OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/trunk/
     151else ifeq ($(OPENWRT_TAG),)
     152OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/branches/$(OPENWRT_BRANCH)/
     153else
     154OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/tags/$(OPENWRT_TAG)
     155endif
    128156
    129157$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp:
    130158openwrt/checkout: $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
    131         rm -rf $(OPENWRT_BUILD_DIR)
     159        if [ ! -f $(TOPDIR)/.config ]; then echo "Please type menuconfig first"; exit 1; fi
    132160        mkdir -p $(OPENWRT_BUILD_DIR)
    133 ifeq ($(IS_OPENWRT_TRUNK),y)
    134         cd $(OPENWRT_BUILD_DIR) && \
    135           svn co svn://svn.openwrt.org/openwrt/trunk/ .
    136 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    137         cd $(OPENWRT_BUILD_DIR) && \
    138           svn co svn://svn.openwrt.org/openwrt/branches/backfire/ .
    139 else
    140         cd $(OPENWRT_BUILD_DIR) && \
    141           svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ .
    142 endif
     161        svn co -r $(OPENWRT_REVISION) $(OPENWRT_SUBVERSION) $(OPENWRT_BUILD_DIR)
    143162        touch $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
    144163        touch $@
    145164
    146165openwrt/update: openwrt/checkout
    147         cd $(OPENWRT_BUILD_DIR) && svn update
     166        svn up -r $(OPENWRT_REVISION) $(OPENWRT_BUILD_DIR)
    148167
    149168openwrt/menuconfig: openwrt/prepare
     
    155174        rm -f openwrt/build
    156175
    157 openwrt/clean:
     176openwrt/wrtclean:
    158177        -$(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) clean V=$(V)
    159178
     
    164183        -$(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) distclean V=$(V)
    165184
    166 openwrt/debwrt-clean:
     185openwrt/clean:
    167186        rm -rf $(OPENWRT_BUILD_DIR)
    168187        rm -f openwrt/checkout
    169188        rm -f openwrt/patch
    170         rm -f openwrt/copy-files
     189        rm -f openwrt/files-copy
     190
     191.PHONY: openwrt/patch/force \
     192        openwrt/unpatch/force \
     193        openwrt/clean \
     194
  • trunk/openwrt/patches/README

    r218 r517  
     1DebWrt patch subsystem to patch OpenWrt
    12
    2 Original had this directory only "patches".
     3Reworked by ehem since r349. Thanks!
    34
    4 Later as the 'generate' script added
    5 which generates "patches" from  .in files and other files such as .sed files.
     5all/      Patches that apply to all branches of OpenWrt
     6trunk/    Patches that apply only to OpenWrt trunk
     7backfire/ Patches that apply only to OpenWrt backfire branch
    68
    7 The 'generate proces' is _not integrated_ in the build process.
    8 At least not at the time it was introduced.
     9Patches in these directories must have filenames of the form:
    910
     11<nnn>_<desc>
     12        Apply patch to all revisions
     13<nnn>[-<branch>][-[<first>]:[<last>]]_<desc>
     14        The portions in brackets [] are optional.  If present, <branch> will
     15        cause the patch to only be applied to the indicated branch of OpenWrt,
     16        "all" will make it applIy to all branches.  <first> and <last> are used
     17        to indicate an inclusive range of OpenWrt revisions which the patch
     18        applies to.  If <last> is omitted, it will be applied to all revisions
     19        after <first>.  If <first> is omitted, it will be applied to all
     20        revisions before <last>.  If <first> equals <last>, it will be applied
     21        to that single revision.  If <first> is greater than <last>, it will
     22        never be used.
     23
     24
     25<nnn>  is used to set order of application. Lower numbered patches are applied
     26       first.  The ordering is done by running the list of patches through
     27       `sort`, as a result,  "1000_foo" will be done before "200_bar".  The
     28       branch and revision tags are removed prior sorting, so they will not
     29       influence the order of application.  Note that all patches in all patch
     30       directories are listed, sorted and then applied as a single group in one
     31       pass!
     32
     33<desc> contains a functional description of the patch. Usually separated by
     34       underscores.
     35
     36Minor technical note: The script is actually trying to parse everything up to
     37the first underscore. Everything after that is ignored.
     38
     39
     40Patches are applied inside the checked out OpenWRT using `patch -p1`.  Most
     41patches are distributed with this level of prefix.  If you encounter one that
     42was setup for application using `patch -p0`, the following command can be
     43used to remedy the situation:
     44`sed -e's/^\(\(+++\)\|\(---\)\) /\1 openwrt\//' -i`
     45
     46
     47Patch make targets
     48------------------
     49make openwrt/patch              - Exit when a patch fails
     50maken openwrt/unpatch           - Exit when an unpatch fails
     51make openwrt/patch/force        - Try to apply all patches
     52maken openwrt/unpatch/force     - Try to unapply all patches
     53
     54The force options are very usefull when developping.
     55
     56
     57Create new patch example
     58------------------------
     59cd build/openwrt-<...>/
     60wget -O packages/broadcom-wl/patches/999_remove_IRWF_SAMPLE_RANDOM \
     61        https://dev.openwrt.org/raw-attachment/ticket/12248/remove_IRWF_SAMPLE_RANDOM.patch
     62diff -Nu packages/broadcom-wl/patchesnew/999_remove_IRWF_SAMPLE_RANDOM \
     63         packages/broadcom-wl/patches/999_remove_IRWF_SAMPLE_RANDOM \
     64         > ../../030-33559:_broadcom-wl_remove_IRWF_SAMPLE_RANDOM.patch
     65
Note: See TracChangeset for help on using the changeset viewer.