drivers/igkboard-imx6ull/build.sh | ●●●●● patch | view | raw | blame | history | |
drivers/igkboard-imx6ull/user/Makefile | ●●●●● patch | view | raw | blame | history | |
drivers/igkboard-imx6ull/user/hello.c | ●●●●● patch | view | raw | blame | history | |
drivers/x86_64/Makefile | patch | view | raw | blame | history | |
drivers/x86_64/ldd1_hello.c | patch | view | raw | blame | history | |
drivers/x86_64/ldd2_chrdev.c | patch | view | raw | blame | history | |
drivers/x86_64/ldd3_ioctl.c | patch | view | raw | blame | history | |
drivers/x86_64/testapp/app2_chrdev.c | patch | view | raw | blame | history | |
drivers/x86_64/testapp/app3_ioctl.c | patch | view | raw | blame | history | |
drivers/x86_64/testapp/makefile | patch | view | raw | blame | history | |
images/build.sh | ●●●●● patch | view | raw | blame | history | |
kernel/build.sh | ●●●●● patch | view | raw | blame | history |
drivers/igkboard-imx6ull/build.sh
New file @@ -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 drivers/igkboard-imx6ull/user/Makefile
New file @@ -0,0 +1,40 @@ #********************************************************************************* # Copyright: (C) 2021 LingYun IoT System Studio <www.weike-iot.com> # All rights reserved. # # Filename: Makefile # Description: This Makefile used to compile all the drivers here # # Version: 1.0.0(18/12/2021~) # Author: Guo Wenxue <guowenxue@gmail.com> # ChangeLog: 1, Release initial version on "18/12/2021 01:29:33 PM" # #********************************************************************************/ ARCH ?= arm CROSS_COMPILE ?= /opt/gcc-aarch32-10.3-2021.07/bin/arm-none-linux-gnueabihf- LINUX_SRC ?= ${shell pwd}/../../../kernel/linux-imx/ DRV_PATH ?= ${shell pwd}/../../../kernel/install/ EXTRA_INSTPATH=/tftp PWD := $(shell pwd) obj-m += hello.o modules: @echo ${LINUX_SRC} @make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(LINUX_SRC) M=$(PWD) modules @make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(LINUX_SRC) M=$(PWD) modules_install INSTALL_MOD_PATH=${DRV_PATH} INSTALL_MOD_STRIP=1 @make clear install: cp -af *.ko ${EXTRA_INSTPATH} clear: @rm -f *.o *.mod* .*.cmd *.symvers *.order clean: clear @rm -f *.ko drivers/igkboard-imx6ull/user/hello.c
New file @@ -0,0 +1,35 @@ /********************************************************************************* * Copyright: (C) 2021 LingYun IoT System Studio <www.weike-iot.com> * All rights reserved. * * Filename: hello.c * Description: This file is the linux kernel sample hello module * * Version: 1.0.0(18/12/2021~) * Author: Guo Wenxue <guowenxue@gmail.com> * ChangeLog: 1, Release initial version on "18/12/2021 10:50:26 AM" * ********************************************************************************/ #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> static __init int hello_init(void) { printk(KERN_ALERT "Hello, LingYun IoT System Studio!\n"); return 0; } static __exit void hello_exit(void) { printk(KERN_ALERT "Goodbye, I have found a good job!\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_AUTHOR("GuoWenxue <guowenxue@gmail.com>"); MODULE_DESCRIPTION("Linux Kernel hello module"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_INFO(intree, "Y"); drivers/x86_64/Makefile
drivers/x86_64/ldd1_hello.c
drivers/x86_64/ldd2_chrdev.c
drivers/x86_64/ldd3_ioctl.c
drivers/x86_64/testapp/app2_chrdev.c
drivers/x86_64/testapp/app3_ioctl.c
drivers/x86_64/testapp/makefile
images/build.sh
@@ -225,6 +225,7 @@ rm -rf $ROOTFS/lib/modules/ mkdir -p $ROOTFS/lib/modules/ cp -rf $KERNEL_BINPATH/lib/modules/[0-9]*\.[0-9]*\.[0-9]* $ROOTFS/lib/modules/ cp -rf $KERNEL_BINPATH/lib/firmware/* $ROOTFS/lib/firmware/ pr_info "start install root filesystem" mount -t ext4 /dev/mapper/${LOOP_DEV}p2 ${MNT_POINT} kernel/build.sh
@@ -93,6 +93,7 @@ export BRANCH=$BSP_VER export KER_SRC=linux-imx export KER_PATH=$PRJ_PATH/$KER_SRC export DRV_PATH=$TOP_PATH/drivers/${BOARD} export JOBS=`cat /proc/cpuinfo | grep processor | wc -l` @@ -188,6 +189,19 @@ fi } function build_driver() { if [ ! -d $DRV_PATH ] ; then return 0; fi pr_info "start ${BOARD} linux drivers" cd $DRV_PATH && ./build.sh cd $PRJ_PATH } function do_build() { cd $PRJ_PATH @@ -195,6 +209,8 @@ build_kernel do_install build_driver } function do_clean() @@ -204,6 +220,10 @@ rm -rf $PRJ_PATH/$KER_SRC rm -rf $PRJ_PATH/tarballs rm -rf $PRFX_PATH cd $DRV_PATH && ./build.sh -c cd } #+-------------------------+