Ignore:
Timestamp:
Feb 4, 2010, 11:26:48 PM (10 years ago)
Author:
amain
Message:

Add openwrt/deliver target

File:
1 edited

Legend:

Unmodified
Added
Removed
  • debwrt/trunk/openwrt/openwrt-deliver.mk

    r3 r5  
    1616# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717
     18# The following function imports some environment variables
     19# save in a special config file during OpenWrt's build process
     20#
     21# OPENWRT_BIN_DIR               - directory where OpenWrt firmware is stored
     22# OPENWRT_PACKAGE_DIR   - directory where OpenWrt packages are stored
     23# OPENWRT_TMP_DIR               - directory where OpenWrt stored all kernel modules
     24# OPENWRT_LINUX_VERSION - kernel version of the kernel build by OpenWrt
     25# OPENWRT_LINUX_DIR     - OpenWrt's kernel build directory
     26#
     27include $(OPENWRT_SAVE_CONFIG_FILE)
    1828
     29ERROR_MSG_NOCONF:=" not defined. Make sure OpenWrt build finished."
     30
     31openwrt/deliver: openwrt/deliver/prepare  openwrt/deliver/clean                         \
     32                                 openwrt/deliver/image    openwrt/deliver/kernel-modules        \
     33                                 openwrt/deliver/packages openwrt/deliver/config
     34
     35openwrt/deliver/prepare: openwrt/deliver/import-config openwrt/deliver/check
     36
     37openwrt/deliver/import-config:
     38        @echo OPENWRT_BIN_DIR=$(OPENWRT_BIN_DIR)
     39        @echo OPENWRT_PACKAGE_DIR=$(OPENWRT_PACKAGE_DIR)
     40        @echo OPENWRT_TMP_DIR=$(OPENWRT_TMP_DIR)
     41        @echo OPENWRT_LINUX_VERSION=$(OPENWRT_LINUX_VERSION)
     42        @echo OPENWRT_LINUX_DIR=$(OPENWRT_LINUX_DIR)
     43
     44openwrt/deliver/check: ${OPENWRT_BIN_DIR} openwrt/deliver/import-config
     45  ifndef OPENWRT_PACKAGE_DIR
     46        @echo OPENWRT_PACKAGE_DIR$(ERROR_MSG_NOCONF) && false
     47  endif
     48  ifndef OPENWRT_TMP_DIR
     49        @echo OPENWRT_TMP_DIR$(ERROR_MSG_NOCONF) && false
     50  endif
     51  ifndef OPENWRT_LINUX_VERSION
     52        @echo OPENWRT_LINUX_VERSION$(ERROR_MSG_NOCONF) && false
     53  endif
     54  ifndef OPENWRT_LINUX_DIR
     55        @echo OPENWRT_LINUX_DIR$(ERROR_MSG_NOCONF) && false
     56  endif
     57  ifndef OPENWRT_PACKAGE_DIR
     58        @echo OPENWRT_PACKAGE_DIR$(ERROR_MSG_NOCONF) && false
     59  endif
     60
     61openwrt/deliver/image: openwrt/deliver/prepare
     62        mkdir -p $(INSTALL_DIR)
     63        cp -a ${OPENWRT_BIN_DIR}/$(call qstrip,$(CONFIG_OPENWRT_TARGET_IMAGE_NAME)) $(INSTALL_DIR)/$(TARGET_IMAGE_NAME)
     64
     65openwrt/deliver/kernel-modules: openwrt/deliver/prepare
     66        mkdir -p $(INSTALL_DIR) $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_OPENWRT_MODULES)
     67        mkdir -p $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
     68        cp -r ${OPENWRT_TMP_DIR}/modules/lib/modules/${OPENWRT_LINUX_VERSION} $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
     69        rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_VERSION}/build
     70        rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_VERSION}/source
     71        find $(OPENWRT_PACKAGE_DIR) -name "kmod-*" | while read fkmod; do \
     72            $(SCRIPT_EXTRACT_KMODPKG) $$fkmod $(INSTALL_DIR_OPENWRT_MODULES) $(TMP_DIR) || true; \
     73        done
     74        depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) ${OPENWRT_LINUX_VERSION}
     75        tar czf $(INSTALL_DIR)/$(MODULES_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_MODULES) .
     76
     77openwrt/deliver/packages: openwrt/deliver/prepare
     78        mkdir -p $(INSTALL_DIR_OPENWRT_PACKAGES)
     79        cp -ra $(OPENWRT_PACKAGE_DIR)/* $(INSTALL_DIR_OPENWRT_PACKAGES)
     80
     81openwrt/deliver/config: openwrt/deliver/prepare
     82        cp ${TOPDIR}/.config $(INSTALL_DIR)/config-debwrt
     83        cp ${OPENWRT_BUILD_DIR}/.config $(INSTALL_DIR)/config-openwrt
     84        cp ${OPENWRT_LINUX_DIR}/.config $(INSTALL_DIR)/config-kernel-${OPENWRT_LINUX_VERSION}
     85
     86openwrt/deliver/clean:
     87        rm -rf $(INSTALL_DIR)
     88
Note: See TracChangeset for help on using the changeset viewer.