From 5e993f63cd04f94bf3a7d2d1e8140644df5db56b Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Fri, 05 Apr 2024 14:40:59 +0800 Subject: [PATCH] Build:IGKBoard-All: Update gitignore file --- drivers/igkboard-imx6ull/build.sh | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 212 insertions(+), 0 deletions(-) diff --git a/drivers/igkboard-imx6ull/build.sh b/drivers/igkboard-imx6ull/build.sh new file mode 100755 index 0000000..c5f9f8a --- /dev/null +++ b/drivers/igkboard-imx6ull/build.sh @@ -0,0 +1,212 @@ +#!/bin/bash + +# this project absolute path +PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) + +# top project absolute path +TOP_PATH=$(realpath $PRJ_PATH/../../) + +# binaries build prefix install path +PRFX_PATH=$PRJ_PATH/install + +# binaries finally install path if needed +#INST_PATH=/tftp + +# download taballs path +TARBALL_PATH=$PRJ_PATH/tarballs + +# config file path +CONF_FILE=$TOP_PATH/config.json + +# shell script will exit once get command error +set -e + +#+-------------------------+ +#| Shell script functions | +#+-------------------------+ + +function pr_error() { + echo -e "\033[40;31m $1 \033[0m" +} + +function pr_warn() { + echo -e "\033[40;33m $1 \033[0m" +} + +function pr_info() { + echo -e "\033[40;32m $1 \033[0m" +} + +# decompress a packet to destination path +function do_unpack() +{ + tarball=$1 + dstpath=`pwd` + + if [[ $# == 2 ]] ; then + dstpath=$2 + fi + + pr_info "decompress $tarball => $dstpath" + + mkdir -p $dstpath + case $tarball in + *.tar.gz) + tar -xzf $tarball -C $dstpath + ;; + + *.tar.bz2) + tar -xjf $tarball -C $dstpath + ;; + + *.tar.xz) + tar -xJf $tarball -C $dstpath + ;; + + *.tar.zst) + tar -I zstd -xf $tarball -C $dstpath + ;; + + *.tar) + tar -xf $tarball -C $dstpath + ;; + + *.zip) + unzip -qo $tarball -d $dstpath + ;; + + *) + pr_error "decompress Unsupport packet: $tarball" + return 1; + ;; + esac +} + +# parser configure file and export environment variable +function export_env() +{ + export BOARD=`jq -r ".bsp.board" $CONF_FILE | tr 'A-Z' 'a-z'` + export CROSS_COMPILE=`jq -r ".bsp.cortexAtool" $CONF_FILE` + export BSP_VER=`jq -r ".bsp.version" $CONF_FILE | tr 'A-Z' 'a-z'` + export BSP_URL=`jq -r ".bsp.giturl" $CONF_FILE` + + export KER_SRC=linux-imx + export KER_PATH=$TOP_PATH/kernel/linux-imx + export DRV_PATH=$TOP_PATH/kernel/install + + export JOBS=`cat /proc/cpuinfo | grep processor | wc -l` + + if [[ $BOARD =~ mx6ull ]] ; then + export ARCH=arm + else + export ARCH=arm64 + fi +} + +function build_user() +{ + SRC=user + + if [ ! -d ${SRC} ] ; then + return ; + fi + + pr_warn "Build for users driver" + cd ${SRC} + + sed -i "s|^CROSS_COMPILE ?=.*|CROSS_COMPILE ?= ${CROSS_COMPILE}|g" Makefile + make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} LINUX_SRC=${KER_PATH} DRV_PATH=${DRV_PATH}/ + + cd ${PRJ_PATH} +} + +function build_wifi() +{ + SRC=rtl8188fu + + cd $PRJ_PATH + + if [ -d $SRC ] ; then + pr_info "$SRC USB WiFi driver source code fetched already" + else + pr_info "start fetch $SRC USB WiFi drver source code" + + if [[ $BSP_URL =~ github.com ]] ; then + git clone https://github.com/kelebek333/rtl8188fu.git --depth=1 $SRC + else + mkdir -p $TARBALL_PATH + + # Download source code packet + if [ ! -s $TARBALL_PATH/$SRC.tar.xz ] ; then + wget $BSP_URL/imx/bsp/misc/$SRC.tar.xz -P $TARBALL_PATH + fi + + # decompress source code packet + do_unpack $TARBALL_PATH/$SRC.tar.xz + fi + fi + + cd $SRC + + pr_warn "start update $SRC USB WiFi driver source code" + + KER_VER=`echo $BSP_VER|awk -F"-" '{print $2}'` + + sed -i "s|^CROSS_COMPILE ?=.*|CROSS_COMPILE ?= ${CROSS_COMPILE}|g" Makefile + sed -i "s|^ARCH ?=.*|ARCH ?= arm|g" Makefile + sed -i "s|^KVER.*|KVER := $KER_VER|g" Makefile + sed -i "s|^KSRC.*|KSRC := ${KER_PATH}|g" Makefile + sed -i "s|^MODDESTDIR.*|MODDESTDIR := ${DRV_PATH}|g" Makefile + + sed -i "s|^#define CONFIG_DEBUG|//#define CONFIG_DEBUG|g" include/autoconf.h + + sed -i "/nolinked power/d" core/rtw_pwrctrl.c + sed -i "/request firmware/d" hal/rtl8188f/rtl8188f_hal_init.c + + pr_warn "start build $SRC USB WiFi driver" + make -j ${JOBS} modules + + mkdir -p ${DRV_PATH}/lib/firmware/rtlwifi/ + cp rtl8188fu.ko ${DRV_PATH}/lib/modules/${KER_VER}-dirty/extra/ + cp firmware/rtl8188fufw.bin ${DRV_PATH}/lib/firmware/rtlwifi/ +} + + +function do_build() +{ + cd $PRJ_PATH + + build_user + + build_wifi +} + +function do_clean() +{ + cd $PRJ_PATH + + rm -rf rtl8188fu tarballs + + if [ -d user ] ; then + cd user + make clean; + fi + +} + +#+-------------------------+ +#| Shell script body entry | +#+-------------------------+ + +export_env + +if [[ $# == 1 && $1 == -c ]] ;then + pr_warn "start clean drivers" + do_clean + exit; +fi + +pr_warn "start build linux driver for ${BOARD}" + +do_build + -- Gitblit v1.9.1