From 5ceda644200c8c84b9c1ea66f2ee677d374c34cb Mon Sep 17 00:00:00 2001 From: David P Date: Fri, 7 Sep 2018 21:28:40 -0300 Subject: [PATCH] Add offline files, and a toolchain option in Makefile The *.offline files are so if you want to build offline, you just have to pass toolchains= unset, or toolchains=1 for downloading them (which is the default). Read the INSTALL file for more. Signed-off-by: David P --- INSTALL | 20 +++++++ Makefile | 33 +++++++++-- ath9k_htc/Makefile.offline | 8 +++ ath9k_htc/target_firmware/configure.offline | 64 +++++++++++++++++++++ carl9170fw/extra/sh-elf-linux.cmake.offline | 22 +++++++ 5 files changed, 143 insertions(+), 4 deletions(-) create mode 100644 ath9k_htc/Makefile.offline create mode 100755 ath9k_htc/target_firmware/configure.offline create mode 100644 carl9170fw/extra/sh-elf-linux.cmake.offline diff --git a/INSTALL b/INSTALL index 74c5cfd..733aab8 100644 --- a/INSTALL +++ b/INSTALL @@ -6,6 +6,14 @@ also specify targets to make. For example: Please see the included Makefile for a list of all available targets. +Some firmwares download toolchains. If you want this, run "make" +passing the "toolchains=1" option (this is the default). If, however, +you want to build these firmwares using your system's cross-compilers, +then run "make" with the "toolchains=" option unset (anything different +from "1" works), like this: + + make toolchains= + Once the desired things are built, "make install" will put them into the appropriate place, which is /lib/firmware by default although you can override this with something like: @@ -35,6 +43,18 @@ On GNU/Linux distros that use apt you can install these with: apt install binutils-arm-linux-gnueabi binutils-arm-none-eabi bison \ cmake flex g++ gcc gcc-arm-linux-gnueabi gcc-arm-none-eabi gperf make wget +And if you pretend to build everything offline, you will also need: + + * GNU C cross-compiler for Xtensa: + - xtensa-elf-gcc + - xtensa-elf-ld + - xtensa-elf-objcopy + * GNU C cross-compiler for SuperH: + - sh-elf-gcc (with newlib support) + - sh-elf-ld + - sh-elf-objcopy + * Newlib for SuperH (sh-elf) + CARL9170 Firmware Configuration When building the carl9170 firmware you will be prompted with configuration questions. diff --git a/Makefile b/Makefile index 21d16fb..3805eaf 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ shell=/bin/sh prefix=/lib/firmware install_program=install +toolchains=1 .PHONY: all test clean install a56 as31 aica ath9k_htc_toolchain ath9k_htc av7110 b43-tools carl9170fw-toolchain carl9170fw cis-tools cis dsp56k ihex2fw isci keyspan_pda openfwwf usbdux @@ -31,10 +32,22 @@ aica: cd aica/arm && $(MAKE) ath9k_htc_toolchain: - cd ath9k_htc && $(MAKE) toolchain + if [[ "$(toolchains)" = 1 ]]; then \ + cd ath9k_htc && $(MAKE) toolchain; \ + else \ + for f in $(shell find ath9k_htc -type f -name "*.offline") ; do \ + if [ "$(shell find ath9k_htc -type f -name "*.bak")" = "" ]; then \ + cp -v $${f%.offline} $${f%.offline}.bak ; \ + cp -v $$f $${f%.offline} ; \ + fi; \ + done; \ + fi ath9k_htc: ath9k_htc_toolchain - cd ath9k_htc && $(MAKE) -C target_firmware + cd ath9k_htc && $(MAKE) -C target_firmware && \ + for f in $(shell find -type f -name "*.bak") ; do \ + mv -v ../$$f ../$${f%.bak}; \ + done av7110: cd av7110 && $(MAKE) @@ -43,10 +56,22 @@ b43-tools: cd b43-tools/assembler && $(MAKE) carl9170fw-toolchain: - cd carl9170fw && $(MAKE) -C toolchain + if [[ "$(toolchains)" = 1 ]]; then \ + cd carl9170fw && $(MAKE) -C toolchain; \ + else \ + for f in $(shell find carl9170fw -type f -name "*.offline") ; do \ + if [ "$(shell find carl9170fw -type f -name "*.bak")" = "" ]; then \ + cp -v $${f%.offline} $${f%.offline}.bak ; \ + cp -v $$f $${f%.offline} ; \ + fi; \ + done; \ + fi carl9170fw: carl9170fw-toolchain - cd carl9170fw && ./autogen.sh + cd carl9170fw && ./autogen.sh && \ + for f in $(shell find -type f -name "*.bak") ; do \ + mv -v ../$$f ../$${f%.bak}; \ + done cis: cis-tools cd cis && $(MAKE) diff --git a/ath9k_htc/Makefile.offline b/ath9k_htc/Makefile.offline new file mode 100644 index 0000000..958eaaa --- /dev/null +++ b/ath9k_htc/Makefile.offline @@ -0,0 +1,8 @@ +all: firmware +clean: + $(MAKE) -C target_firmware clean + +firmware: + +$(MAKE) -C target_firmware + +.PHONY: all clean firmware diff --git a/ath9k_htc/target_firmware/configure.offline b/ath9k_htc/target_firmware/configure.offline new file mode 100755 index 0000000..6e49093 --- /dev/null +++ b/ath9k_htc/target_firmware/configure.offline @@ -0,0 +1,64 @@ +#!/bin/sh +## + # Copyright (c) 2013 Qualcomm Atheros, Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted (subject to the limitations in the + # disclaimer below) provided that the following conditions are met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # + # * Redistributions in binary form must reproduce the above copyright + # notice, this list of conditions and the following disclaimer in the + # documentation and/or other materials provided with the + # distribution. + # + # * Neither the name of Qualcomm Atheros nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. + # + # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + # GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + # HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ## + +TARGET=xtensa-elf + +[ -z "$CROSS_COMPILE" ] && + CROSS_COMPILE="$TARGET-" + +TOOLCHAIN_FILE="$PWD/build/toolchain.cmake" + +set -e +rm -rf build +mkdir -p build + +cat > "$TOOLCHAIN_FILE" < ${CMAKE_C_FLAGS} -o ") + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -- 2.18.0