Changeset 696


Ignore:
Timestamp:
Nov 22, 2015, 12:34:16 PM (4 years ago)
Author:
amain
Message:

Relocate build/install dirs to prepare for building images for all targets

Location:
trunk
Files:
4 edited
1 moved

Legend:

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

    r563 r696  
    7171
    7272openwrt/deliver/image: openwrt/deliver/prepare
    73         mkdir -p $(INSTALL_DIR)
     73        mkdir -p $(INSTALL_DIR_OPENWRT)
    7474        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/'`; \
    77                 cp -av $$fname $(INSTALL_DIR)/$$tfname; \
     77                cp -av $$fname $(INSTALL_DIR_OPENWRT)/$$tfname; \
    7878        done
    7979
    8080openwrt/deliver/kernel-modules: openwrt/deliver/prepare
    81         mkdir -p $(INSTALL_DIR) $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_OPENWRT_MODULES)
     81        mkdir -p $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_OPENWRT_MODULES)
    8282        mkdir -p $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
    8383        cp -r $(OPENWRT_TMP_DIR)/modules/lib/modules/$(OPENWRT_LINUX_UNAME_VERSION) $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
     
    8888        done
    8989        PATH="/sbin:/bin:/usr/sbin:/usr/bin" depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) $(OPENWRT_LINUX_UNAME_VERSION)
    90         tar czf $(INSTALL_DIR)/$(MODULES_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_MODULES) .
     90        tar czf $(INSTALL_DIR_OPENWRT)/$(MODULES_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_MODULES) .
    9191
    9292openwrt/deliver/kernel-headers: openwrt/deliver/prepare
     
    9898        #cp $(OPENWRT_LINUX_DIR)/include/linux/switch.h $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)/include/linux/switch.h
    9999        cp $(OPENWRT_LINUX_DIR)/.config $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-$(OPENWRT_LINUX_UNAME_VERSION)
    100         tar czf $(INSTALL_DIR)/$(HEADERS_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_HEADERS) .
     100        tar czf $(INSTALL_DIR_OPENWRT)/$(HEADERS_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_HEADERS) .
    101101
    102102openwrt/deliver/packages: openwrt/deliver/prepare
     
    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)
    110         $(SCRIPT_GET_SVN_REVISION) $(OPENWRT_LINUX_DIR) > $(INSTALL_DIR)/openwrt-svn-revision
    111         $(SCRIPT_GET_SVN_REVISION) $(TOPDIR) > $(INSTALL_DIR)/debwrt-svn-revision
     107        cp $(TOPDIR)/.config $(INSTALL_DIR_OPENWRT)/config-debwrt
     108        cp $(OPENWRT_BUILD_DIR)/.config $(INSTALL_DIR_OPENWRT)/config-openwrt
     109        cp $(OPENWRT_LINUX_DIR)/.config $(INSTALL_DIR_OPENWRT)/config-kernel-$(OPENWRT_LINUX_VERSION)
     110        $(SCRIPT_GET_SVN_REVISION) $(OPENWRT_LINUX_DIR) > $(INSTALL_DIR_OPENWRT)/openwrt-svn-revision
     111        $(SCRIPT_GET_SVN_REVISION) $(TOPDIR) > $(INSTALL_DIR_OPENWRT)/debwrt-svn-revision
    112112
    113113openwrt/deliver/clean:
    114         rm -rf $(INSTALL_DIR)
     114        rm -rf $(INSTALL_DIR_OPENWRT)
    115115
  • trunk/openwrt/openwrt.mk

    r694 r696  
    2121# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2222
    23 test2:
    24         echo "test2"
    25 
     23ifneq ($(findstring openwrt,$(MAKECMDGOALS)),)
     24$(info Architecture: $(TARGET_ARCH))
     25$(info Target      : $(TARGET))
     26$(info Sub rarget  : $(SUB_TARGET))
     27$(info Profile     : $(PROFILE))
     28$(info )
     29endif
     30 
    2631OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches
    2732OPENWRT_PATCH_DIRS:= "$(OPENWRT_PATCHES_DIR)/all" \
  • trunk/rules/debwrt.mk

    r694 r696  
    3737TARGET_ARCH:=$(call qstrip,$(CONFIG_ARCH))
    3838
    39 # Board [example: ar7xx]
    40 BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
    41 
    42 # Sub board [example: ubnt-rspro]
    43 SUB_BOARD:=$(shell $(SCRIPT_GET_BOARD) $(TOPDIR)/.config $(BOARD))
     39# Board
     40# Example:
     41#      target    : ar71xx
     42#      sub_target: generic
     43#      profile   : ubntrspro
     44TARGET:=$(shell $(SCRIPT_GET_TARGET) target $(TOPDIR)/.config)
     45SUB_TARGET:=$(shell $(SCRIPT_GET_TARGET) subtarget $(TOPDIR)/.config)
     46PROFILE:=$(shell $(SCRIPT_GET_TARGET) profile $(TOPDIR)/.config)
    4447
    4548# Linux version [2.6.X(.X)]
     
    7780
    7881# Install dir for OpenWrt binaries
    79 INSTALL_DIR_OPENWRT:=$(INSTALL_DIR_BASE)/firmware/${TARGET_ARCH}/$(BOARD)/$(SUB_BOARD)
     82INSTALL_DIR_OPENWRT:=$(INSTALL_DIR_BASE)/firmware/${TARGET_ARCH}/$(TARGET)/$(SUB_TARGET)
    8083
    8184# Install dir OpenWrt kernel modules
     
    8992
    9093# Image file containing OpenWrt kernel modules
    91 MODULES_TAR_GZ=debwrt-modules-$(TARGET_ARCH)-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
     94MODULES_TAR_GZ=debwrt-modules-$(TARGET_ARCH)-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
    9295
    9396# Image file containing OpenWrt kernel headers
    94 HEADERS_TAR_GZ=debwrt-headers-$(TARGET_ARCH)-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
     97HEADERS_TAR_GZ=debwrt-headers-$(TARGET_ARCH)-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
    9598
    9699# Filename of DebWrt firmware image
    97 TARGET_IMAGE_NAME_BIN=debwrt-firmware-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).bin
    98 TARGET_IMAGE_NAME_TRX=debwrt-firmware-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).trx
     100TARGET_IMAGE_NAME_BIN=debwrt-firmware-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).bin
     101TARGET_IMAGE_NAME_TRX=debwrt-firmware-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).trx
    99102
    100103# OpenWrt patches directory
     
    106109# OpenWrt Build (checkout) directory
    107110ifeq ($(OPENWRT_TAG),)
    108 OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_BRANCH)-$(OPENWRT_REVISION)
     111OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt/$(TARGET_ARCH)/$(TARGET)/$(SUB_TARGET)/$(OPENWRT_BRANCH)-$(OPENWRT_REVISION)
    109112else
    110 OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt-$(BOARD)-$(SUB_BOARD)-$(OPENWRT_TAG)
     113OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt/$(TARGET_ARCH)/$(TARGET)/$(SUB_TARGET)/$(OPENWRT_TAG)
    111114endif
    112115
     
    118121
    119122# Debian
    120 DEBIAN_BUILD_DIR:=$(BUILD_DIR_BASE)/debian-$(BOARD)-$(SUB_BOARD)-$(DEBIAN_BUILD_VERSION)
     123DEBIAN_BUILD_DIR:=$(BUILD_DIR_BASE)/debian-$(TARGET)-$(SUB_TARGET)-$(DEBIAN_BUILD_VERSION)
    121124
    122125# Debian packages dir
  • trunk/rules/get_config_target.sh

    r692 r696  
    33# DebWrt - Debian on Embedded devices
    44#
    5 # Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net>
     5# Copyright (C) 2010, 2015 Johan van Zoomeren <amain@debwrt.net>
    66#
    77# This program is free software: you can redistribute it and/or modify
     
    1818# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1919
    20 CONFIG_FILE=$1
    21 BOARD=$2
     20TYPE=${1}
     21CONFIG_FILE=${2}
    2222
    23 if [ -f $CONFIG_FILE ]; then
    24         grep ^CONFIG_TARGET_${BOARD}[^=] ${CONFIG_FILE} \
    25         | awk '{print length($0)"\t"$0}' \
    26         | sort -n -r \
    27         | cut -f 2- \
    28         | head -1 \
    29         | sed -e "s/CONFIG_TARGET_${BOARD}_//" -e 's/=.*//'
     23if [ ! -f "${CONFIG_FILE}" ]
     24then
     25    echo "Config file does not exists"
     26    exit 1
    3027fi
     28
     29function get_config_value()
     30{
     31    local config=${1}
     32
     33    grep "^CONFIG_${config}=" ${CONFIG_FILE} \
     34     | sed 's/CONFIG_.*=//' \
     35     | tr -d '"'
     36}
     37
     38
     39function get_target()
     40{
     41    get_config_value TARGET_BOARD
     42}
     43
     44function get_subtarget()
     45{
     46    local target=$(get_target)
     47
     48    grep "CONFIG_TARGET_${target}_[^_]\+=" ${CONFIG_FILE} \
     49     | awk -F "[_=]" '{print $4}'
     50}
     51
     52function get_profile()
     53{
     54    local target=$(get_target)
     55
     56    grep "CONFIG_TARGET_${target}_.*_.*\+=" ${CONFIG_FILE} \
     57     | awk -F "[_=]" '{print tolower($5);}'
     58}
     59
     60case ${TYPE} in
     61    target|subtarget|profile) get_${TYPE} ;;
     62    *)
     63        echo "Unknown type '${TYPE}' specified"
     64        exit 1
     65    ;;
     66esac
     67
     68
  • trunk/rules/scripts.mk

    r17 r696  
    2222SCRIPT_EXTRACT_KMODPKG:=$(SCRIPT_DIR)/extract_kmodpkg.sh
    2323SCRIPT_FLASH:=$(SCRIPT_DIR)/flash.sh
    24 SCRIPT_GET_BOARD:=$(SCRIPT_DIR)/get_sub_board.sh
     24SCRIPT_GET_TARGET:=$(SCRIPT_DIR)/get_config_target.sh
Note: See TracChangeset for help on using the changeset viewer.