mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Revert "Merge branch 'test' into develop"
This reverts commitab77323063
, reversing changes made to0ceb2bb3dd
.
This commit is contained in:
parent
ab77323063
commit
17922ecc3d
44 changed files with 0 additions and 16123 deletions
|
@ -1,790 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Tool mainly for U-Boot Quality Assurance: build one or more board
|
||||
# configurations with minimal verbosity, showing only warnings and
|
||||
# errors.
|
||||
|
||||
usage()
|
||||
{
|
||||
# if exiting with 0, write to stdout, else write to stderr
|
||||
local ret=${1:-0}
|
||||
[ "${ret}" -eq 1 ] && exec 1>&2
|
||||
cat <<-EOF
|
||||
Usage: MAKEALL [options] [--] [boards-to-build]
|
||||
|
||||
Options:
|
||||
-a ARCH, --arch ARCH Build all boards with arch ARCH
|
||||
-c CPU, --cpu CPU Build all boards with cpu CPU
|
||||
-v VENDOR, --vendor VENDOR Build all boards with vendor VENDOR
|
||||
-s SOC, --soc SOC Build all boards with soc SOC
|
||||
-l, --list List all targets to be built
|
||||
-m, --maintainers List all targets and maintainer email
|
||||
-M, --mails List all targets and all affilated emails
|
||||
-h, --help This help output
|
||||
|
||||
Selections by these options are logically ANDed; if the same option
|
||||
is used repeatedly, such selections are ORed. So "-v FOO -v BAR"
|
||||
will select all configurations where the vendor is either FOO or
|
||||
BAR. Any additional arguments specified on the command line are
|
||||
always build additionally. See the boards.cfg file for more info.
|
||||
|
||||
If no boards are specified, then the default is "powerpc".
|
||||
|
||||
Environment variables:
|
||||
BUILD_NCPUS number of parallel make jobs (default: auto)
|
||||
CROSS_COMPILE cross-compiler toolchain prefix (default: "")
|
||||
MAKEALL_LOGDIR output all logs to here (default: ./LOG/)
|
||||
BUILD_DIR output build directory (default: ./)
|
||||
BUILD_NBUILDS number of parallel targets (default: 1)
|
||||
|
||||
Examples:
|
||||
- build all Power Architecture boards:
|
||||
MAKEALL -a powerpc
|
||||
MAKEALL --arch powerpc
|
||||
MAKEALL powerpc
|
||||
- build all PowerPC boards manufactured by vendor "esd":
|
||||
MAKEALL -a powerpc -v esd
|
||||
- build all PowerPC boards manufactured either by "keymile" or "siemens":
|
||||
MAKEALL -a powerpc -v keymile -v siemens
|
||||
- build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
|
||||
MAKEALL -c mpc83xx -v freescale 4xx
|
||||
EOF
|
||||
exit ${ret}
|
||||
}
|
||||
|
||||
SHORT_OPTS="ha:c:v:s:lmM"
|
||||
LONG_OPTS="help,arch:,cpu:,vendor:,soc:,list,maintainers,mails"
|
||||
|
||||
# Option processing based on util-linux-2.13/getopt-parse.bash
|
||||
|
||||
# Note that we use `"$@"' to let each command-line parameter expand to a
|
||||
# separate word. The quotes around `$@' are essential!
|
||||
# We need TEMP as the `eval set --' would nuke the return value of
|
||||
# getopt.
|
||||
TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
|
||||
-n 'MAKEALL' -- "$@"`
|
||||
|
||||
[ $? != 0 ] && usage 1
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "$TEMP"
|
||||
|
||||
SELECTED=''
|
||||
ONLY_LIST=''
|
||||
PRINT_MAINTS=''
|
||||
MAINTAINERS_ONLY=''
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-a|--arch)
|
||||
# echo "Option ARCH: argument \`$2'"
|
||||
if [ "$opt_a" ] ; then
|
||||
opt_a="${opt_a%)} || \$2 == \"$2\")"
|
||||
else
|
||||
opt_a="(\$2 == \"$2\")"
|
||||
fi
|
||||
SELECTED='y'
|
||||
shift 2 ;;
|
||||
-c|--cpu)
|
||||
# echo "Option CPU: argument \`$2'"
|
||||
if [ "$opt_c" ] ; then
|
||||
opt_c="${opt_c%)} || \$3 == \"$2\")"
|
||||
else
|
||||
opt_c="(\$3 == \"$2\")"
|
||||
fi
|
||||
SELECTED='y'
|
||||
shift 2 ;;
|
||||
-s|--soc)
|
||||
# echo "Option SoC: argument \`$2'"
|
||||
if [ "$opt_s" ] ; then
|
||||
opt_s="${opt_s%)} || \$6 == \"$2\")"
|
||||
else
|
||||
opt_s="(\$6 == \"$2\")"
|
||||
fi
|
||||
SELECTED='y'
|
||||
shift 2 ;;
|
||||
-v|--vendor)
|
||||
# echo "Option VENDOR: argument \`$2'"
|
||||
if [ "$opt_v" ] ; then
|
||||
opt_v="${opt_v%)} || \$5 == \"$2\")"
|
||||
else
|
||||
opt_v="(\$5 == \"$2\")"
|
||||
fi
|
||||
SELECTED='y'
|
||||
shift 2 ;;
|
||||
-l|--list)
|
||||
ONLY_LIST='y'
|
||||
shift ;;
|
||||
-m|--maintainers)
|
||||
ONLY_LIST='y'
|
||||
PRINT_MAINTS='y'
|
||||
MAINTAINERS_ONLY='y'
|
||||
shift ;;
|
||||
-M|--mails)
|
||||
ONLY_LIST='y'
|
||||
PRINT_MAINTS='y'
|
||||
shift ;;
|
||||
-h|--help)
|
||||
usage ;;
|
||||
--)
|
||||
shift ; break ;;
|
||||
*)
|
||||
echo "Internal error!" >&2 ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
# echo "Remaining arguments:"
|
||||
# for arg do echo '--> '"\`$arg'" ; done
|
||||
|
||||
FILTER="\$1 !~ /^#/"
|
||||
[ "$opt_a" ] && FILTER="${FILTER} && $opt_a"
|
||||
[ "$opt_c" ] && FILTER="${FILTER} && $opt_c"
|
||||
[ "$opt_s" ] && FILTER="${FILTER} && $opt_s"
|
||||
[ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
|
||||
|
||||
if [ "$SELECTED" ] ; then
|
||||
SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
|
||||
|
||||
# Make sure some boards from boards.cfg are actually found
|
||||
if [ -z "$SELECTED" ] ; then
|
||||
echo "Error: No boards selected, invalid arguments"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#########################################################################
|
||||
|
||||
# Print statistics when we exit
|
||||
trap exit 1 2 3 15
|
||||
trap print_stats 0
|
||||
|
||||
# Determine number of CPU cores if no default was set
|
||||
: ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
|
||||
|
||||
if [ "$BUILD_NCPUS" -gt 1 ]
|
||||
then
|
||||
JOBS="-j $((BUILD_NCPUS + 1))"
|
||||
else
|
||||
JOBS=""
|
||||
fi
|
||||
|
||||
|
||||
if [ "${CROSS_COMPILE}" ] ; then
|
||||
MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
|
||||
else
|
||||
MAKE=make
|
||||
fi
|
||||
|
||||
if [ "${MAKEALL_LOGDIR}" ] ; then
|
||||
LOG_DIR=${MAKEALL_LOGDIR}
|
||||
else
|
||||
LOG_DIR="LOG"
|
||||
fi
|
||||
|
||||
: ${BUILD_NBUILDS:=1}
|
||||
BUILD_MANY=0
|
||||
|
||||
if [ "${BUILD_NBUILDS}" -gt 1 ] ; then
|
||||
BUILD_MANY=1
|
||||
: ${BUILD_DIR:=./build}
|
||||
mkdir -p "${BUILD_DIR}/ERR"
|
||||
find "${BUILD_DIR}/ERR/" -type f -exec rm -f {} +
|
||||
fi
|
||||
|
||||
: ${BUILD_DIR:=.}
|
||||
|
||||
OUTPUT_PREFIX="${BUILD_DIR}"
|
||||
|
||||
[ -d ${LOG_DIR} ] || mkdir "${LOG_DIR}" || exit 1
|
||||
find "${LOG_DIR}/" -type f -exec rm -f {} +
|
||||
|
||||
LIST=""
|
||||
|
||||
# Keep track of the number of builds and errors
|
||||
ERR_CNT=0
|
||||
ERR_LIST=""
|
||||
WRN_CNT=0
|
||||
WRN_LIST=""
|
||||
TOTAL_CNT=0
|
||||
CURRENT_CNT=0
|
||||
OLDEST_IDX=1
|
||||
RC=0
|
||||
|
||||
# Helper funcs for parsing boards.cfg
|
||||
boards_by_field()
|
||||
{
|
||||
awk \
|
||||
-v field="$1" \
|
||||
-v select="$2" \
|
||||
'($1 !~ /^#/ && $field == select) { print $1 }' \
|
||||
boards.cfg
|
||||
}
|
||||
boards_by_arch() { boards_by_field 2 "$@" ; }
|
||||
boards_by_cpu() { boards_by_field 3 "$@" ; }
|
||||
boards_by_soc() { boards_by_field 6 "$@" ; }
|
||||
|
||||
#########################################################################
|
||||
## MPC5xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_5xx="$(boards_by_cpu mpc5xx)"
|
||||
|
||||
#########################################################################
|
||||
## MPC5xxx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_5xxx="$(boards_by_cpu mpc5xxx)"
|
||||
|
||||
#########################################################################
|
||||
## MPC512x Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_512x="$(boards_by_cpu mpc512x)"
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_8xx="$(boards_by_cpu mpc8xx)"
|
||||
|
||||
#########################################################################
|
||||
## PPC4xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_4xx="$(boards_by_cpu ppc4xx)"
|
||||
|
||||
#########################################################################
|
||||
## MPC8220 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_8220="$(boards_by_cpu mpc8220)"
|
||||
|
||||
#########################################################################
|
||||
## MPC824x Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_824x="$(boards_by_cpu mpc824x)"
|
||||
|
||||
#########################################################################
|
||||
## MPC8260 Systems (includes 8250, 8255 etc.)
|
||||
#########################################################################
|
||||
|
||||
LIST_8260="$(boards_by_cpu mpc8260)"
|
||||
|
||||
#########################################################################
|
||||
## MPC83xx Systems (includes 8349, etc.)
|
||||
#########################################################################
|
||||
|
||||
LIST_83xx="$(boards_by_cpu mpc83xx)"
|
||||
|
||||
#########################################################################
|
||||
## MPC85xx Systems (includes 8540, 8560 etc.)
|
||||
#########################################################################
|
||||
|
||||
LIST_85xx="$(boards_by_cpu mpc85xx)"
|
||||
|
||||
#########################################################################
|
||||
## MPC86xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_86xx="$(boards_by_cpu mpc86xx)"
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
|
||||
|
||||
#########################################################################
|
||||
## PowerPC groups
|
||||
#########################################################################
|
||||
|
||||
LIST_TSEC=" \
|
||||
${LIST_83xx} \
|
||||
${LIST_85xx} \
|
||||
${LIST_86xx} \
|
||||
"
|
||||
|
||||
LIST_powerpc=" \
|
||||
${LIST_5xx} \
|
||||
${LIST_512x} \
|
||||
${LIST_5xxx} \
|
||||
${LIST_8xx} \
|
||||
${LIST_8220} \
|
||||
${LIST_824x} \
|
||||
${LIST_8260} \
|
||||
${LIST_83xx} \
|
||||
${LIST_85xx} \
|
||||
${LIST_86xx} \
|
||||
${LIST_4xx} \
|
||||
${LIST_74xx_7xx}\
|
||||
"
|
||||
|
||||
# Alias "ppc" -> "powerpc" to not break compatibility with older scripts
|
||||
# still using "ppc" instead of "powerpc"
|
||||
LIST_ppc=" \
|
||||
${LIST_powerpc} \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="$(boards_by_cpu sa1100)"
|
||||
|
||||
#########################################################################
|
||||
## ARM9 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM9="$(boards_by_cpu arm920t) \
|
||||
$(boards_by_cpu arm926ejs) \
|
||||
$(boards_by_cpu arm925t) \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## ARM11 Systems
|
||||
#########################################################################
|
||||
LIST_ARM11="$(boards_by_cpu arm1136)"
|
||||
|
||||
#########################################################################
|
||||
## ARMV7 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_ARMV7="$(boards_by_cpu armv7)"
|
||||
|
||||
#########################################################################
|
||||
## AT91 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_at91="$(boards_by_soc at91)"
|
||||
|
||||
#########################################################################
|
||||
## Xscale Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_pxa="$(boards_by_cpu pxa)"
|
||||
|
||||
LIST_ixp="$(boards_by_cpu ixp)"
|
||||
|
||||
#########################################################################
|
||||
## ARM groups
|
||||
#########################################################################
|
||||
|
||||
LIST_arm=" \
|
||||
${LIST_SA} \
|
||||
${LIST_ARM9} \
|
||||
${LIST_ARM10} \
|
||||
${LIST_ARM11} \
|
||||
${LIST_ARMV7} \
|
||||
${LIST_at91} \
|
||||
${LIST_pxa} \
|
||||
${LIST_ixp} \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MIPS Systems (default = big endian)
|
||||
#########################################################################
|
||||
|
||||
LIST_mips4kc=" \
|
||||
incaip \
|
||||
qemu_mips \
|
||||
vct_platinum \
|
||||
vct_platinum_small \
|
||||
vct_platinum_onenand \
|
||||
vct_platinum_onenand_small \
|
||||
vct_platinumavc \
|
||||
vct_platinumavc_small \
|
||||
vct_platinumavc_onenand \
|
||||
vct_platinumavc_onenand_small \
|
||||
vct_premium \
|
||||
vct_premium_small \
|
||||
vct_premium_onenand \
|
||||
vct_premium_onenand_small \
|
||||
"
|
||||
|
||||
LIST_au1xx0=" \
|
||||
dbau1000 \
|
||||
dbau1100 \
|
||||
dbau1500 \
|
||||
dbau1550 \
|
||||
gth2 \
|
||||
"
|
||||
|
||||
LIST_mips=" \
|
||||
${LIST_mips4kc} \
|
||||
${LIST_mips5kc} \
|
||||
${LIST_au1xx0} \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MIPS Systems (little endian)
|
||||
#########################################################################
|
||||
|
||||
LIST_xburst_el=" \
|
||||
qi_lb60 \
|
||||
"
|
||||
|
||||
LIST_au1xx0_el=" \
|
||||
dbau1550_el \
|
||||
pb1000 \
|
||||
"
|
||||
LIST_mips_el=" \
|
||||
${LIST_xburst_el} \
|
||||
${LIST_au1xx0_el} \
|
||||
"
|
||||
#########################################################################
|
||||
## OpenRISC Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_openrisc="$(boards_by_arch openrisc)"
|
||||
|
||||
#########################################################################
|
||||
## x86 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_x86="$(boards_by_arch x86)"
|
||||
|
||||
#########################################################################
|
||||
## Nios-II Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_nios2="$(boards_by_arch nios2)"
|
||||
|
||||
#########################################################################
|
||||
## MicroBlaze Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_microblaze="$(boards_by_arch microblaze)"
|
||||
|
||||
#########################################################################
|
||||
## ColdFire Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_m68k="$(boards_by_arch m68k)
|
||||
EB+MCF-EV123 \
|
||||
EB+MCF-EV123_internal \
|
||||
M52277EVB \
|
||||
M5235EVB \
|
||||
M54451EVB \
|
||||
M54455EVB \
|
||||
"
|
||||
LIST_coldfire=${LIST_m68k}
|
||||
|
||||
#########################################################################
|
||||
## AVR32 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_avr32="$(boards_by_arch avr32)"
|
||||
|
||||
#########################################################################
|
||||
## Blackfin Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_blackfin="$(boards_by_arch blackfin)"
|
||||
|
||||
#########################################################################
|
||||
## SH Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_sh2="$(boards_by_cpu sh2)"
|
||||
LIST_sh3="$(boards_by_cpu sh3)"
|
||||
LIST_sh4="$(boards_by_cpu sh4)"
|
||||
|
||||
LIST_sh="$(boards_by_arch sh)"
|
||||
|
||||
#########################################################################
|
||||
## SPARC Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_sparc="$(boards_by_arch sparc)"
|
||||
|
||||
#########################################################################
|
||||
## NDS32 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_nds32="$(boards_by_arch nds32)"
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
get_target_location() {
|
||||
local target=$1
|
||||
local BOARD_NAME=""
|
||||
local CONFIG_NAME=""
|
||||
local board=""
|
||||
local vendor=""
|
||||
|
||||
# Automatic mode
|
||||
local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
|
||||
|
||||
if [ -z "${line}" ] ; then echo "" ; return ; fi
|
||||
|
||||
set ${line}
|
||||
|
||||
# add default board name if needed
|
||||
[ $# = 3 ] && set ${line} ${1}
|
||||
|
||||
CONFIG_NAME="${1%_config}"
|
||||
|
||||
[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
|
||||
|
||||
if [ "$4" = "-" ] ; then
|
||||
board=${BOARD_NAME}
|
||||
else
|
||||
board="$4"
|
||||
fi
|
||||
|
||||
[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
|
||||
[ $# -gt 6 ] && [ "$7" != "-" ] && {
|
||||
tmp="${7%:*}"
|
||||
if [ "$tmp" ] ; then
|
||||
CONFIG_NAME="$tmp"
|
||||
fi
|
||||
}
|
||||
|
||||
# Assign board directory to BOARDIR variable
|
||||
if [ -z "${vendor}" ] ; then
|
||||
BOARDDIR=${board}
|
||||
else
|
||||
BOARDDIR=${vendor}/${board}
|
||||
fi
|
||||
|
||||
echo "${CONFIG_NAME}:${BOARDDIR}"
|
||||
}
|
||||
|
||||
get_target_maintainers() {
|
||||
local name=`echo $1 | cut -d : -f 1`
|
||||
|
||||
if ! grep -qsi "[[:blank:]]${name}[[:blank:]]" MAINTAINERS ; then
|
||||
echo ""
|
||||
return ;
|
||||
fi
|
||||
|
||||
local line=`tac MAINTAINERS | grep -ni "[[:blank:]]${name}[[:blank:]]" | cut -d : -f 1`
|
||||
local mail=`tac MAINTAINERS | tail -n +${line} | \
|
||||
sed -n ":start /.*@.*/ { b mail } ; n ; b start ; :mail /.*@.*/ { p ; n ; b mail } ; q" | \
|
||||
sed "s/^.*<//;s/>.*$//"`
|
||||
echo "$mail"
|
||||
}
|
||||
|
||||
list_target() {
|
||||
if [ "$PRINT_MAINTS" != 'y' ] ; then
|
||||
echo "$1"
|
||||
return
|
||||
fi
|
||||
|
||||
echo -n "$1:"
|
||||
|
||||
local loc=`get_target_location $1`
|
||||
|
||||
if [ -z "${loc}" ] ; then echo "ERROR" ; return ; fi
|
||||
|
||||
local maintainers_result=`get_target_maintainers ${loc} | tr " " "\n"`
|
||||
|
||||
if [ "$MAINTAINERS_ONLY" != 'y' ] ; then
|
||||
|
||||
local dir=`echo ${loc} | cut -d ":" -f 2`
|
||||
local cfg=`echo ${loc} | cut -d ":" -f 1`
|
||||
local git_result=`git log --format=%aE board/${dir} \
|
||||
include/configs/${cfg}.h | grep "@"`
|
||||
local git_result_recent=`echo ${git_result} | tr " " "\n" | \
|
||||
head -n 3`
|
||||
local git_result_top=`echo ${git_result} | tr " " "\n" | \
|
||||
sort | uniq -c | sort -nr | head -n 3 | \
|
||||
sed "s/^ \+[0-9]\+ \+//"`
|
||||
|
||||
echo -e "$git_result_recent\n$git_result_top\n$maintainers_result" | \
|
||||
sort -u | tr "\n" " " | sed "s/ $//" ;
|
||||
else
|
||||
echo -e "$maintainers_result" | sort -u | tr "\n" " " | \
|
||||
sed "s/ $//" ;
|
||||
fi
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Each finished build will have a file called ${donep}${n},
|
||||
# where n is the index of the build. Each build
|
||||
# we've already noted as finished will have ${skipp}${n}.
|
||||
# The code managing the build process will use this information
|
||||
# to ensure that only BUILD_NBUILDS builds are in flight at once
|
||||
donep="${LOG_DIR}/._done_"
|
||||
skipp="${LOG_DIR}/._skip_"
|
||||
|
||||
build_target() {
|
||||
target=$1
|
||||
build_idx=$2
|
||||
|
||||
if [ "$ONLY_LIST" == 'y' ] ; then
|
||||
list_target ${target}
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $BUILD_MANY == 1 ] ; then
|
||||
output_dir="${OUTPUT_PREFIX}/${target}"
|
||||
mkdir -p "${output_dir}"
|
||||
else
|
||||
output_dir="${OUTPUT_PREFIX}"
|
||||
fi
|
||||
|
||||
export BUILD_DIR="${output_dir}"
|
||||
|
||||
${MAKE} distclean >/dev/null
|
||||
${MAKE} -s ${target}_config
|
||||
|
||||
${MAKE} ${JOBS} all \
|
||||
>${LOG_DIR}/$target.MAKELOG 2> ${LOG_DIR}/$target.ERR
|
||||
|
||||
# Check for 'make' errors
|
||||
if [ ${PIPESTATUS[0]} -ne 0 ] ; then
|
||||
RC=1
|
||||
fi
|
||||
|
||||
if [ $BUILD_MANY == 1 ] ; then
|
||||
${MAKE} tidy
|
||||
|
||||
if [ -s ${LOG_DIR}/${target}.ERR ] ; then
|
||||
cp ${LOG_DIR}/${target}.ERR ${OUTPUT_PREFIX}/ERR/${target}
|
||||
else
|
||||
rm ${LOG_DIR}/${target}.ERR
|
||||
fi
|
||||
else
|
||||
if [ -s ${LOG_DIR}/${target}.ERR ] ; then
|
||||
if grep -iw error ${LOG_DIR}/${target}.ERR ; then
|
||||
: $(( ERR_CNT += 1 ))
|
||||
ERR_LIST="${ERR_LIST} $target"
|
||||
else
|
||||
: $(( WRN_CNT += 1 ))
|
||||
WRN_LIST="${WRN_LIST} $target"
|
||||
fi
|
||||
else
|
||||
rm ${LOG_DIR}/${target}.ERR
|
||||
fi
|
||||
fi
|
||||
|
||||
OBJS=${output_dir}/u-boot
|
||||
if [ -e ${output_dir}/spl/u-boot-spl ]; then
|
||||
OBJS="${OBJS} ${output_dir}/spl/u-boot-spl"
|
||||
fi
|
||||
|
||||
${CROSS_COMPILE}size ${OBJS} | tee -a ${LOG_DIR}/$target.MAKELOG
|
||||
|
||||
[ -e "${LOG_DIR}/${target}.ERR" ] && cat "${LOG_DIR}/${target}.ERR"
|
||||
|
||||
touch "${donep}${build_idx}"
|
||||
}
|
||||
|
||||
manage_builds() {
|
||||
search_idx=${OLDEST_IDX}
|
||||
if [ "$ONLY_LIST" == 'y' ] ; then return ; fi
|
||||
|
||||
while true; do
|
||||
if [ -e "${donep}${search_idx}" ] ; then
|
||||
: $(( CURRENT_CNT-- ))
|
||||
[ ${OLDEST_IDX} -eq ${search_idx} ] &&
|
||||
: $(( OLDEST_IDX++ ))
|
||||
|
||||
# Only want to count it once
|
||||
rm -f "${donep}${search_idx}"
|
||||
touch "${skipp}${search_idx}"
|
||||
elif [ -e "${skipp}${search_idx}" ] ; then
|
||||
[ ${OLDEST_IDX} -eq ${search_idx} ] &&
|
||||
: $(( OLDEST_IDX++ ))
|
||||
fi
|
||||
: $(( search_idx++ ))
|
||||
if [ ${search_idx} -gt ${TOTAL_CNT} ] ; then
|
||||
if [ ${CURRENT_CNT} -ge ${BUILD_NBUILDS} ] ; then
|
||||
search_idx=${OLDEST_IDX}
|
||||
sleep 1
|
||||
else
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
build_targets() {
|
||||
for t in "$@" ; do
|
||||
# If a LIST_xxx var exists, use it. But avoid variable
|
||||
# expansion in the eval when a board name contains certain
|
||||
# characters that the shell interprets.
|
||||
case ${t} in
|
||||
*[-+=]*) list= ;;
|
||||
*) list=$(eval echo '${LIST_'$t'}') ;;
|
||||
esac
|
||||
if [ -n "${list}" ] ; then
|
||||
build_targets ${list}
|
||||
else
|
||||
: $((TOTAL_CNT += 1))
|
||||
: $((CURRENT_CNT += 1))
|
||||
rm -f "${donep}${TOTAL_CNT}"
|
||||
rm -f "${skipp}${TOTAL_CNT}"
|
||||
if [ $BUILD_MANY == 1 ] ; then
|
||||
build_target ${t} ${TOTAL_CNT} &
|
||||
else
|
||||
build_target ${t} ${TOTAL_CNT}
|
||||
fi
|
||||
fi
|
||||
|
||||
# We maintain a running count of all the builds we have done.
|
||||
# Each finished build will have a file called ${donep}${n},
|
||||
# where n is the index of the build. Each build
|
||||
# we've already noted as finished will have ${skipp}${n}.
|
||||
# We track the current index via TOTAL_CNT, and the oldest
|
||||
# index. When we exceed the maximum number of parallel builds,
|
||||
# We look from oldest to current for builds that have completed,
|
||||
# and update the current count and oldest index as appropriate.
|
||||
# If we've gone through the entire list, wait a second, and
|
||||
# reprocess the entire list until we find a build that has
|
||||
# completed
|
||||
if [ ${CURRENT_CNT} -ge ${BUILD_NBUILDS} ] ; then
|
||||
manage_builds
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
kill_children() {
|
||||
kill -- "-$1"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
print_stats() {
|
||||
if [ "$ONLY_LIST" == 'y' ] ; then return ; fi
|
||||
|
||||
rm -f ${donep}* ${skipp}*
|
||||
|
||||
if [ $BUILD_MANY == 1 ] && [ -e "${OUTPUT_PREFIX}/ERR" ] ; then
|
||||
ERR_LIST=`grep -iwl error ${OUTPUT_PREFIX}/ERR/*`
|
||||
ERR_LIST=`for f in $ERR_LIST ; do echo -n " $(basename $f)" ; done`
|
||||
ERR_CNT=`echo $ERR_LIST | wc -w | awk '{print $1}'`
|
||||
WRN_LIST=`grep -iwL error ${OUTPUT_PREFIX}/ERR/*`
|
||||
WRN_LIST=`for f in $WRN_LIST ; do echo -n " $(basename $f)" ; done`
|
||||
WRN_CNT=`echo $WRN_LIST | wc -w | awk '{print $1}'`
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--------------------- SUMMARY ----------------------------"
|
||||
echo "Boards compiled: ${TOTAL_CNT}"
|
||||
if [ ${ERR_CNT} -gt 0 ] ; then
|
||||
echo "Boards with errors: ${ERR_CNT} (${ERR_LIST} )"
|
||||
fi
|
||||
if [ ${WRN_CNT} -gt 0 ] ; then
|
||||
echo "Boards with warnings but no errors: ${WRN_CNT} (${WRN_LIST} )"
|
||||
fi
|
||||
echo "----------------------------------------------------------"
|
||||
|
||||
if [ $BUILD_MANY == 1 ] ; then
|
||||
kill_children $$ &
|
||||
fi
|
||||
|
||||
exit $RC
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
# Build target groups selected by options, plus any command line args
|
||||
set -- ${SELECTED} "$@"
|
||||
# run PowerPC by default
|
||||
[ $# = 0 ] && set -- powerpc
|
||||
build_targets "$@"
|
||||
wait
|
|
@ -1,41 +0,0 @@
|
|||
#!/usr/bin/gawk -f
|
||||
BEGIN {
|
||||
print "/* DO NOT EDIT: AUTOMATICALLY GENERATED"
|
||||
print " * Input files: bootrom-asm-offsets.awk bootrom-asm-offsets.c.in"
|
||||
print " * DO NOT EDIT: AUTOMATICALLY GENERATED"
|
||||
print " */"
|
||||
print ""
|
||||
system("cat bootrom-asm-offsets.c.in")
|
||||
print "{"
|
||||
}
|
||||
|
||||
{
|
||||
/* find a structure definition */
|
||||
if ($0 ~ /typedef struct .* {/) {
|
||||
delete members;
|
||||
i = 0;
|
||||
|
||||
/* extract each member of the structure */
|
||||
while (1) {
|
||||
getline
|
||||
if ($1 == "}")
|
||||
break;
|
||||
gsub(/[*;]/, "");
|
||||
members[i++] = $NF;
|
||||
}
|
||||
|
||||
/* grab the structure's name */
|
||||
struct = $NF;
|
||||
sub(/;$/, "", struct);
|
||||
|
||||
/* output the DEFINE() macros */
|
||||
while (i-- > 0)
|
||||
print "\tDEFINE(" struct ", " members[i] ");"
|
||||
print ""
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
print "\treturn 0;"
|
||||
print "}"
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,149 +0,0 @@
|
|||
|
||||
/* * Copyright (c) 2012 The Linux Foundation. All rights reserved.* */
|
||||
|
||||
/**\file
|
||||
* This file serves as the wrapper for the platform/OS dependent functions
|
||||
* It is needed to modify these functions accordingly based on the platform and the
|
||||
* OS. Whenever the synopsys GMAC driver ported on to different platform, this file
|
||||
* should be handled at most care.
|
||||
* The corresponding function definitions for non-inline functions are available in
|
||||
* synopGMAC_plat.c file.
|
||||
* \internal
|
||||
* -------------------------------------REVISION HISTORY---------------------------
|
||||
* Ubicom 01/Mar/2010 Modified for Ubicom32
|
||||
* Synopsys 01/Aug/2007 Created
|
||||
*/
|
||||
|
||||
#ifndef SYNOP_GMAC_PLAT_H
|
||||
#define SYNOP_GMAC_PLAT_H 1
|
||||
|
||||
#include <common.h>
|
||||
#include <net.h>
|
||||
#include <asm-generic/errno.h>
|
||||
#include "uboot_skb.h"
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CACHE_LINE_SHIFT 5
|
||||
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* in bytes */
|
||||
|
||||
#define TR0(fmt, args...) printf("SynopGMAC: " fmt, ##args)
|
||||
# define TR(fmt, args...) /* not debugging: nothing */
|
||||
|
||||
typedef int bool;
|
||||
|
||||
#define virt_to_phys(x) ((unsigned long)(x))
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#define NETDEV_TX_OK 0
|
||||
#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
|
||||
|
||||
#define DEFAULT_DELAY_VARIABLE 10
|
||||
#define DEFAULT_LOOP_VARIABLE 10/*000*/
|
||||
|
||||
/* There are platform related endian conversions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Error Codes */
|
||||
#define ESYNOPGMACNOERR 0
|
||||
#define ESYNOPGMACNOMEM ENOMEM
|
||||
#define ESYNOPGMACPHYERR EIO
|
||||
|
||||
static void __inline__ *plat_alloc_consistent_dmaable_memory(void *dev, size_t size, dma_addr_t *dma_addr)
|
||||
{
|
||||
void *buf = memalign(CACHE_LINE_SIZE, size);
|
||||
*dma_addr = (dma_addr_t)(virt_to_phys(buf));
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Low level function to read register contents from Hardware.
|
||||
*
|
||||
* @param[in] pointer to the base of register map
|
||||
* @param[in] Offset from the base
|
||||
* \return Returns the register contents
|
||||
*/
|
||||
static u32 __inline__ synopGMACReadReg(u32 *RegBase, u32 RegOffset)
|
||||
{
|
||||
u32 addr = (u32)RegBase + RegOffset;
|
||||
u32 data;
|
||||
|
||||
data = readl(addr);
|
||||
TR("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__, (u32)RegBase, RegOffset, data );
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Low level function to write to a register in Hardware.
|
||||
*
|
||||
* @param[in] pointer to the base of register map
|
||||
* @param[in] Offset from the base
|
||||
* @param[in] Data to be written
|
||||
* \return void
|
||||
*/
|
||||
static void __inline__ synopGMACWriteReg(u32 *RegBase, u32 RegOffset, u32 RegData)
|
||||
{
|
||||
u32 addr = (u32)RegBase + RegOffset;
|
||||
|
||||
writel(RegData, addr);
|
||||
TR("%s RegBase = 0x%08x RegOffset = 0x%08x RegData = 0x%08x\n", __FUNCTION__,(u32) RegBase, RegOffset, RegData );
|
||||
}
|
||||
|
||||
/**
|
||||
* The Low level function to set bits of a register in Hardware.
|
||||
*
|
||||
* @param[in] pointer to the base of register map
|
||||
* @param[in] Offset from the base
|
||||
* @param[in] Bit mask to set bits to logical 1
|
||||
* \return void
|
||||
*/
|
||||
static void __inline__ synopGMACSetBits(u32 *RegBase, u32 RegOffset, u32 BitPos)
|
||||
{
|
||||
u32 addr = (u32)RegBase + RegOffset;
|
||||
|
||||
setbits_le32(addr,BitPos);
|
||||
TR("%s !!!!!!!!!!!!! RegOffset = 0x%08x RegData = 0x%08x (| 0x%08x)\n", __FUNCTION__, RegOffset, data, BitPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Low level function to clear bits of a register in Hardware.
|
||||
*
|
||||
* @param[in] pointer to the base of register map
|
||||
* @param[in] Offset from the base
|
||||
* @param[in] Bit mask to clear bits to logical 0
|
||||
* \return void
|
||||
*/
|
||||
static void __inline__ synopGMACClearBits(u32 *RegBase, u32 RegOffset, u32 BitPos)
|
||||
{
|
||||
u32 addr = (u32)RegBase + RegOffset;
|
||||
|
||||
clrbits_le32( addr, BitPos);
|
||||
TR("%s !!!!!!!!!!! RegOffset = 0x%08x RegData = 0x%08x (& ~0x%08x)\n", __FUNCTION__, RegOffset, data, BitPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Low level function to Check the setting of the bits.
|
||||
*
|
||||
* @param[in] pointer to the base of register map
|
||||
* @param[in] Offset from the base
|
||||
* @param[in] Bit mask to set bits to logical 1
|
||||
* \return returns TRUE if set to '1' returns FALSE if set to '0'. Result undefined there are no bit set in the BitPos argument.
|
||||
*
|
||||
*/
|
||||
static bool __inline__ synopGMACCheckBits(u32 *RegBase, u32 RegOffset, u32 BitPos)
|
||||
{
|
||||
u32 addr = (u32)RegBase + RegOffset;
|
||||
u32 data;
|
||||
|
||||
data = readl(addr) & BitPos ;
|
||||
return (data != 0);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Definitions for the 'struct sk_buff' memory handlers in U-Boot.
|
||||
*
|
||||
n (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <common.h>
|
||||
#include "uboot_skb.h"
|
||||
|
||||
#define MAX_SKB 1024
|
||||
|
||||
static struct sk_buff *sk_table[MAX_SKB];
|
||||
|
||||
struct sk_buff * alloc_skb(u32 size, int dummy)
|
||||
{
|
||||
int i;
|
||||
struct sk_buff * ret = NULL;
|
||||
|
||||
for (i = 0; i < MAX_SKB; i++)
|
||||
{
|
||||
if (sk_table[i])
|
||||
{
|
||||
/* Already allocated.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
sk_table[i] = malloc(sizeof(struct sk_buff));
|
||||
if (! sk_table[i])
|
||||
{
|
||||
printf("alloc_skb: malloc failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
memset(sk_table[i], 0, sizeof(struct sk_buff));
|
||||
sk_table[i]->data = sk_table[i]->data_unaligned =
|
||||
malloc(size + 48);
|
||||
if (! sk_table[i]->data)
|
||||
{
|
||||
printf("alloc_skb: malloc failed\n");
|
||||
free(sk_table[i]);
|
||||
sk_table[i] = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
sk_table[i]->data += 48 - ((u32)sk_table[i]->data & 31);
|
||||
sk_table[i]->len = size;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < MAX_SKB)
|
||||
{
|
||||
ret = sk_table[i];
|
||||
}
|
||||
|
||||
if (! ret)
|
||||
{
|
||||
printf("Unable to allocate skb!\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void dev_kfree_skb_any(struct sk_buff *skb)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_SKB; i++)
|
||||
{
|
||||
if (sk_table[i] != skb)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
free(skb->data_unaligned);
|
||||
free(skb);
|
||||
sk_table[i] = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void skb_reserve(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
skb->data+=len;
|
||||
}
|
||||
|
||||
void skb_put(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
skb->len+=len;
|
||||
}
|
||||
|
||||
void cleanup_skb(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_SKB; i++)
|
||||
{
|
||||
if (sk_table[i])
|
||||
{
|
||||
/* Already allocated.
|
||||
*/
|
||||
free(sk_table[i]->data_unaligned);
|
||||
free(sk_table[i]);
|
||||
sk_table[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _UBOOT_COMPAT_H__
|
||||
#define _UBOOT_COMPAT_H__
|
||||
|
||||
#include <common.h>
|
||||
#include <malloc.h>
|
||||
#include <net.h>
|
||||
|
||||
#define netif_start_queue(x)
|
||||
#define netif_stop_queue(x)
|
||||
#define netif_wake_queue(x)
|
||||
|
||||
#define dev_addr enetaddr
|
||||
struct sk_buff
|
||||
{
|
||||
u8 * data;
|
||||
u32 len;
|
||||
u8 * data_unaligned;
|
||||
u32 padding;
|
||||
char cb[16];
|
||||
};
|
||||
|
||||
struct sk_buff * alloc_skb(u32 size, int dummy);
|
||||
void dev_kfree_skb_any(struct sk_buff *skb);
|
||||
void skb_reserve(struct sk_buff *skb, unsigned int len);
|
||||
void skb_put(struct sk_buff *skb, unsigned int len);
|
||||
|
||||
#define dev_kfree_skb dev_kfree_skb_any
|
||||
#define dev_kfree_skb_irq dev_kfree_skb_any
|
||||
|
||||
#endif /* _UBOOT_COMPAT_H__ */
|
|
@ -1,181 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Script to create header files and links to configure
|
||||
# U-Boot for a specific board.
|
||||
#
|
||||
# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
|
||||
#
|
||||
# (C) 2002-2010 DENX Software Engineering, Wolfgang Denk <wd@denx.de>
|
||||
#
|
||||
|
||||
APPEND=no # Default: Create new config file
|
||||
BOARD_NAME="" # Name to print in make output
|
||||
TARGETS=""
|
||||
|
||||
arch=""
|
||||
cpu=""
|
||||
board=""
|
||||
vendor=""
|
||||
soc=""
|
||||
options=""
|
||||
|
||||
if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
|
||||
# Automatic mode
|
||||
line=`egrep -i "^[[:space:]]*${2}[[:space:]]" boards.cfg` || {
|
||||
echo "make: *** No rule to make target \`$2_config'. Stop." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
set ${line}
|
||||
# add default board name if needed
|
||||
[ $# = 3 ] && set ${line} ${1}
|
||||
elif [ "${MAKEFLAGS+set}${MAKELEVEL+set}" = "setset" ] ; then
|
||||
# only warn when using a config target in the Makefile
|
||||
cat <<-EOF
|
||||
|
||||
warning: Please migrate to boards.cfg. Failure to do so will
|
||||
mean removal of your board in the next release.
|
||||
|
||||
EOF
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
case "$1" in
|
||||
--) shift ; break ;;
|
||||
-a) shift ; APPEND=yes ;;
|
||||
-n) shift ; BOARD_NAME="${1%_config}" ; shift ;;
|
||||
-t) shift ; TARGETS="`echo $1 | sed 's:_: :g'` ${TARGETS}" ; shift ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ $# -lt 4 ] && exit 1
|
||||
[ $# -gt 7 ] && exit 1
|
||||
|
||||
# Strip all options and/or _config suffixes
|
||||
CONFIG_NAME="${1%_config}"
|
||||
|
||||
[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
|
||||
|
||||
arch="$2"
|
||||
cpu="$3"
|
||||
if [ "$4" = "-" ] ; then
|
||||
board=${BOARD_NAME}
|
||||
else
|
||||
board="$4"
|
||||
fi
|
||||
[ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
|
||||
[ $# -gt 5 ] && [ "$6" != "-" ] && soc="$6"
|
||||
[ $# -gt 6 ] && [ "$7" != "-" ] && {
|
||||
# check if we have a board config name in the options field
|
||||
# the options field mave have a board config name and a list
|
||||
# of options, both separated by a colon (':'); the options are
|
||||
# separated by commas (',').
|
||||
#
|
||||
# Check for board name
|
||||
tmp="${7%:*}"
|
||||
if [ "$tmp" ] ; then
|
||||
CONFIG_NAME="$tmp"
|
||||
fi
|
||||
# Check if we only have a colon...
|
||||
if [ "${tmp}" != "$7" ] ; then
|
||||
options=${7#*:}
|
||||
TARGETS="`echo ${options} | sed 's:,: :g'` ${TARGETS}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then
|
||||
echo "Failed: \$ARCH=${ARCH}, should be '${arch}' for ${BOARD_NAME}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$options" ] ; then
|
||||
echo "Configuring for ${BOARD_NAME} - Board: ${CONFIG_NAME}, Options: ${options}"
|
||||
else
|
||||
echo "Configuring for ${BOARD_NAME} board..."
|
||||
fi
|
||||
|
||||
#
|
||||
# Create link to architecture specific headers
|
||||
#
|
||||
if [ "$SRCTREE" != "$OBJTREE" ] ; then
|
||||
mkdir -p ${OBJTREE}/include
|
||||
mkdir -p ${OBJTREE}/include2
|
||||
cd ${OBJTREE}/include2
|
||||
rm -f asm
|
||||
ln -s ${SRCTREE}/arch/${arch}/include/asm asm
|
||||
LNPREFIX=${SRCTREE}/arch/${arch}/include/asm/
|
||||
cd ../include
|
||||
mkdir -p asm
|
||||
else
|
||||
cd ./include
|
||||
rm -f asm
|
||||
ln -s ../arch/${arch}/include/asm asm
|
||||
fi
|
||||
|
||||
rm -f asm/arch
|
||||
|
||||
if [ -z "${soc}" ] ; then
|
||||
ln -s ${LNPREFIX}arch-${cpu} asm/arch
|
||||
else
|
||||
ln -s ${LNPREFIX}arch-${soc} asm/arch
|
||||
fi
|
||||
|
||||
if [ "${arch}" = "arm" ] ; then
|
||||
rm -f asm/proc
|
||||
ln -s ${LNPREFIX}proc-armv asm/proc
|
||||
fi
|
||||
|
||||
#
|
||||
# Create include file for Make
|
||||
#
|
||||
echo "ARCH = ${arch}" > config.mk
|
||||
echo "CPU = ${cpu}" >> config.mk
|
||||
echo "BOARD = ${board}" >> config.mk
|
||||
|
||||
[ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
|
||||
|
||||
[ "${soc}" ] && echo "SOC = ${soc}" >> config.mk
|
||||
|
||||
# Assign board directory to BOARDIR variable
|
||||
if [ -z "${vendor}" ] ; then
|
||||
BOARDDIR=${board}
|
||||
else
|
||||
BOARDDIR=${vendor}/${board}
|
||||
fi
|
||||
|
||||
#
|
||||
# Create board specific header file
|
||||
#
|
||||
if [ "$APPEND" = "yes" ] # Append to existing config file
|
||||
then
|
||||
echo >> config.h
|
||||
else
|
||||
> config.h # Create new config file
|
||||
fi
|
||||
echo "/* Automatically generated - do not edit */" >>config.h
|
||||
|
||||
for i in ${TARGETS} ; do
|
||||
i="`echo ${i} | sed '/=/ {s/=/ /;q; } ; { s/$/ 1/; }'`"
|
||||
echo "#define CONFIG_${i}" >>config.h ;
|
||||
done
|
||||
|
||||
echo "#define CONFIG_SYS_ARCH \"${arch}\"" >> config.h
|
||||
echo "#define CONFIG_SYS_CPU \"${cpu}\"" >> config.h
|
||||
echo "#define CONFIG_SYS_BOARD \"${board}\"" >> config.h
|
||||
|
||||
[ "${vendor}" ] && echo "#define CONFIG_SYS_VENDOR \"${vendor}\"" >> config.h
|
||||
|
||||
[ "${soc}" ] && echo "#define CONFIG_SYS_SOC \"${soc}\"" >> config.h
|
||||
|
||||
cat << EOF >> config.h
|
||||
#define CONFIG_BOARDDIR board/$BOARDDIR
|
||||
#include <config_cmd_defaults.h>
|
||||
#include <config_defaults.h>
|
||||
#include <configs/${CONFIG_NAME}.h>
|
||||
#include <asm/config.h>
|
||||
#include <config_fallbacks.h>
|
||||
EOF
|
||||
|
||||
exit 0
|
File diff suppressed because it is too large
Load diff
|
@ -1,171 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Check the stack usage of functions
|
||||
#
|
||||
# Copyright Joern Engel <joern@lazybastard.org>
|
||||
# Inspired by Linus Torvalds
|
||||
# Original idea maybe from Keith Owens
|
||||
# s390 port and big speedup by Arnd Bergmann <arnd@bergmann-dalldorf.de>
|
||||
# Mips port by Juan Quintela <quintela@mandrakesoft.com>
|
||||
# IA64 port via Andreas Dilger
|
||||
# Arm port by Holger Schurig
|
||||
# sh64 port by Paul Mundt
|
||||
# Random bits by Matt Mackall <mpm@selenic.com>
|
||||
# M68k port by Geert Uytterhoeven and Andreas Schwab
|
||||
# AVR32 port by Haavard Skinnemoen (Atmel)
|
||||
# PARISC port by Kyle McMartin <kyle@parisc-linux.org>
|
||||
# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
|
||||
#
|
||||
# Usage:
|
||||
# objdump -d vmlinux | scripts/checkstack.pl [arch]
|
||||
#
|
||||
# TODO : Port to all architectures (one regex per arch)
|
||||
|
||||
use strict;
|
||||
|
||||
# check for arch
|
||||
#
|
||||
# $re is used for two matches:
|
||||
# $& (whole re) matches the complete objdump line with the stack growth
|
||||
# $1 (first bracket) matches the size of the stack growth
|
||||
#
|
||||
# $dre is similar, but for dynamic stack redutions:
|
||||
# $& (whole re) matches the complete objdump line with the stack growth
|
||||
# $1 (first bracket) matches the dynamic amount of the stack growth
|
||||
#
|
||||
# use anything else and feel the pain ;)
|
||||
my (@stack, $re, $dre, $x, $xs);
|
||||
{
|
||||
my $arch = shift;
|
||||
if ($arch eq "") {
|
||||
$arch = `uname -m`;
|
||||
chomp($arch);
|
||||
}
|
||||
|
||||
$x = "[0-9a-f]"; # hex character
|
||||
$xs = "[0-9a-f ]"; # hex character or space
|
||||
if ($arch eq 'arm') {
|
||||
#c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64
|
||||
$re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
|
||||
} elsif ($arch eq 'avr32') {
|
||||
#8000008a: 20 1d sub sp,4
|
||||
#80000ca8: fa cd 05 b0 sub sp,sp,1456
|
||||
$re = qr/^.*sub.*sp.*,([0-9]{1,8})/o;
|
||||
} elsif ($arch =~ /^i[3456]86$/) {
|
||||
#c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp
|
||||
$re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o;
|
||||
$dre = qr/^.*[as][du][db] (%.*),\%esp$/o;
|
||||
} elsif ($arch eq 'x86_64') {
|
||||
# 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp
|
||||
$re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o;
|
||||
$dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o;
|
||||
} elsif ($arch eq 'ia64') {
|
||||
#e0000000044011fc: 01 0f fc 8c adds r12=-384,r12
|
||||
$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
|
||||
} elsif ($arch eq 'm68k') {
|
||||
# 2b6c: 4e56 fb70 linkw %fp,#-1168
|
||||
# 1df770: defc ffe4 addaw #-28,%sp
|
||||
$re = qr/.*(?:linkw %fp,|addaw )#-([0-9]{1,4})(?:,%sp)?$/o;
|
||||
} elsif ($arch eq 'mips64') {
|
||||
#8800402c: 67bdfff0 daddiu sp,sp,-16
|
||||
$re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
|
||||
} elsif ($arch eq 'mips') {
|
||||
#88003254: 27bdffe0 addiu sp,sp,-32
|
||||
$re = qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
|
||||
} elsif ($arch eq 'parisc' || $arch eq 'parisc64') {
|
||||
$re = qr/.*ldo ($x{1,8})\(sp\),sp/o;
|
||||
} elsif ($arch eq 'ppc') {
|
||||
#c00029f4: 94 21 ff 30 stwu r1,-208(r1)
|
||||
$re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o;
|
||||
} elsif ($arch eq 'ppc64') {
|
||||
#XXX
|
||||
$re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o;
|
||||
} elsif ($arch eq 'powerpc') {
|
||||
$re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o;
|
||||
} elsif ($arch =~ /^s390x?$/) {
|
||||
# 11160: a7 fb ff 60 aghi %r15,-160
|
||||
# or
|
||||
# 100092: e3 f0 ff c8 ff 71 lay %r15,-56(%r15)
|
||||
$re = qr/.*(?:lay|ag?hi).*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})
|
||||
(?:\(\%r15\))?$/ox;
|
||||
} elsif ($arch =~ /^sh64$/) {
|
||||
#XXX: we only check for the immediate case presently,
|
||||
# though we will want to check for the movi/sub
|
||||
# pair for larger users. -- PFM.
|
||||
#a00048e0: d4fc40f0 addi.l r15,-240,r15
|
||||
$re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;
|
||||
} elsif ($arch =~ /^blackfin$/) {
|
||||
# 0: 00 e8 38 01 LINK 0x4e0;
|
||||
$re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
|
||||
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
|
||||
# f0019d10: 9d e3 bf 90 save %sp, -112, %sp
|
||||
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
|
||||
} else {
|
||||
print("wrong or unknown architecture \"$arch\"\n");
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# main()
|
||||
#
|
||||
my $funcre = qr/^$x* <(.*)>:$/;
|
||||
my ($func, $file, $lastslash);
|
||||
|
||||
while (my $line = <STDIN>) {
|
||||
if ($line =~ m/$funcre/) {
|
||||
$func = $1;
|
||||
}
|
||||
elsif ($line =~ m/(.*):\s*file format/) {
|
||||
$file = $1;
|
||||
$file =~ s/\.ko//;
|
||||
$lastslash = rindex($file, "/");
|
||||
if ($lastslash != -1) {
|
||||
$file = substr($file, $lastslash + 1);
|
||||
}
|
||||
}
|
||||
elsif ($line =~ m/$re/) {
|
||||
my $size = $1;
|
||||
$size = hex($size) if ($size =~ /^0x/);
|
||||
|
||||
if ($size > 0xf0000000) {
|
||||
$size = - $size;
|
||||
$size += 0x80000000;
|
||||
$size += 0x80000000;
|
||||
}
|
||||
next if ($size > 0x10000000);
|
||||
|
||||
next if $line !~ m/^($xs*)/;
|
||||
my $addr = $1;
|
||||
$addr =~ s/ /0/g;
|
||||
$addr = "0x$addr";
|
||||
|
||||
my $intro = "$addr $func [$file]:";
|
||||
my $padlen = 56 - length($intro);
|
||||
while ($padlen > 0) {
|
||||
$intro .= ' ';
|
||||
$padlen -= 8;
|
||||
}
|
||||
next if ($size < 100);
|
||||
push @stack, "$intro$size\n";
|
||||
}
|
||||
elsif (defined $dre && $line =~ m/$dre/) {
|
||||
my $size = "Dynamic ($1)";
|
||||
|
||||
next if $line !~ m/^($xs*)/;
|
||||
my $addr = $1;
|
||||
$addr =~ s/ /0/g;
|
||||
$addr = "0x$addr";
|
||||
|
||||
my $intro = "$addr $func [$file]:";
|
||||
my $padlen = 56 - length($intro);
|
||||
while ($padlen > 0) {
|
||||
$intro .= ' ';
|
||||
$padlen -= 8;
|
||||
}
|
||||
push @stack, "$intro$size\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Sort output by size (last field)
|
||||
print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack;
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# gcc-version [-p] gcc-command
|
||||
#
|
||||
# Prints the gcc version of `gcc-command' in a canonical 4-digit form
|
||||
# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
|
||||
#
|
||||
# With the -p option, prints the patchlevel as well, for example `029503' for
|
||||
# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
|
||||
#
|
||||
|
||||
if [ "$1" = "-p" ] ; then
|
||||
with_patchlevel=1;
|
||||
shift;
|
||||
fi
|
||||
|
||||
compiler="$*"
|
||||
|
||||
if [ ${#compiler} -eq 0 ]; then
|
||||
echo "Error: No compiler specified."
|
||||
printf "Usage:\n\t$0 <gcc-command>\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
|
||||
MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
|
||||
if [ "x$with_patchlevel" != "x" ] ; then
|
||||
PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
|
||||
printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
|
||||
else
|
||||
printf "%02d%02d\\n" $MAJOR $MINOR
|
||||
fi
|
|
@ -1,388 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script converts binary files (u-boot.bin) into so called
|
||||
# bootstrap records that are accepted by Motorola's MC9328MX1/L
|
||||
# (a.k.a. DragaonBall i.MX) in "Bootstrap Mode"
|
||||
#
|
||||
# The code for the SynchFlash programming routines is taken from
|
||||
# Bootloader\Bin\SyncFlash\programBoot_b.txt contained in
|
||||
# Motorolas LINUX_BSP_0_3_8.tar.gz
|
||||
#
|
||||
# The script could easily extended for AMD flash routines.
|
||||
#
|
||||
# 2004-06-23 - steven.scholz@imc-berlin.de
|
||||
|
||||
#################################################################################
|
||||
# From the posting to the U-Boot-Users mailing list, 23 Jun 2004:
|
||||
# ===============================================================
|
||||
# I just hacked a simple script that converts u-boot.bin into a text file
|
||||
# containg processor init code, SynchFlash programming code and U-Boot data in
|
||||
# form of so called b-records.
|
||||
#
|
||||
# This can be used to programm U-Boot into (Synch)Flash using the Bootstrap
|
||||
# Mode of the MC9328MX1/L
|
||||
#
|
||||
# 0AFE1F3410202E2E2E000000002073756363656564/
|
||||
# 0AFE1F44102E0A0000206661696C656420210A0000/
|
||||
# 0AFE100000
|
||||
# ...
|
||||
# MX1ADS Sync-flash Programming Utility v0.5 2002/08/21
|
||||
#
|
||||
# Source address (stored in 0x0AFE0000): 0x0A000000
|
||||
# Target address (stored in 0x0AFE0004): 0x0C000000
|
||||
# Size (stored in 0x0AFE0008): 0x0001A320
|
||||
#
|
||||
# Press any key to start programming ...
|
||||
# Erasing ...
|
||||
# Blank checking ...
|
||||
# Programming ...
|
||||
# Verifying flash ... succeed.
|
||||
#
|
||||
# Programming finished.
|
||||
#
|
||||
# So no need for a BDI2000 anymore... ;-)
|
||||
#
|
||||
# This is working on my MX1ADS eval board. Hope this could be useful for
|
||||
# someone.
|
||||
#################################################################################
|
||||
|
||||
if [ "$#" -lt 1 -o "$#" -gt 2 ] ; then
|
||||
echo "Usage: $0 infile [outfile]" >&2
|
||||
echo " $0 u-boot.bin [u-boot.brec]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -ge 1 ] ; then
|
||||
INFILE=$1
|
||||
fi
|
||||
|
||||
if [ ! -f $INFILE ] ; then
|
||||
echo "Error: file '$INFILE' does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILESIZE=`filesize $INFILE`
|
||||
|
||||
output_init()
|
||||
{
|
||||
echo "\
|
||||
********************************************
|
||||
* Initialize I/O Pad Driving Strength *
|
||||
********************************************
|
||||
0021B80CC4000003AB
|
||||
********************************************
|
||||
* Initialize SDRAM *
|
||||
********************************************
|
||||
00221000C492120200 ; pre-charge command
|
||||
08200000E4 ; special read
|
||||
|
||||
00221000C4A2120200 ; auto-refresh command
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
08000000E4 ; 8 special read
|
||||
|
||||
00221000C4B2120200 ; set mode register
|
||||
08111800E4 ; special read
|
||||
|
||||
00221000C482124200 ; set normal mode
|
||||
"
|
||||
}
|
||||
|
||||
output_uboot()
|
||||
{
|
||||
echo "\
|
||||
********************************************
|
||||
* U-Boot image as bootstrap records *
|
||||
* will be stored in SDRAM at 0x0A000000 *
|
||||
********************************************
|
||||
"
|
||||
|
||||
cat $INFILE | \
|
||||
hexdump -v -e "\"0A0%05.5_ax10\" 16/1 \"%02x\"\"\r\n\"" | \
|
||||
tr [:lower:] [:upper:]
|
||||
}
|
||||
|
||||
output_flashprog()
|
||||
{
|
||||
echo "\
|
||||
********************************************
|
||||
* Address of arguments to flashProg *
|
||||
* ---------------------------------------- *
|
||||
* Source : 0x0A000000 *
|
||||
* Destination : 0x0C000000 *
"
|
||||
|
||||
# get the real size of the U-Boot image
|
||||
printf "* Size : 0x%08X *\r\n" $FILESIZE
|
||||
printf "********************************************\r\n"
|
||||
printf "0AFE0000CC0A0000000C000000%08X\r\n" $FILESIZE
|
||||
|
||||
#;0AFE0000CC0A0000000C00000000006000
|
||||
|
||||
echo "\
|
||||
********************************************
|
||||
* Flash Program *
|
||||
********************************************
|
||||
0AFE10001008D09FE5AC0000EA00F0A0E1A42DFE0A
|
||||
0AFE1010100080FE0A0DC0A0E100D82DE904B04CE2
|
||||
0AFE1020109820A0E318309FE5003093E5033082E0
|
||||
0AFE103010003093E5013003E2FF3003E20300A0E1
|
||||
0AFE10401000A81BE9A01DFE0A0DC0A0E100D82DE9
|
||||
0AFE10501004B04CE204D04DE20030A0E10D304BE5
|
||||
0AFE1060109820A0E330309FE5003093E5033082E0
|
||||
0AFE107010003093E5013903E2000053E3F7FFFF0A
|
||||
0AFE1080104020A0E310309FE5003093E5032082E0
|
||||
0AFE1090100D305BE5003082E500A81BE9A01DFE0A
|
||||
0AFE10A0100DC0A0E100D82DE904B04CE20000A0E1
|
||||
0AFE10B010D7FFFFEB0030A0E1FF3003E2000053E3
|
||||
0AFE10C010FAFFFF0A10309FE5003093E5003093E5
|
||||
0AFE10D010FF3003E20300A0E100A81BE9A01DFE0A
|
||||
0AFE10E0100DC0A0E100D82DE904B04CE204D04DE2
|
||||
0AFE10F0100030A0E10D304BE50D305BE52332A0E1
|
||||
0AFE1100100E304BE50E305BE5090053E30300009A
|
||||
0AFE1110100E305BE5373083E20E304BE5020000EA
|
||||
0AFE1120100E305BE5303083E20E304BE50E305BE5
|
||||
0AFE1130100300A0E1C3FFFFEB0D305BE50F3003E2
|
||||
0AFE1140100E304BE50E305BE5090053E30300009A
|
||||
0AFE1150100E305BE5373083E20E304BE5020000EA
|
||||
0AFE1160100E305BE5303083E20E304BE50E305BE5
|
||||
0AFE1170100300A0E1B3FFFFEB00A81BE90DC0A0E1
|
||||
0AFE11801000D82DE904B04CE21CD04DE210000BE5
|
||||
0AFE11901014100BE518200BE588009FE5E50200EB
|
||||
0AFE11A01010301BE51C300BE514301BE520300BE5
|
||||
0AFE11B0100030A0E324300BE524201BE518301BE5
|
||||
0AFE11C010030052E10000003A120000EA1C004BE2
|
||||
0AFE11D010002090E520104BE2003091E500C093E5
|
||||
0AFE11E010043083E2003081E5003092E5042082E2
|
||||
0AFE11F010002080E50C0053E10200000A0030A0E3
|
||||
0AFE12001028300BE5050000EA24301BE5043083E2
|
||||
0AFE12101024300BE5E7FFFFEA0130A0E328300BE5
|
||||
0AFE12201028001BE500A81BE9E81EFE0A0DC0A0E1
|
||||
0AFE12301000D82DE904B04CE214D04DE210000BE5
|
||||
0AFE12401014100BE56C009FE5BA0200EB10301BE5
|
||||
0AFE12501018300BE50030A0E31C300BE51C201BE5
|
||||
0AFE12601014301BE5030052E10000003A0D0000EA
|
||||
0AFE12701018304BE2002093E5001092E5042082E2
|
||||
0AFE128010002083E5010071E30200000A0030A0E3
|
||||
0AFE12901020300BE5050000EA1C301BE5043083E2
|
||||
0AFE12A0101C300BE5ECFFFFEA0130A0E320300BE5
|
||||
0AFE12B01020001BE500A81BE9001FFE0A0DC0A0E1
|
||||
0AFE12C01000D82DE904B04CE224D04DE20130A0E3
|
||||
0AFE12D01024300BE5A4229FE58139A0E3023A83E2
|
||||
0AFE12E010003082E59820A0E390329FE5003093E5
|
||||
0AFE12F010033082E0003093E5023903E2000053E3
|
||||
0AFE1300100300001A74229FE58139A0E3033A83E2
|
||||
0AFE131010003082E568029FE5860200EBAF36A0E3
|
||||
0AFE1320100E3883E2003093E510300BE554029FE5
|
||||
0AFE133010800200EB10301BE5233CA0E1FF3003E2
|
||||
0AFE1340100300A0E165FFFFEB10301BE52338A0E1
|
||||
0AFE135010FF3003E20300A0E160FFFFEB10301BE5
|
||||
0AFE1360102334A0E1FF3003E20300A0E15BFFFFEB
|
||||
0AFE13701010305BE50300A0E158FFFFEB0A00A0E3
|
||||
0AFE13801030FFFFEB0D00A0E32EFFFFEBAF36A0E3
|
||||
0AFE1390100E3883E2043083E2003093E514300BE5
|
||||
0AFE13A010E4019FE5630200EB14301BE5233CA0E1
|
||||
0AFE13B010FF3003E20300A0E148FFFFEB14301BE5
|
||||
0AFE13C0102338A0E1FF3003E20300A0E143FFFFEB
|
||||
0AFE13D01014301BE52334A0E1FF3003E20300A0E1
|
||||
0AFE13E0103EFFFFEB14305BE50300A0E13BFFFFEB
|
||||
0AFE13F0100A00A0E313FFFFEB0D00A0E311FFFFEB
|
||||
0AFE140010AF36A0E30E3883E2083083E2003093E5
|
||||
0AFE14101018300BE574019FE5460200EB18301BE5
|
||||
0AFE142010233CA0E1FF3003E20300A0E12BFFFFEB
|
||||
0AFE14301018301BE52338A0E1FF3003E20300A0E1
|
||||
0AFE14401026FFFFEB18301BE52334A0E1FF3003E2
|
||||
0AFE1450100300A0E121FFFFEB18305BE50300A0E1
|
||||
0AFE1460101EFFFFEB0A00A0E3F6FEFFEB0D00A0E3
|
||||
0AFE147010F4FEFFEBE6FEFFEB0030A0E1FF3003E2
|
||||
0AFE148010000053E30000001A020000EA03FFFFEB
|
||||
0AFE1490102D004BE5F6FFFFEAF4009FE5250200EB
|
||||
0AFE14A010FEFEFFEB2D004BE5CD0000EBC00000EB
|
||||
0AFE14B010E0009FE51F0200EB18301BE528300BE5
|
||||
0AFE14C01014301BE52C300BE52C001BE5100100EB
|
||||
0AFE14D01028301BE5013643E228300BE52C301BE5
|
||||
0AFE14E010013683E22C300BE528301BE5000053E3
|
||||
0AFE14F010F4FFFFCAAE0000EB14001BE518101BE5
|
||||
0AFE15001049FFFFEB0030A0E1FF3003E2000053E3
|
||||
0AFE151010E6FFFF0A80009FE5060200EB10001BE5
|
||||
0AFE15201014101BE518201BE5D00000EB10001BE5
|
||||
0AFE15301014101BE518201BE50FFFFFEB0030A0E1
|
||||
0AFE154010FF3003E2000053E30200000A4C009FE5
|
||||
0AFE155010F80100EB010000EA44009FE5F50100EB
|
||||
0AFE156010930000EB3C009FE5F20100EB0000A0E3
|
||||
0AFE157010A4FEFFEB0030A0E30300A0E100A81BE9
|
||||
0AFE158010A01DFE0AA41DFE0AE01DFE0A0C1EFE0A
|
||||
0AFE159010381EFE0A641EFE0A181FFE0A281FFE0A
|
||||
0AFE15A0103C1FFE0A481FFE0AB41EFE0A0DC0A0E1
|
||||
0AFE15B01000D82DE904B04CE204D04DE210000BE5
|
||||
0AFE15C01010301BE5013043E210300BE5010073E3
|
||||
0AFE15D010FAFFFF1A00A81BE90DC0A0E100D82DE9
|
||||
0AFE15E01004B04CE208D04DE210000BE510301BE5
|
||||
0AFE15F01014300BE514301BE50300A0E100A81BE9
|
||||
0AFE1600100DC0A0E100D82DE904B04CE204D04DE2
|
||||
0AFE1610102228A0E3012A82E2042082E2E134A0E3
|
||||
0AFE162010023883E2033C83E2003082E50333A0E3
|
||||
0AFE163010053983E2003093E510300BE500A81BE9
|
||||
0AFE1640100DC0A0E100D82DE904B04CE204D04DE2
|
||||
0AFE1650102228A0E3012A82E2042082E29134A0E3
|
||||
0AFE166010023883E2033C83E2003082E5C136A0E3
|
||||
0AFE167010003093E510300BE52228A0E3012A82E2
|
||||
0AFE168010042082E2E134A0E3023883E2033C83E2
|
||||
0AFE169010003082E50333A0E3073983E20020A0E3
|
||||
0AFE16A010002083E52228A0E3012A82E2042082E2
|
||||
0AFE16B0108134A0E3023883E2033C83E2003082E5
|
||||
0AFE16C0100333A0E3003093E510300BE5CBFFFFEB
|
||||
0AFE16D01010301BE50300A0E100A81BE90DC0A0E1
|
||||
0AFE16E01000D82DE904B04CE208D04DE2D3FFFFEB
|
||||
0AFE16F0100030A0E110300BE510301BE5023503E2
|
||||
0AFE170010000053E30500000A10301BE5073703E2
|
||||
0AFE171010000053E30100000A10001BE5ADFFFFEB
|
||||
0AFE17201010301BE5803003E2000053E30500000A
|
||||
0AFE17301010301BE51C3003E2000053E30100000A
|
||||
0AFE17401010001BE5A3FFFFEB10201BE50235A0E3
|
||||
0AFE175010803083E2030052E10200001A0130A0E3
|
||||
0AFE17601014300BE5010000EA0030A0E314300BE5
|
||||
0AFE17701014001BE500A81BE90DC0A0E100D82DE9
|
||||
0AFE17801004B04CE204D04DE22228A0E3012A82E2
|
||||
0AFE179010042082E29134A0E3023883E2033C83E2
|
||||
0AFE17A010003082E5C136A0E3003093E510300BE5
|
||||
0AFE17B01000A81BE90DC0A0E100D82DE904B04CE2
|
||||
0AFE17C010ECFFFFEB2228A0E3012A82E2042082E2
|
||||
0AFE17D0108134A0E3023883E2033C83E2003082E5
|
||||
0AFE17E01000A81BE90DC0A0E100D82DE904B04CE2
|
||||
0AFE17F01004D04DE22228A0E3012A82E2042082E2
|
||||
0AFE1800102238A0E3013A83E2043083E2003093E5
|
||||
0AFE181010023183E3003082E52228A0E3012A82E2
|
||||
0AFE1820102238A0E3013A83E2003093E5023183E3
|
||||
0AFE183010003082E5FA0FA0E35BFFFFEB2228A0E3
|
||||
0AFE184010012A82E2042082E2B134A0E3023883E2
|
||||
0AFE185010033C83E2003082E50333A0E3233983E2
|
||||
0AFE186010033B83E2003093E510300BE500A81BE9
|
||||
0AFE1870100DC0A0E100D82DE904B04CE21CD04DE2
|
||||
0AFE18801010000BE514100BE518200BE50030A0E3
|
||||
0AFE1890101C300BE51C201BE518301BE5030052E1
|
||||
0AFE18A0100000003A190000EAB2FFFFEB2228A0E3
|
||||
0AFE18B010012A82E2042082E2F134A0E3023883E2
|
||||
0AFE18C010033C83E2003082E514201BE51C301BE5
|
||||
0AFE18D010031082E010201BE51C301BE5033082E0
|
||||
0AFE18E010003093E5003081E57BFFFFEB0030A0E1
|
||||
0AFE18F010FF3003E2000053E3FAFFFF0AACFFFFEB
|
||||
0AFE1900101C301BE5043083E21C300BE5E0FFFFEA
|
||||
0AFE19101000A81BE90DC0A0E100D82DE904B04CE2
|
||||
0AFE1920100CD04DE210000BE52228A0E3012A82E2
|
||||
0AFE193010042082E28134A0E3023883E2033C83E2
|
||||
0AFE194010003082E510301BE5003093E514300BE5
|
||||
0AFE1950102228A0E3012A82E2042082E29134A0E3
|
||||
0AFE196010023883E2033C83E2003082E510301BE5
|
||||
0AFE197010003093E518300BE52228A0E3012A82E2
|
||||
0AFE198010042082E2E134A0E3023883E2033C83E2
|
||||
0AFE199010003082E50229A0E310301BE5032082E0
|
||||
0AFE19A0100030A0E3003082E52228A0E3012A82E2
|
||||
0AFE19B010042082E28134A0E3023883E2033C83E2
|
||||
0AFE19C010003082E510201BE50D3AA0E3D03083E2
|
||||
0AFE19D010033883E1003082E53FFFFFEB0030A0E1
|
||||
0AFE19E010FF3003E2000053E3FAFFFF0A70FFFFEB
|
||||
0AFE19F01000A81BE90DC0A0E100D82DE904B04CE2
|
||||
0AFE1A00105CFFFFEB2228A0E3012A82E2042082E2
|
||||
0AFE1A1010E134A0E3023883E2033C83E2003082E5
|
||||
0AFE1A20100333A0E3033983E20020A0E3002083E5
|
||||
0AFE1A30102228A0E3012A82E2042082E28134A0E3
|
||||
0AFE1A4010023883E2033C83E2003082E50323A0E3
|
||||
0AFE1A5010032982E20339A0E3C03083E2033883E1
|
||||
0AFE1A6010003082E500A81BE90DC0A0E100D82DE9
|
||||
0AFE1A701004B04CE23FFFFFEB2228A0E3012A82E2
|
||||
0AFE1A8010042082E2E134A0E3023883E2033C83E2
|
||||
0AFE1A9010003082E50333A0E30A3983E20020A0E3
|
||||
0AFE1AA010002083E52228A0E3012A82E2042082E2
|
||||
0AFE1AB0108134A0E3023883E2033C83E2003082E5
|
||||
0AFE1AC0100323A0E30A2982E20339A0E3C03083E2
|
||||
0AFE1AD010033883E1003082E500A81BE90DC0A0E1
|
||||
0AFE1AE01000D82DE904B04CE28729A0E3222E82E2
|
||||
0AFE1AF0108739A0E3223E83E2003093E51E3CC3E3
|
||||
0AFE1B0010003082E58729A0E38E2F82E28739A0E3
|
||||
0AFE1B10108E3F83E2003093E51E3CC3E3003082E5
|
||||
0AFE1B20108139A0E3823D83E20520A0E3002083E5
|
||||
0AFE1B30108129A0E3822D82E2042082E20139A0E3
|
||||
0AFE1B4010273083E2003082E58139A0E3823D83E2
|
||||
0AFE1B50100C3083E20120A0E3002083E58129A0E3
|
||||
0AFE1B6010822D82E2102082E22A3DA0E3013083E2
|
||||
0AFE1B7010003082E58139A0E3823D83E2243083E2
|
||||
0AFE1B80100F20A0E3002083E58139A0E3823D83E2
|
||||
0AFE1B9010283083E28A20A0E3002083E58139A0E3
|
||||
0AFE1BA010823D83E22C3083E20820A0E3002083E5
|
||||
0AFE1BB01000A81BE90DC0A0E100D82DE904B04CE2
|
||||
0AFE1BC0108139A0E3823D83E2183083E2003093E5
|
||||
0AFE1BD010013003E2FF3003E20300A0E100A81BE9
|
||||
0AFE1BE0100DC0A0E100D82DE904B04CE204D04DE2
|
||||
0AFE1BF0100030A0E10D304BE58139A0E3823D83E2
|
||||
0AFE1C0010183083E2003093E5013903E2000053E3
|
||||
0AFE1C1010F8FFFF0A8139A0E3813D83E20D205BE5
|
||||
0AFE1C2010002083E50D305BE50A0053E30A00001A
|
||||
0AFE1C30108139A0E3823D83E2183083E2003093E5
|
||||
0AFE1C4010013903E2000053E3F8FFFF0A8139A0E3
|
||||
0AFE1C5010813D83E20D20A0E3002083E500A81BE9
|
||||
0AFE1C60100DC0A0E100D82DE904B04CE20000A0E1
|
||||
0AFE1C7010CFFFFFEB0030A0E1FF3003E2000053E3
|
||||
0AFE1C8010FAFFFF0A8139A0E3023A83E2003093E5
|
||||
0AFE1C9010FF3003E20300A0E100A81BE90DC0A0E1
|
||||
0AFE1CA01000D82DE904B04CE204D04DE20030A0E1
|
||||
0AFE1CB0100D304BE50D305BE52332A0E10E304BE5
|
||||
0AFE1CC0100E305BE5090053E30300009A0E305BE5
|
||||
0AFE1CD010373083E20E304BE5020000EA0E305BE5
|
||||
0AFE1CE010303083E20E304BE50E305BE50300A0E1
|
||||
0AFE1CF010BAFFFFEB0D305BE50F3003E20E304BE5
|
||||
0AFE1D00100E305BE5090053E30300009A0E305BE5
|
||||
0AFE1D1010373083E20E304BE5020000EA0E305BE5
|
||||
0AFE1D2010303083E20E304BE50E305BE50300A0E1
|
||||
0AFE1D3010AAFFFFEB00A81BE90DC0A0E100D82DE9
|
||||
0AFE1D401004B04CE204D04DE210000BE510301BE5
|
||||
0AFE1D50100030D3E5000053E30000001A080000EA
|
||||
0AFE1D601010104BE2003091E50320A0E10020D2E5
|
||||
0AFE1D7010013083E2003081E50200A0E197FFFFEB
|
||||
0AFE1D8008F1FFFFEA00A81BE9
|
||||
0AFE1DA4100A0D4D58314144532053796E632D666C
|
||||
0AFE1DB4106173682050726F6772616D6D696E6720
|
||||
0AFE1DC4105574696C6974792076302E3520323030
|
||||
0AFE1DD410322F30382F32310A0D000000536F7572
|
||||
0AFE1DE41063652061646472657373202873746F72
|
||||
0AFE1DF410656420696E2030783041464530303030
|
||||
0AFE1E0410293A2030780000005461726765742061
|
||||
0AFE1E1410646472657373202873746F7265642069
|
||||
0AFE1E24106E2030783041464530303034293A2030
|
||||
0AFE1E34107800000053697A652020202020202020
|
||||
0AFE1E44102020202873746F72656420696E203078
|
||||
0AFE1E54103041464530303038293A203078000000
|
||||
0AFE1E6410507265737320616E79206B657920746F
|
||||
0AFE1E74102073746172742070726F6772616D6D69
|
||||
0AFE1E84106E67202E2E2E00000A0D45726173696E
|
||||
0AFE1E94106720666C617368202E2E2E000A0D5072
|
||||
0AFE1EA4106F6772616D6D696E67202E2E2E000000
|
||||
0AFE1EB4100A0D50726F6772616D6D696E67206669
|
||||
0AFE1EC4106E69736865642E0A0D50726573732027
|
||||
0AFE1ED410612720746F20636F6E74696E7565202E
|
||||
0AFE1EE4102E2E2E000A0D566572696679696E6720
|
||||
0AFE1EF410666C617368202E2E2E0000000A0D426C
|
||||
0AFE1F0410616E6B20636865636B696E67202E2E2E
|
||||
0AFE1F1410000000000A45726173696E67202E2E2E
|
||||
0AFE1F2410000000000A50726F6772616D6D696E67
|
||||
0AFE1F3410202E2E2E000000002073756363656564
|
||||
0AFE1F44102E0A0000206661696C656420210A0000
|
||||
0AFE100000
|
||||
"
|
||||
}
|
||||
|
||||
#########################################################
|
||||
|
||||
if [ "$#" -eq 2 ] ; then
|
||||
output_init > $2
|
||||
output_uboot >> $2
|
||||
output_flashprog >> $2
|
||||
else
|
||||
output_init;
|
||||
output_uboot;
|
||||
output_flashprog;
|
||||
fi
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
(
|
||||
echo "Usage: $0 [board IP] [board port]"
|
||||
echo ""
|
||||
echo "If IP is not specified, 'localhost' will be used"
|
||||
echo "If port is not specified, '2001' will be used"
|
||||
[ -z "$*" ] && exit 0
|
||||
echo ""
|
||||
echo "ERROR: $*"
|
||||
exit 1
|
||||
) 1>&2
|
||||
exit $?
|
||||
}
|
||||
|
||||
while [ -n "$1" ] ; do
|
||||
case $1 in
|
||||
-h|--help) usage;;
|
||||
--) break;;
|
||||
-*) usage "Invalid option $1";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
ip=${1:-localhost}
|
||||
port=${2:-2001}
|
||||
|
||||
if [ -z "${ip}" ] || [ -n "$3" ] ; then
|
||||
usage "Invalid number of arguments"
|
||||
fi
|
||||
|
||||
trap "stty icanon echo opost intr ^C" 0 2 3 5 10 13 15
|
||||
echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
|
||||
|
||||
stty -icanon -echo -opost intr ^T
|
||||
nc ${ip} ${port}
|
||||
exit 0
|
|
@ -1,59 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
(
|
||||
echo "Usage: $0 <board IP> [board port]"
|
||||
echo ""
|
||||
echo "If port is not specified, '6666' will be used"
|
||||
[ -z "$*" ] && exit 0
|
||||
echo ""
|
||||
echo "ERROR: $*"
|
||||
exit 1
|
||||
) 1>&2
|
||||
exit $?
|
||||
}
|
||||
|
||||
while [ -n "$1" ] ; do
|
||||
case $1 in
|
||||
-h|--help) usage;;
|
||||
--) break;;
|
||||
-*) usage "Invalid option $1";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
ip=$1
|
||||
port=${2:-6666}
|
||||
|
||||
if [ -z "${ip}" ] || [ -n "$3" ] ; then
|
||||
usage "Invalid number of arguments"
|
||||
fi
|
||||
|
||||
for nc in netcat nc ; do
|
||||
type ${nc} >/dev/null 2>&1 && break
|
||||
done
|
||||
|
||||
trap "stty icanon echo intr ^C" 0 2 3 5 10 13 15
|
||||
echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
|
||||
|
||||
stty -icanon -echo intr ^T
|
||||
(
|
||||
if type ncb 2>/dev/null ; then
|
||||
# see if ncb is in $PATH
|
||||
exec ncb ${port}
|
||||
|
||||
elif [ -x ${0%/*}/ncb ] ; then
|
||||
# maybe it's in the same dir as the netconsole script
|
||||
exec ${0%/*}/ncb ${port}
|
||||
|
||||
else
|
||||
# blah, just use regular netcat
|
||||
while ${nc} -u -l -p ${port} < /dev/null ; do
|
||||
:
|
||||
done
|
||||
fi
|
||||
) &
|
||||
pid=$!
|
||||
${nc} -u ${ip} ${port}
|
||||
kill ${pid} 2>/dev/null
|
File diff suppressed because it is too large
Load diff
|
@ -1,153 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2011 The Chromium OS Authors.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
"""See README for more information"""
|
||||
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
# Our modules
|
||||
import checkpatch
|
||||
import command
|
||||
import gitutil
|
||||
import patchstream
|
||||
import terminal
|
||||
import test
|
||||
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
|
||||
default=False, help='Display the README file')
|
||||
parser.add_option('-c', '--count', dest='count', type='int',
|
||||
default=-1, help='Automatically create patches from top n commits')
|
||||
parser.add_option('-i', '--ignore-errors', action='store_true',
|
||||
dest='ignore_errors', default=False,
|
||||
help='Send patches email even if patch errors are found')
|
||||
parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
|
||||
default=False, help="Do a try run (create but don't email patches)")
|
||||
parser.add_option('-s', '--start', dest='start', type='int',
|
||||
default=0, help='Commit to start creating patches from (0 = HEAD)')
|
||||
parser.add_option('-t', '--test', action='store_true', dest='test',
|
||||
default=False, help='run tests')
|
||||
parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
|
||||
default=False, help='Verbose output of errors and warnings')
|
||||
parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
|
||||
default=None, help='Output cc list for patch file (used by git)')
|
||||
parser.add_option('--no-tags', action='store_false', dest='process_tags',
|
||||
default=True, help="Don't process subject tags as aliaes")
|
||||
|
||||
parser.usage = """patman [options]
|
||||
|
||||
Create patches from commits in a branch, check them and email them as
|
||||
specified by tags you place in the commits. Use -n to """
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Run our meagre tests
|
||||
if options.test:
|
||||
import doctest
|
||||
|
||||
sys.argv = [sys.argv[0]]
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(test.TestPatch)
|
||||
result = unittest.TestResult()
|
||||
suite.run(result)
|
||||
|
||||
suite = doctest.DocTestSuite('gitutil')
|
||||
suite.run(result)
|
||||
|
||||
# TODO: Surely we can just 'print' result?
|
||||
print result
|
||||
for test, err in result.errors:
|
||||
print err
|
||||
for test, err in result.failures:
|
||||
print err
|
||||
|
||||
# Called from git with a patch filename as argument
|
||||
# Printout a list of additional CC recipients for this patch
|
||||
elif options.cc_cmd:
|
||||
fd = open(options.cc_cmd, 'r')
|
||||
re_line = re.compile('(\S*) (.*)')
|
||||
for line in fd.readlines():
|
||||
match = re_line.match(line)
|
||||
if match and match.group(1) == args[0]:
|
||||
for cc in match.group(2).split(', '):
|
||||
cc = cc.strip()
|
||||
if cc:
|
||||
print cc
|
||||
fd.close()
|
||||
|
||||
elif options.full_help:
|
||||
pager = os.getenv('PAGER')
|
||||
if not pager:
|
||||
pager = 'more'
|
||||
fname = os.path.join(os.path.dirname(sys.argv[0]), 'README')
|
||||
command.Run(pager, fname)
|
||||
|
||||
# Process commits, produce patches files, check them, email them
|
||||
else:
|
||||
gitutil.Setup()
|
||||
|
||||
if options.count == -1:
|
||||
# Work out how many patches to send if we can
|
||||
options.count = gitutil.CountCommitsToBranch() - options.start
|
||||
|
||||
col = terminal.Color()
|
||||
if not options.count:
|
||||
str = 'No commits found to process - please use -c flag'
|
||||
print col.Color(col.RED, str)
|
||||
sys.exit(1)
|
||||
|
||||
# Read the metadata from the commits
|
||||
if options.count:
|
||||
series = patchstream.GetMetaData(options.start, options.count)
|
||||
cover_fname, args = gitutil.CreatePatches(options.start, options.count,
|
||||
series)
|
||||
|
||||
# Fix up the patch files to our liking, and insert the cover letter
|
||||
series = patchstream.FixPatches(series, args)
|
||||
if series and cover_fname and series.get('cover'):
|
||||
patchstream.InsertCoverLetter(cover_fname, series, options.count)
|
||||
|
||||
# Do a few checks on the series
|
||||
series.DoChecks()
|
||||
|
||||
# Check the patches, and run them through 'git am' just to be sure
|
||||
ok = checkpatch.CheckPatches(options.verbose, args)
|
||||
if not gitutil.ApplyPatches(options.verbose, args,
|
||||
options.count + options.start):
|
||||
ok = False
|
||||
|
||||
# Email the patches out (giving the user time to check / cancel)
|
||||
cmd = ''
|
||||
if ok or options.ignore_errors:
|
||||
cc_file = series.MakeCcFile(options.process_tags)
|
||||
cmd = gitutil.EmailPatches(series, cover_fname, args,
|
||||
options.dry_run, cc_file)
|
||||
os.remove(cc_file)
|
||||
|
||||
# For a dry run, just show our actions as a sanity check
|
||||
if options.dry_run:
|
||||
series.ShowActions(args, cmd, options.process_tags)
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Adapted from Linux kernel's "Kbuild":
|
||||
# commit 1cdf25d704f7951d02a04064c97db547d6021872
|
||||
# Author: Christoph Lameter <clameter@sgi.com>
|
||||
|
||||
mkdir -p $(dirname $2)
|
||||
|
||||
# Default sed regexp - multiline due to syntax constraints
|
||||
SED_CMD="/^->/{s:->#\(.*\):/* \1 */:; \
|
||||
s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 (\2) /* \3 */:; \
|
||||
s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
|
||||
s:->::; p;}"
|
||||
|
||||
(set -e
|
||||
echo "#ifndef __ASM_OFFSETS_H__"
|
||||
echo "#define __ASM_OFFSETS_H__"
|
||||
echo "/*"
|
||||
echo " * DO NOT MODIFY."
|
||||
echo " *"
|
||||
echo " * This file was generated by $(basename $0)"
|
||||
echo " *"
|
||||
echo " */"
|
||||
echo ""
|
||||
sed -ne "${SED_CMD}" $1
|
||||
echo ""
|
||||
echo "#endif" ) > $2
|
|
@ -1,177 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This scripts adds local version information from the version
|
||||
# control systems git, mercurial (hg) and subversion (svn).
|
||||
#
|
||||
# It was originally copied from the Linux kernel v3.2.0-rc4 and modified
|
||||
# to support the U-Boot build-system.
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [--save-scmversion] [srctree]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
scm_only=false
|
||||
srctree=.
|
||||
if test "$1" = "--save-scmversion"; then
|
||||
scm_only=true
|
||||
shift
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
srctree=$1
|
||||
shift
|
||||
fi
|
||||
if test $# -gt 0 -o ! -d "$srctree"; then
|
||||
usage
|
||||
fi
|
||||
|
||||
scm_version()
|
||||
{
|
||||
local short
|
||||
short=false
|
||||
|
||||
cd "$srctree"
|
||||
if test -e .scmversion; then
|
||||
cat .scmversion
|
||||
return
|
||||
fi
|
||||
if test "$1" = "--short"; then
|
||||
short=true
|
||||
fi
|
||||
|
||||
# Check for git and a git repo.
|
||||
if test -e .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
||||
|
||||
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
||||
# it, because this version is defined in the top level Makefile.
|
||||
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
|
||||
|
||||
# If only the short version is requested, don't bother
|
||||
# running further git commands
|
||||
if $short; then
|
||||
echo "+"
|
||||
return
|
||||
fi
|
||||
# If we are past a tagged commit (like
|
||||
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
||||
if atag="`git describe 2>/dev/null`"; then
|
||||
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
||||
|
||||
# If we don't have a tag at all we print -g{commitish}.
|
||||
else
|
||||
printf '%s%s' -g $head
|
||||
fi
|
||||
fi
|
||||
|
||||
# Is this git on svn?
|
||||
if git config --get svn-remote.svn.url >/dev/null; then
|
||||
printf -- '-svn%s' "`git svn find-rev $head`"
|
||||
fi
|
||||
|
||||
# Update index only on r/w media
|
||||
[ -w . ] && git update-index --refresh --unmerged > /dev/null
|
||||
|
||||
# Check for uncommitted changes
|
||||
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
|
||||
| read dummy; then
|
||||
printf '%s' -dirty
|
||||
fi
|
||||
|
||||
# All done with git
|
||||
return
|
||||
fi
|
||||
|
||||
# Check for mercurial and a mercurial repo.
|
||||
if test -d .hg && hgid=`hg id 2>/dev/null`; then
|
||||
# Do we have an tagged version? If so, latesttagdistance == 1
|
||||
if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
|
||||
id=`hg log -r . --template '{latesttag}'`
|
||||
printf '%s%s' -hg "$id"
|
||||
else
|
||||
tag=`printf '%s' "$hgid" | cut -d' ' -f2`
|
||||
if [ -z "$tag" -o "$tag" = tip ]; then
|
||||
id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
|
||||
printf '%s%s' -hg "$id"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Are there uncommitted changes?
|
||||
# These are represented by + after the changeset id.
|
||||
case "$hgid" in
|
||||
*+|*+\ *) printf '%s' -dirty ;;
|
||||
esac
|
||||
|
||||
# All done with mercurial
|
||||
return
|
||||
fi
|
||||
|
||||
# Check for svn and a svn repo.
|
||||
if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
|
||||
rev=`echo $rev | awk '{print $NF}'`
|
||||
printf -- '-svn%s' "$rev"
|
||||
|
||||
# All done with svn
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
collect_files()
|
||||
{
|
||||
local file res
|
||||
|
||||
for file; do
|
||||
case "$file" in
|
||||
*\~*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if test -e "$file"; then
|
||||
res="$res$(cat "$file")"
|
||||
fi
|
||||
done
|
||||
echo "$res"
|
||||
}
|
||||
|
||||
if $scm_only; then
|
||||
if test ! -e .scmversion; then
|
||||
res=$(scm_version)
|
||||
echo "$res" >.scmversion
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
#if test -e include/config/auto.conf; then
|
||||
# . include/config/auto.conf
|
||||
#else
|
||||
# echo "Error: kernelrelease not valid - run 'make prepare' to update it"
|
||||
# exit 1
|
||||
#fi
|
||||
CONFIG_LOCALVERSION=
|
||||
CONFIG_LOCALVERSION_AUTO=y
|
||||
|
||||
# localversion* files in the build and source directory
|
||||
res="$(collect_files localversion*)"
|
||||
if test ! "$srctree" -ef .; then
|
||||
res="$res$(collect_files "$srctree"/localversion*)"
|
||||
fi
|
||||
|
||||
# CONFIG_LOCALVERSION and LOCALVERSION (if set)
|
||||
res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
|
||||
|
||||
# scm version string if not at a tagged commit
|
||||
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
|
||||
# full scm version string
|
||||
res="$res$(scm_version)"
|
||||
else
|
||||
# append a plus sign if the repository is not in a clean
|
||||
# annotated or signed tagged state (as git describe only
|
||||
# looks at signed or annotated tags - git tag -a/-s) and
|
||||
# LOCALVERSION= is not specified
|
||||
if test "${LOCALVERSION+set}" != "set"; then
|
||||
scm=$(scm_version --short)
|
||||
res="$res${scm:++}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$res [${VERSION_CODE:-"local"},${REVISION:-"local"}]"
|
|
@ -1,317 +0,0 @@
|
|||
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4.dts 2022-01-04 02:51:16.000000000 +0800
|
||||
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4.dts 2022-01-04 03:10:34.000000000 +0800
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/ {
|
||||
compatible = "raspberrypi,4-compute-module", "brcm,bcm2711";
|
||||
- model = "Raspberry Pi Compute Module 4";
|
||||
+ model = "openmptcprouter_5G_CM4";
|
||||
|
||||
chosen {
|
||||
/* 8250 auxiliary UART instead of pl011 */
|
||||
@@ -91,19 +91,12 @@
|
||||
gpio-line-names = "BT_ON",
|
||||
"WL_ON",
|
||||
"PWR_LED_OFF",
|
||||
- "ANT1",
|
||||
"VDD_SD_IO_SEL",
|
||||
"CAM_GPIO",
|
||||
"SD_PWR_ON",
|
||||
"ANT2";
|
||||
status = "okay";
|
||||
|
||||
- ant1: ant1 {
|
||||
- gpio-hog;
|
||||
- gpios = <3 GPIO_ACTIVE_HIGH>;
|
||||
- output-high;
|
||||
- };
|
||||
-
|
||||
ant2: ant2 {
|
||||
gpio-hog;
|
||||
gpios = <7 GPIO_ACTIVE_HIGH>;
|
||||
@@ -138,23 +131,10 @@
|
||||
"SPI_MISO",
|
||||
"SPI_MOSI",
|
||||
"SPI_SCLK",
|
||||
- "GPIO12",
|
||||
- "GPIO13",
|
||||
/* Serial port */
|
||||
"TXD1",
|
||||
"RXD1",
|
||||
- "GPIO16",
|
||||
- "GPIO17",
|
||||
- "GPIO18",
|
||||
- "GPIO19",
|
||||
- "GPIO20",
|
||||
- "GPIO21",
|
||||
- "GPIO22",
|
||||
- "GPIO23",
|
||||
- "GPIO24",
|
||||
"GPIO25",
|
||||
- "GPIO26",
|
||||
- "GPIO27",
|
||||
"RGMII_MDIO",
|
||||
"RGMIO_MDC",
|
||||
/* Used by BT module */
|
||||
@@ -368,14 +348,9 @@
|
||||
mmc2 = &sdhost;
|
||||
i2c3 = &i2c3;
|
||||
i2c4 = &i2c4;
|
||||
- i2c5 = &i2c5;
|
||||
- i2c6 = &i2c6;
|
||||
i2c20 = &ddc0;
|
||||
i2c21 = &ddc1;
|
||||
- spi3 = &spi3;
|
||||
spi4 = &spi4;
|
||||
- spi5 = &spi5;
|
||||
- spi6 = &spi6;
|
||||
/delete-property/ intc;
|
||||
};
|
||||
|
||||
@@ -398,49 +373,7 @@
|
||||
pinctrl-0 = <&uart1_pins>;
|
||||
};
|
||||
|
||||
-&spi0 {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
|
||||
- cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
|
||||
-
|
||||
- spidev0: spidev@0{
|
||||
- compatible = "spidev";
|
||||
- reg = <0>; /* CE0 */
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
- spi-max-frequency = <125000000>;
|
||||
- };
|
||||
-
|
||||
- spidev1: spidev@1{
|
||||
- compatible = "spidev";
|
||||
- reg = <1>; /* CE1 */
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
- spi-max-frequency = <125000000>;
|
||||
- };
|
||||
-};
|
||||
-
|
||||
&gpio {
|
||||
- spi0_pins: spi0_pins {
|
||||
- brcm,pins = <9 10 11>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT0>;
|
||||
- };
|
||||
-
|
||||
- spi0_cs_pins: spi0_cs_pins {
|
||||
- brcm,pins = <8 7>;
|
||||
- brcm,function = <BCM2835_FSEL_GPIO_OUT>;
|
||||
- };
|
||||
-
|
||||
- spi3_pins: spi3_pins {
|
||||
- brcm,pins = <1 2 3>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT3>;
|
||||
- };
|
||||
-
|
||||
- spi3_cs_pins: spi3_cs_pins {
|
||||
- brcm,pins = <0 24>;
|
||||
- brcm,function = <BCM2835_FSEL_GPIO_OUT>;
|
||||
- };
|
||||
-
|
||||
spi4_pins: spi4_pins {
|
||||
brcm,pins = <5 6 7>;
|
||||
brcm,function = <BCM2835_FSEL_ALT3>;
|
||||
@@ -451,38 +384,12 @@
|
||||
brcm,function = <BCM2835_FSEL_GPIO_OUT>;
|
||||
};
|
||||
|
||||
- spi5_pins: spi5_pins {
|
||||
- brcm,pins = <13 14 15>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT3>;
|
||||
- };
|
||||
-
|
||||
- spi5_cs_pins: spi5_cs_pins {
|
||||
- brcm,pins = <12 26>;
|
||||
- brcm,function = <BCM2835_FSEL_GPIO_OUT>;
|
||||
- };
|
||||
-
|
||||
- spi6_pins: spi6_pins {
|
||||
- brcm,pins = <19 20 21>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT3>;
|
||||
- };
|
||||
-
|
||||
- spi6_cs_pins: spi6_cs_pins {
|
||||
- brcm,pins = <18 27>;
|
||||
- brcm,function = <BCM2835_FSEL_GPIO_OUT>;
|
||||
- };
|
||||
-
|
||||
i2c0_pins: i2c0 {
|
||||
brcm,pins = <0 1>;
|
||||
brcm,function = <BCM2835_FSEL_ALT0>;
|
||||
brcm,pull = <BCM2835_PUD_UP>;
|
||||
};
|
||||
|
||||
- i2c1_pins: i2c1 {
|
||||
- brcm,pins = <2 3>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT0>;
|
||||
- brcm,pull = <BCM2835_PUD_UP>;
|
||||
- };
|
||||
-
|
||||
i2c3_pins: i2c3 {
|
||||
brcm,pins = <4 5>;
|
||||
brcm,function = <BCM2835_FSEL_ALT5>;
|
||||
@@ -495,23 +402,6 @@
|
||||
brcm,pull = <BCM2835_PUD_UP>;
|
||||
};
|
||||
|
||||
- i2c5_pins: i2c5 {
|
||||
- brcm,pins = <12 13>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT5>;
|
||||
- brcm,pull = <BCM2835_PUD_UP>;
|
||||
- };
|
||||
-
|
||||
- i2c6_pins: i2c6 {
|
||||
- brcm,pins = <22 23>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT5>;
|
||||
- brcm,pull = <BCM2835_PUD_UP>;
|
||||
- };
|
||||
-
|
||||
- i2s_pins: i2s {
|
||||
- brcm,pins = <18 19 20 21>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT0>;
|
||||
- };
|
||||
-
|
||||
sdio_pins: sdio_pins {
|
||||
brcm,pins = <34 35 36 37 38 39>;
|
||||
brcm,function = <BCM2835_FSEL_ALT3>; // alt3 = SD1
|
||||
@@ -554,29 +444,12 @@
|
||||
brcm,function = <BCM2835_FSEL_ALT4>;
|
||||
brcm,pull = <0 2>;
|
||||
};
|
||||
-
|
||||
- uart5_pins: uart5_pins {
|
||||
- brcm,pins = <12 13>;
|
||||
- brcm,function = <BCM2835_FSEL_ALT4>;
|
||||
- brcm,pull = <0 2>;
|
||||
- };
|
||||
};
|
||||
|
||||
&i2c0if {
|
||||
clock-frequency = <100000>;
|
||||
};
|
||||
|
||||
-&i2c1 {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&i2c1_pins>;
|
||||
- clock-frequency = <100000>;
|
||||
-};
|
||||
-
|
||||
-&i2s {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&i2s_pins>;
|
||||
-};
|
||||
-
|
||||
// =============================================
|
||||
// Board specific stuff here
|
||||
|
||||
@@ -611,6 +484,81 @@
|
||||
linux,default-trigger = "default-on";
|
||||
gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
+
|
||||
+ wlan2g {
|
||||
+ label = "wlan2g";
|
||||
+ gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ wlan5g {
|
||||
+ label = "wlan5g";
|
||||
+ gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ wan {
|
||||
+ label = "wan";
|
||||
+ gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g1 {
|
||||
+ label = "5g1";
|
||||
+ gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g2 {
|
||||
+ label = "5g2";
|
||||
+ gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g3 {
|
||||
+ label = "5g3";
|
||||
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g4 {
|
||||
+ label = "5g4";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g5 {
|
||||
+ label = "5g5";
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5g6 {
|
||||
+ label = "5g6";
|
||||
+ gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr1 {
|
||||
+ label = "5gpwr1";
|
||||
+ gpios = <&gpio 26 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr2 {
|
||||
+ label = "5gpwr2";
|
||||
+ gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr3 {
|
||||
+ label = "5gpwr3";
|
||||
+ gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr4 {
|
||||
+ label = "5gpwr4";
|
||||
+ gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr5 {
|
||||
+ label = "5gpwr5";
|
||||
+ gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ 5gpwr6 {
|
||||
+ label = "5gpwr6";
|
||||
+ gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
@@ -640,21 +588,6 @@
|
||||
eth_led0 = <&phy1>,"led-modes:0";
|
||||
eth_led1 = <&phy1>,"led-modes:4";
|
||||
|
||||
- ant1 = <&ant1>,"output-high?=on",
|
||||
- <&ant1>, "output-low?=off",
|
||||
- <&ant2>, "output-high?=off",
|
||||
- <&ant2>, "output-low?=on";
|
||||
- ant2 = <&ant1>,"output-high?=off",
|
||||
- <&ant1>, "output-low?=on",
|
||||
- <&ant2>, "output-high?=on",
|
||||
- <&ant2>, "output-low?=off";
|
||||
- noant = <&ant1>,"output-high?=off",
|
||||
- <&ant1>, "output-low?=on",
|
||||
- <&ant2>, "output-high?=off",
|
||||
- <&ant2>, "output-low?=on";
|
||||
-
|
||||
sd_poll_once = <&emmc2>, "non-removable?";
|
||||
- spi_dma4 = <&spi0>, "dmas:0=", <&dma40>,
|
||||
- <&spi0>, "dmas:8=", <&dma40>;
|
||||
};
|
||||
};
|
|
@ -1,344 +0,0 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sun, 26 Jul 2020 14:03:21 +0200
|
||||
Subject: [PATCH] net: add support for threaded NAPI polling
|
||||
|
||||
For some drivers (especially 802.11 drivers), doing a lot of work in the NAPI
|
||||
poll function does not perform well. Since NAPI poll is bound to the CPU it
|
||||
was scheduled from, we can easily end up with a few very busy CPUs spending
|
||||
most of their time in softirq/ksoftirqd and some idle ones.
|
||||
|
||||
Introduce threaded NAPI for such drivers based on a workqueue. The API is the
|
||||
same except for using netif_threaded_napi_add instead of netif_napi_add.
|
||||
|
||||
In my tests with mt76 on MT7621 using threaded NAPI + a thread for tx scheduling
|
||||
improves LAN->WLAN bridging throughput by 10-50%. Throughput without threaded
|
||||
NAPI is wildly inconsistent, depending on the CPU that runs the tx scheduling
|
||||
thread.
|
||||
|
||||
With threaded NAPI it seems stable and consistent (and higher than the best
|
||||
results I got without it).
|
||||
|
||||
Based on a patch by Hillf Danton
|
||||
|
||||
Cc: Hillf Danton <hdanton@sina.com>
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -340,6 +340,7 @@ struct napi_struct {
|
||||
struct list_head dev_list;
|
||||
struct hlist_node napi_hash_node;
|
||||
unsigned int napi_id;
|
||||
+ struct work_struct work;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -350,6 +351,7 @@ enum {
|
||||
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
|
||||
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
|
||||
NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
|
||||
+ NAPI_STATE_THREADED, /* Use threaded NAPI */
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -360,6 +362,7 @@ enum {
|
||||
NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
|
||||
NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
|
||||
NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
|
||||
+ NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED),
|
||||
};
|
||||
|
||||
enum gro_result {
|
||||
@@ -2101,6 +2104,7 @@ struct net_device {
|
||||
struct lock_class_key addr_list_lock_key;
|
||||
bool proto_down;
|
||||
unsigned wol_enabled:1;
|
||||
+ unsigned threaded:1;
|
||||
};
|
||||
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
||||
|
||||
@@ -2281,6 +2285,26 @@ void netif_napi_add(struct net_device *d
|
||||
int (*poll)(struct napi_struct *, int), int weight);
|
||||
|
||||
/**
|
||||
+ * netif_threaded_napi_add - initialize a NAPI context
|
||||
+ * @dev: network device
|
||||
+ * @napi: NAPI context
|
||||
+ * @poll: polling function
|
||||
+ * @weight: default weight
|
||||
+ *
|
||||
+ * This variant of netif_napi_add() should be used from drivers using NAPI
|
||||
+ * with CPU intensive poll functions.
|
||||
+ * This will schedule polling from a high priority workqueue
|
||||
+ */
|
||||
+static inline void netif_threaded_napi_add(struct net_device *dev,
|
||||
+ struct napi_struct *napi,
|
||||
+ int (*poll)(struct napi_struct *, int),
|
||||
+ int weight)
|
||||
+{
|
||||
+ set_bit(NAPI_STATE_THREADED, &napi->state);
|
||||
+ netif_napi_add(dev, napi, poll, weight);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* netif_tx_napi_add - initialize a NAPI context
|
||||
* @dev: network device
|
||||
* @napi: NAPI context
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -156,6 +156,7 @@ static DEFINE_SPINLOCK(offload_lock);
|
||||
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
|
||||
struct list_head ptype_all __read_mostly; /* Taps */
|
||||
static struct list_head offload_base __read_mostly;
|
||||
+static struct workqueue_struct *napi_workq __read_mostly;
|
||||
|
||||
static int netif_rx_internal(struct sk_buff *skb);
|
||||
static int call_netdevice_notifiers_info(unsigned long val,
|
||||
@@ -5931,6 +5932,11 @@ void __napi_schedule(struct napi_struct
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
+ if (test_bit(NAPI_STATE_THREADED, &n->state)) {
|
||||
+ queue_work(napi_workq, &n->work);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
local_irq_save(flags);
|
||||
____napi_schedule(this_cpu_ptr(&softnet_data), n);
|
||||
local_irq_restore(flags);
|
||||
@@ -6246,9 +6256,89 @@ static void init_gro_hash(struct napi_st
|
||||
napi->gro_bitmask = 0;
|
||||
}
|
||||
|
||||
+static int __napi_poll(struct napi_struct *n, bool *repoll)
|
||||
+{
|
||||
+ int work, weight;
|
||||
+
|
||||
+ weight = n->weight;
|
||||
+
|
||||
+ /* This NAPI_STATE_SCHED test is for avoiding a race
|
||||
+ * with netpoll's poll_napi(). Only the entity which
|
||||
+ * obtains the lock and sees NAPI_STATE_SCHED set will
|
||||
+ * actually make the ->poll() call. Therefore we avoid
|
||||
+ * accidentally calling ->poll() when NAPI is not scheduled.
|
||||
+ */
|
||||
+ work = 0;
|
||||
+ if (test_bit(NAPI_STATE_SCHED, &n->state)) {
|
||||
+ work = n->poll(n, weight);
|
||||
+ trace_napi_poll(n, work, weight);
|
||||
+ }
|
||||
+
|
||||
+ WARN_ON_ONCE(work > weight);
|
||||
+
|
||||
+ if (likely(work < weight))
|
||||
+ return work;
|
||||
+
|
||||
+ /* Drivers must not modify the NAPI state if they
|
||||
+ * consume the entire weight. In such cases this code
|
||||
+ * still "owns" the NAPI instance and therefore can
|
||||
+ * move the instance around on the list at-will.
|
||||
+ */
|
||||
+ if (unlikely(napi_disable_pending(n))) {
|
||||
+ napi_complete(n);
|
||||
+ return work;
|
||||
+ }
|
||||
+
|
||||
+ if (n->gro_bitmask) {
|
||||
+ /* flush too old packets
|
||||
+ * If HZ < 1000, flush all packets.
|
||||
+ */
|
||||
+ napi_gro_flush(n, HZ >= 1000);
|
||||
+ }
|
||||
+
|
||||
+ gro_normal_list(n);
|
||||
+
|
||||
+ *repoll = true;
|
||||
+
|
||||
+ return work;
|
||||
+}
|
||||
+
|
||||
+static void napi_workfn(struct work_struct *work)
|
||||
+{
|
||||
+ struct napi_struct *n = container_of(work, struct napi_struct, work);
|
||||
+ void *have;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ bool repoll = false;
|
||||
+
|
||||
+ local_bh_disable();
|
||||
+
|
||||
+ have = netpoll_poll_lock(n);
|
||||
+ __napi_poll(n, &repoll);
|
||||
+ netpoll_poll_unlock(have);
|
||||
+
|
||||
+ local_bh_enable();
|
||||
+
|
||||
+ if (!repoll)
|
||||
+ return;
|
||||
+
|
||||
+ if (!need_resched())
|
||||
+ continue;
|
||||
+
|
||||
+ /*
|
||||
+ * have to pay for the latency of task switch even if
|
||||
+ * napi is scheduled
|
||||
+ */
|
||||
+ queue_work(napi_workq, work);
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
|
||||
int (*poll)(struct napi_struct *, int), int weight)
|
||||
{
|
||||
+ if (dev->threaded)
|
||||
+ set_bit(NAPI_STATE_THREADED, &napi->state);
|
||||
INIT_LIST_HEAD(&napi->poll_list);
|
||||
hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
|
||||
napi->timer.function = napi_watchdog;
|
||||
@@ -6265,6 +6355,7 @@ void netif_napi_add(struct net_device *d
|
||||
#ifdef CONFIG_NETPOLL
|
||||
napi->poll_owner = -1;
|
||||
#endif
|
||||
+ INIT_WORK(&napi->work, napi_workfn);
|
||||
set_bit(NAPI_STATE_SCHED, &napi->state);
|
||||
set_bit(NAPI_STATE_NPSVC, &napi->state);
|
||||
list_add_rcu(&napi->dev_list, &dev->napi_list);
|
||||
@@ -6305,6 +6396,7 @@ static void flush_gro_hash(struct napi_s
|
||||
void netif_napi_del(struct napi_struct *napi)
|
||||
{
|
||||
might_sleep();
|
||||
+ cancel_work_sync(&napi->work);
|
||||
if (napi_hash_del(napi))
|
||||
synchronize_net();
|
||||
list_del_init(&napi->dev_list);
|
||||
@@ -6317,50 +6409,18 @@ EXPORT_SYMBOL(netif_napi_del);
|
||||
|
||||
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
|
||||
{
|
||||
+ bool do_repoll = false;
|
||||
void *have;
|
||||
- int work, weight;
|
||||
+ int work;
|
||||
|
||||
list_del_init(&n->poll_list);
|
||||
|
||||
have = netpoll_poll_lock(n);
|
||||
|
||||
- weight = n->weight;
|
||||
-
|
||||
- /* This NAPI_STATE_SCHED test is for avoiding a race
|
||||
- * with netpoll's poll_napi(). Only the entity which
|
||||
- * obtains the lock and sees NAPI_STATE_SCHED set will
|
||||
- * actually make the ->poll() call. Therefore we avoid
|
||||
- * accidentally calling ->poll() when NAPI is not scheduled.
|
||||
- */
|
||||
- work = 0;
|
||||
- if (test_bit(NAPI_STATE_SCHED, &n->state)) {
|
||||
- work = n->poll(n, weight);
|
||||
- trace_napi_poll(n, work, weight);
|
||||
- }
|
||||
-
|
||||
- WARN_ON_ONCE(work > weight);
|
||||
+ work = __napi_poll(n, &do_repoll);
|
||||
|
||||
- if (likely(work < weight))
|
||||
- goto out_unlock;
|
||||
-
|
||||
- /* Drivers must not modify the NAPI state if they
|
||||
- * consume the entire weight. In such cases this code
|
||||
- * still "owns" the NAPI instance and therefore can
|
||||
- * move the instance around on the list at-will.
|
||||
- */
|
||||
- if (unlikely(napi_disable_pending(n))) {
|
||||
- napi_complete(n);
|
||||
+ if (!do_repoll)
|
||||
goto out_unlock;
|
||||
- }
|
||||
-
|
||||
- if (n->gro_bitmask) {
|
||||
- /* flush too old packets
|
||||
- * If HZ < 1000, flush all packets.
|
||||
- */
|
||||
- napi_gro_flush(n, HZ >= 1000);
|
||||
- }
|
||||
-
|
||||
- gro_normal_list(n);
|
||||
|
||||
/* Some drivers may have called napi_schedule
|
||||
* prior to exhausting their budget.
|
||||
@@ -10340,6 +10400,10 @@ static int __init net_dev_init(void)
|
||||
sd->backlog.weight = weight_p;
|
||||
}
|
||||
|
||||
+ napi_workq = alloc_workqueue("napi_workq", WQ_UNBOUND | WQ_HIGHPRI,
|
||||
+ WQ_UNBOUND_MAX_ACTIVE | WQ_SYSFS);
|
||||
+ BUG_ON(!napi_workq);
|
||||
+
|
||||
dev_boot_phase = 0;
|
||||
|
||||
/* The loopback device is special if any other network devices
|
||||
--- a/net/core/net-sysfs.c
|
||||
+++ b/net/core/net-sysfs.c
|
||||
@@ -442,6 +442,52 @@ static ssize_t proto_down_store(struct d
|
||||
}
|
||||
NETDEVICE_SHOW_RW(proto_down, fmt_dec);
|
||||
|
||||
+static int change_napi_threaded(struct net_device *dev, unsigned long val)
|
||||
+{
|
||||
+ struct napi_struct *napi;
|
||||
+
|
||||
+ if (list_empty(&dev->napi_list))
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ list_for_each_entry(napi, &dev->napi_list, dev_list) {
|
||||
+ if (val)
|
||||
+ set_bit(NAPI_STATE_THREADED, &napi->state);
|
||||
+ else
|
||||
+ clear_bit(NAPI_STATE_THREADED, &napi->state);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static ssize_t napi_threaded_store(struct device *dev,
|
||||
+ struct device_attribute *attr,
|
||||
+ const char *buf, size_t len)
|
||||
+{
|
||||
+ return netdev_store(dev, attr, buf, len, change_napi_threaded);
|
||||
+}
|
||||
+
|
||||
+static ssize_t napi_threaded_show(struct device *dev,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct net_device *netdev = to_net_dev(dev);
|
||||
+ struct napi_struct *napi;
|
||||
+ bool enabled = false;
|
||||
+
|
||||
+ if (!rtnl_trylock())
|
||||
+ return restart_syscall();
|
||||
+
|
||||
+ list_for_each_entry(napi, &netdev->napi_list, dev_list) {
|
||||
+ if (test_bit(NAPI_STATE_THREADED, &napi->state))
|
||||
+ enabled = true;
|
||||
+ }
|
||||
+
|
||||
+ rtnl_unlock();
|
||||
+
|
||||
+ return sprintf(buf, fmt_dec, enabled);
|
||||
+}
|
||||
+static DEVICE_ATTR_RW(napi_threaded);
|
||||
+
|
||||
static ssize_t phys_port_id_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
@@ -532,6 +578,7 @@ static struct attribute *net_class_attrs
|
||||
&dev_attr_flags.attr,
|
||||
&dev_attr_tx_queue_len.attr,
|
||||
&dev_attr_gro_flush_timeout.attr,
|
||||
+ &dev_attr_napi_threaded.attr,
|
||||
&dev_attr_phys_port_id.attr,
|
||||
&dev_attr_phys_port_name.attr,
|
||||
&dev_attr_phys_switch_id.attr,
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
CFG=$1
|
||||
|
||||
[ -n "$CFG" ] || CFG=/etc/board.json
|
||||
|
||||
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
|
||||
for a in $(ls /etc/board.d/*); do
|
||||
[ -x $a ] || continue;
|
||||
$(. $a)
|
||||
done
|
||||
}
|
||||
|
||||
[ -s "$CFG" ] || return 1
|
|
@ -1,307 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
# Copyright (c) 2011-2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
CFG=/etc/board.json
|
||||
|
||||
# do not run on preinit/early init
|
||||
[ "$EARLY_INIT" ] && return
|
||||
|
||||
strstr() {
|
||||
[ "${1#*$2*}" = "$1" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
print_array() {
|
||||
json_add_array $1
|
||||
case "$1" in
|
||||
4G)
|
||||
for element in $2
|
||||
do
|
||||
json_add_string "" "$(echo $element)"
|
||||
done
|
||||
;;
|
||||
3G)
|
||||
for element in $2
|
||||
do
|
||||
json_add_string "" "wcdma_$(echo $element)"
|
||||
done
|
||||
;;
|
||||
2G)
|
||||
for element in $2
|
||||
do
|
||||
json_add_string "" "$(echo $element)"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
json_close_array
|
||||
}
|
||||
|
||||
gather_band_capabilities() {
|
||||
# Same logic as unhandler.c
|
||||
###################### EG06 #########################
|
||||
if strstr $revision_from_unhandler "EG06E"; then #EG06E
|
||||
lte_bands="1 3 5 7 8 20 28 32 38 40 41" #B
|
||||
trysg_bands="850 900 1800 2100" #MHz
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EG06A"; then #EG06A
|
||||
lte_bands="2 4 5 7 12 13 25 26 29 30 66"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
###################### EC25 #########################
|
||||
elif strstr $revision_from_unhandler "EC25EF"; then #EC25E
|
||||
lte_bands="1 3 5 7 8 20 38 40 41"
|
||||
trysg_bands="850 900 2100"
|
||||
dug_bands="900 1800" #MHz
|
||||
elif strstr $revision_from_unhandler "EC25EC"; then #EC25EC
|
||||
lte_bands="1 3 7 8 20 28"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC25AUX"; then #EC25AUX
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="850 900 1700 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "EC25AFA"; then #EC25A
|
||||
lte_bands="2 4 12"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25V"; then #EC25V
|
||||
lte_bands="4 13"
|
||||
trysg_bands=""
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25AFX"; then #EC25AFX
|
||||
lte_bands="2 4 5 12 13 14 66 71"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25AFF"; then #EC25AF
|
||||
lte_bands="2 4 5 12 13 14 66 71"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25AUTF"; then #EC25AUT
|
||||
lte_bands="1 3 5 7 28"
|
||||
trysg_bands="850 2100"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25AUTL"; then #EC25AUTL
|
||||
lte_bands="3 7 28"
|
||||
trysg_bands=""
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25AUF"; then #EC25AU
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="850 900 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "EC25J"; then #EC25J
|
||||
lte_bands="1 3 8 18 19 26 41"
|
||||
trysg_bands="800 900 2100"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC25EUX"; then #EC25EUX
|
||||
lte_bands="1 3 7 8 20 28 38 40 41"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC25EUF"; then #EC25EU
|
||||
lte_bands="1 3 7 8 20 28 38 40 41"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC25EUG"; then #EC25EU
|
||||
lte_bands="1 3 7 8 20 28 38 40 41"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC25MX"; then #EC25MX
|
||||
lte_bands="2 4 5 7 28 66"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
###################### EC21 #########################
|
||||
elif strstr $revision_from_unhandler "EC21EUX"; then #EC21EUX
|
||||
lte_bands="1 3 7 8 20 28"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC21EU"; then #EC21EU
|
||||
lte_bands="1 3 7 8 20 28"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC21EC"; then #EC21EC
|
||||
lte_bands="1 3 7 8 20 28"
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC21E"; then #EC21E
|
||||
lte_bands="1 3 5 7 8 20"
|
||||
trysg_bands="850 900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "EC21V"; then #EC21V
|
||||
lte_bands="4 13"
|
||||
trysg_bands=""
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC21KL"; then #EC21KL
|
||||
lte_bands="1 3 5 7 8"
|
||||
trysg_bands=""
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC21J"; then #EC21J
|
||||
lte_bands="1 3 8 18 19 26"
|
||||
trysg_bands=""
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC21AUX"; then #EC21AUX
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="850 900 1700 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "EC21AUT"; then #EC21AUT
|
||||
lte_bands="1 3 5 7 28"
|
||||
trysg_bands="850 2100"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EC21AU"; then #EC21AU
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="850 900 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "EC21A"; then #EC21A
|
||||
lte_bands="2 4 12"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
###################### EG25 #########################
|
||||
elif strstr $revision_from_unhandler "EG25G"; then #EG25G
|
||||
lte_bands="1 2 3 4 5 7 8 12 13 18 19 20 25 26 28 38 39 40 41"
|
||||
trysg_bands="800 850 900 1700 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "EG12EA"; then #EG12EA
|
||||
lte_bands="1 3 5 7 8 20 28 38 40 41"
|
||||
trysg_bands="850 900 1800 2100"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "EG12NA"; then #EG12NA
|
||||
lte_bands="2 4 5 7 12 13 14 17 25 26 29 30 41 66 71"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "BG96"; then #BG96M
|
||||
lte_bands="1 2 3 4 5 8 12 13 18 19 20 26 28 39"
|
||||
trysg_bands=""
|
||||
dug_bands="850 900 1800 1900"
|
||||
##################### SLM750 ########################
|
||||
elif strstr $revision_from_unhandler "750VE"; then #SLM750VE
|
||||
lte_bands="1 3 5 7 8 20 40"
|
||||
trysg_bands="850 900 2100"
|
||||
dug_bands="900 1800"
|
||||
elif strstr $revision_from_unhandler "750VAU"; then #SLM750VAU
|
||||
lte_bands="1 3 5 7 8 28 40"
|
||||
trysg_bands="850 900 2100"
|
||||
dug_bands="850 900 1800"
|
||||
elif strstr $revision_from_unhandler "750VA"; then #SLM750VA
|
||||
lte_bands="2 4 5 12 13 17 18 25 26 41"
|
||||
trysg_bands="850 1700 1900"
|
||||
dug_bands="850 1900"
|
||||
elif strstr $revision_from_unhandler "750VJ"; then #SLM750VJ
|
||||
lte_bands="1 3 8 18 19 26 41"
|
||||
trysg_bands="800 900 2100"
|
||||
dug_bands=""
|
||||
elif strstr $revision_from_unhandler "750VSA"; then #SLM750VSA
|
||||
lte_bands="2 4 5 7 8 28 40"
|
||||
trysg_bands="850 900 1900"
|
||||
dug_bands="850 900 1900"
|
||||
###################### UC20 #########################
|
||||
elif strstr $revision_from_unhandler "UC20E"; then #UC20E
|
||||
lte_bands=""
|
||||
trysg_bands="900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "UC20G"; then #UC20G
|
||||
lte_bands=""
|
||||
trysg_bands="800 850 900 1900 2100"
|
||||
dug_bands="850 900 1800 1900"
|
||||
elif strstr $revision_from_unhandler "UC20A"; then #UC20A
|
||||
lte_bands=""
|
||||
trysg_bands="850 1900"
|
||||
dug_bands=""
|
||||
else
|
||||
lte_bands="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28"
|
||||
trysg_bands="700 800 850 900 1500 1700 2600"
|
||||
dug_bands="1700 1800 1900 2100"
|
||||
fi
|
||||
}
|
||||
|
||||
validate_service_modes() {
|
||||
json_get_keys service_modes service_modes
|
||||
|
||||
found_modes="$(printf "$service_modes" | awk '!seen[$0]++'| wc -l)"
|
||||
[ "$found_modes" -eq 0 ] && {
|
||||
return 0
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#~ Get model name for RUTX products
|
||||
setup_modem() {
|
||||
local key="$1"
|
||||
local object_num="$2"
|
||||
local id gps boudrate type desc control product vendor stop_bits
|
||||
|
||||
json_select "$object_num"
|
||||
json_get_vars id product
|
||||
|
||||
if [ "$id" = "$id_from_unhandler" ]; then
|
||||
|
||||
[ -z "$product" ] || \
|
||||
{
|
||||
[ -f "/sys/bus/usb/devices/$id/idVendor" ] && [ -f "/sys/bus/usb/devices/$id/idProduct" ] || {
|
||||
json_select ..
|
||||
return 1
|
||||
}
|
||||
|
||||
validate_service_modes && {
|
||||
gather_band_capabilities
|
||||
json_select_object service_modes
|
||||
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
|
||||
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
|
||||
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands"
|
||||
json_select ..
|
||||
}
|
||||
json_select ..
|
||||
return 1
|
||||
}
|
||||
|
||||
vendor="$(cat "/sys/bus/usb/devices/$id/idVendor")"
|
||||
product="$(cat "/sys/bus/usb/devices/$id/idProduct")"
|
||||
|
||||
[ -f "/lib/network/wwan/$vendor:$product" ] && {
|
||||
devicename="$id"
|
||||
|
||||
gather_band_capabilities
|
||||
|
||||
json_set_namespace defaults old_cb
|
||||
json_load "$(cat /lib/network/wwan/$vendor:$product)"
|
||||
json_get_vars gps boudrate type desc control stop_bits
|
||||
json_set_namespace "$old_cb"
|
||||
|
||||
[ "${devicename%%:*}" = "$devicename" ] && {
|
||||
json_add_string vendor "$vendor"
|
||||
json_add_string product "$product"
|
||||
json_add_string gps "$gps"
|
||||
json_add_string stop_bits "$stop_bits"
|
||||
json_add_string boudrate "$boudrate"
|
||||
json_add_string type "$type"
|
||||
json_add_string desc "$desc"
|
||||
json_add_string control "$control"
|
||||
json_add_object service_modes
|
||||
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
|
||||
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
|
||||
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands"
|
||||
json_close_object
|
||||
}
|
||||
}
|
||||
fi
|
||||
json_select ..
|
||||
}
|
||||
|
||||
[ -s "${CFG}" ] || exit 1
|
||||
|
||||
id_from_unhandler="$1"
|
||||
revision_from_unhandler="$2"
|
||||
|
||||
lock /var/run/board_modem.lock
|
||||
|
||||
board_config_update
|
||||
json_for_each_item setup_modem modems
|
||||
board_config_flush
|
||||
|
||||
lock -u /var/run/board_modem.lock
|
||||
|
||||
exit 0
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
CFG=/etc/board.json
|
||||
SLP=30
|
||||
|
||||
check_modem() {
|
||||
json_select "$2"
|
||||
json_get_vars id
|
||||
|
||||
[ -z "$id" ] && {
|
||||
json_select ..
|
||||
return 0
|
||||
}
|
||||
|
||||
#logger -t "board-track" "ls -d /sys/bus/usb/devices/$id/${id}*/tty?*"
|
||||
ttys=$(ls -d /sys/bus/usb/devices/$id/${id}*/tty?*)
|
||||
|
||||
[ -n "$ttys" ] || { #FAILED TO FIND MODEM
|
||||
logger -t "board-track" "modem $id not detected"
|
||||
for m in /sys/class/gpio/modem*_power; do
|
||||
label="$(basename $m | awk -F_ '{print $1}')"
|
||||
mctl -s -m ${label}
|
||||
sleep 1
|
||||
mctl -p -m ${label}
|
||||
done
|
||||
sleep 5
|
||||
ip link set up dev wwan0 2>&1 >/dev/null
|
||||
ip link set up dev wwan1 2>&1 >/dev/null
|
||||
json_select ..
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$(ip link show dev wwan0 | grep DOWN)" ] && ip link set up dev wwan0 2>&1 >/dev/null
|
||||
[ -n "$(ip link show dev wwan1 | grep DOWN)" ] && ip link set up dev wwan1 2>&1 >/dev/null
|
||||
|
||||
#MODEM UP
|
||||
json_select ..
|
||||
}
|
||||
|
||||
board_config_update
|
||||
while true; do
|
||||
json_for_each_item check_modem modems
|
||||
sleep $SLP
|
||||
[ $SLP -lt 300 ] && SLP=$((SLP+30))
|
||||
done
|
|
@ -1,665 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
CFG=/etc/board.json
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
[ -s $CFG ] || /bin/board_detect || exit 1
|
||||
|
||||
[ -s /etc/config/network ] && \
|
||||
[ -s /etc/config/system ] && \
|
||||
[ -s /etc/config/hwinfo ] && \
|
||||
[ -s /etc/config/blesem ] && \
|
||||
exit 0
|
||||
|
||||
generate_static_network() {
|
||||
uci -q batch <<-EOF
|
||||
delete network.loopback
|
||||
set network.loopback='interface'
|
||||
set network.loopback.ifname='lo'
|
||||
set network.loopback.proto='static'
|
||||
set network.loopback.ipaddr='127.0.0.1'
|
||||
set network.loopback.netmask='255.0.0.0'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
|
||||
if json_is_a dsl object; then
|
||||
json_select dsl
|
||||
if json_is_a atmbridge object; then
|
||||
json_select atmbridge
|
||||
local vpi vci encaps payload nameprefix
|
||||
json_get_vars vpi vci encaps payload nameprefix
|
||||
uci -q batch <<-EOF
|
||||
delete network.atm
|
||||
set network.atm='atm-bridge'
|
||||
set network.atm.vpi='$vpi'
|
||||
set network.atm.vci='$vci'
|
||||
set network.atm.encaps='$encaps'
|
||||
set network.atm.payload='$payload'
|
||||
set network.atm.nameprefix='$nameprefix'
|
||||
EOF
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
if json_is_a modem object; then
|
||||
json_select modem
|
||||
local type annex firmware tone xfer_mode
|
||||
json_get_vars type annex firmware tone xfer_mode
|
||||
uci -q batch <<-EOF
|
||||
delete network.dsl
|
||||
set network.dsl='dsl'
|
||||
set network.dsl.annex='$annex'
|
||||
set network.dsl.firmware='$firmware'
|
||||
set network.dsl.tone='$tone'
|
||||
set network.dsl.xfer_mode='$xfer_mode'
|
||||
EOF
|
||||
json_select ..
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
||||
}
|
||||
|
||||
addr_offset=2
|
||||
generate_network() {
|
||||
local keys var val ifname macaddr proto type ipaddr netmask
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete "network.$1"
|
||||
set network.$1='interface'
|
||||
EOF
|
||||
|
||||
json_select network
|
||||
json_select "$1"
|
||||
json_get_keys keys
|
||||
for var in $keys; do
|
||||
json_get_var val "$var"
|
||||
[ "${var#_*}" = "$var" ] && {
|
||||
eval "$var=\"\$val\""
|
||||
uci -q set "network.$1.$var=$val"
|
||||
}
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
#~ [ -n "$ifname" ] || return
|
||||
|
||||
# force bridge for multi-interface devices (and lan)
|
||||
case "$1:$ifname" in
|
||||
*\ * | lan:*)
|
||||
type="bridge"
|
||||
uci -q set "network.$1.type=$type"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$macaddr" ]; then
|
||||
for name in $ifname; do
|
||||
uci -q batch <<-EOF
|
||||
delete network.$1_${name/./_}_dev
|
||||
set network.$1_${name/./_}_dev='device'
|
||||
set network.$1_${name/./_}_dev.name='$name'
|
||||
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
|
||||
case "$proto" in
|
||||
static)
|
||||
local ipad
|
||||
case "$1" in
|
||||
lan)
|
||||
ipad=${ipaddr:-"192.168.100.1"}
|
||||
;;
|
||||
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
|
||||
esac
|
||||
|
||||
netm=${netmask:-"255.255.255.0"}
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set network.$1.proto='static'
|
||||
set network.$1.ipaddr='$ipad'
|
||||
set network.$1.netmask='$netm'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
|
||||
;;
|
||||
|
||||
dhcp)
|
||||
# fixup IPv6 slave interface if parent is a bridge
|
||||
[ "$type" = "bridge" ] && ifname="br-$1"
|
||||
|
||||
uci set network.$1.proto='dhcp'
|
||||
uci set network.$1.metric='1'
|
||||
|
||||
#[ -e /proc/sys/net/ipv6 ] && {
|
||||
# uci -q batch <<-EOF
|
||||
# delete network.${1}6
|
||||
# set network.${1}6='interface'
|
||||
# set network.${1}6.device='$ifname'
|
||||
# set network.${1}6.proto='dhcpv6'
|
||||
# set network.${1}6.metric='1'
|
||||
# EOF
|
||||
#}
|
||||
;;
|
||||
|
||||
pppoe)
|
||||
uci -q batch <<-EOF
|
||||
set network.$1.proto='pppoe'
|
||||
set network.$1.username='username'
|
||||
set network.$1.password='password'
|
||||
EOF
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
set network.$1.ipv6='1'
|
||||
delete network.${1}6
|
||||
set network.${1}6='interface'
|
||||
set network.${1}6.ifname='@${1}'
|
||||
set network.${1}6.proto='dhcpv6'
|
||||
EOF
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
add_modem_section() {
|
||||
local id="$1"
|
||||
local num="$2"
|
||||
local simcount="$3"
|
||||
local builtin="$4"
|
||||
|
||||
for count in $(seq "$simcount"); do
|
||||
interface="mob${num}s${count}a1"
|
||||
local proto="wwan"
|
||||
|
||||
# just like this for now
|
||||
# probably we should merge connm with wwan
|
||||
[ -e /dev/smd9 ] && {
|
||||
proto="connm"
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete network.$interface
|
||||
set network.$interface='interface'
|
||||
set network.$interface.proto='$proto'
|
||||
set network.$interface.modem='$id'
|
||||
set network.$interface.metric='$((num+1))'
|
||||
set network.$interface.sim='${count}'
|
||||
set network.$interface.pdp='1'
|
||||
EOF
|
||||
|
||||
# just like this for now
|
||||
# probably we should merge connm with wwan
|
||||
[ -e /dev/smd9 ] && {
|
||||
uci set network.$interface.ifname='rmnet0'
|
||||
}
|
||||
|
||||
update_firewall_zone "wan" "$interface"
|
||||
create_multiwan_iface "$interface" "$num"
|
||||
add_simcard_config "$id" "${count}" "${count}" "$builtin"
|
||||
add_sim_switch_config "$id" "${count}"
|
||||
add_quota_limit_config "$interface"
|
||||
done
|
||||
add_sms_storage_config "$id"
|
||||
}
|
||||
|
||||
generate_dynamic_lte() {
|
||||
[ -f /lib/functions/modem.sh ] || return
|
||||
. /lib/functions/modem.sh
|
||||
|
||||
local interface num id simcount builtin
|
||||
|
||||
#creating simcard sections from board.json file
|
||||
if json_is_a modems array; then
|
||||
json_get_keys modems modems
|
||||
json_select modems
|
||||
|
||||
num=1
|
||||
|
||||
for modem in $modems; do
|
||||
json_select "$modem"
|
||||
json_get_vars id simcount builtin
|
||||
json_select ..
|
||||
add_modem_section "$id" "$num" "$simcount" "$builtin"
|
||||
num=$(( num + 1 ))
|
||||
done
|
||||
|
||||
json_select ..
|
||||
else
|
||||
## because of RUTX8 have no default modem
|
||||
# after this script runs out simcard config
|
||||
# must not be empty due to external modems could appear to config
|
||||
echo " " >> /etc/config/simcard
|
||||
fi
|
||||
|
||||
#creating simcard sections from conneted via USB
|
||||
for a in `ls /sys/bus/usb/devices`; do
|
||||
local vendor product
|
||||
[ -f "/sys/bus/usb/devices/$a/idVendor" ] && [ -f "/sys/bus/usb/devices/$a/idProduct" ] || continue
|
||||
vendor=$(cat "/sys/bus/usb/devices/$a/idVendor")
|
||||
product=$(cat "/sys/bus/usb/devices/$a/idProduct")
|
||||
[ -f "/lib/network/wwan/${vendor}:${product}" ] && {
|
||||
add_simcard_config "$a" "1" "0" ""
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
generate_switch_vlans_ports() {
|
||||
local switch="$1"
|
||||
local port ports role roles num attr val
|
||||
|
||||
#
|
||||
# autogenerate vlans
|
||||
#
|
||||
|
||||
if json_is_a roles array; then
|
||||
json_get_keys roles roles
|
||||
json_select roles
|
||||
|
||||
for role in $roles; do
|
||||
json_select "$role"
|
||||
json_get_vars ports
|
||||
json_select ..
|
||||
|
||||
uci -q batch <<-EOF
|
||||
add network switch_vlan
|
||||
set network.@switch_vlan[-1].device='$switch'
|
||||
set network.@switch_vlan[-1].vlan='$role'
|
||||
set network.@switch_vlan[-1].ports='$ports'
|
||||
EOF
|
||||
done
|
||||
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# write port specific settings
|
||||
#
|
||||
|
||||
if json_is_a ports array; then
|
||||
json_get_keys ports ports
|
||||
json_select ports
|
||||
|
||||
for port in $ports; do
|
||||
json_select "$port"
|
||||
json_get_vars num
|
||||
|
||||
if json_is_a attr object; then
|
||||
json_get_keys attr attr
|
||||
json_select attr
|
||||
uci -q batch <<-EOF
|
||||
add network switch_port
|
||||
set network.@switch_port[-1].device='$switch'
|
||||
set network.@switch_port[-1].port=$num
|
||||
EOF
|
||||
|
||||
for attr in $attr; do
|
||||
json_get_var val "$attr"
|
||||
uci -q set network.@switch_port[-1].$attr="$val"
|
||||
done
|
||||
json_select ..
|
||||
fi
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_select ..
|
||||
fi
|
||||
}
|
||||
|
||||
generate_switch() {
|
||||
local key="$1"
|
||||
local vlans
|
||||
|
||||
json_select switch
|
||||
json_select "$key"
|
||||
json_get_vars enable reset blinkrate cpu_port \
|
||||
ar8xxx_mib_type ar8xxx_mib_poll_interval
|
||||
|
||||
uci -q batch <<-EOF
|
||||
add network switch
|
||||
set network.@switch[-1].name='$key'
|
||||
set network.@switch[-1].reset='$reset'
|
||||
set network.@switch[-1].enable_vlan='$enable'
|
||||
set network.@switch[-1].blinkrate='$blinkrate'
|
||||
set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type'
|
||||
set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval'
|
||||
EOF
|
||||
|
||||
generate_switch_vlans_ports "$1"
|
||||
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
|
||||
generate_static_system() {
|
||||
param=$(/sbin/mnf_info "--name")
|
||||
hostname=${param:0:6}
|
||||
uci -q batch <<-EOF
|
||||
delete system.@system[0]
|
||||
set system.system='system'
|
||||
set system.@system[-1].hostname='OpenMPTCProuter'
|
||||
set system.@system[-1].timezone='UTC'
|
||||
set system.@system[-1].ttylogin='0'
|
||||
set system.@system[-1].log_size='128'
|
||||
set system.@system[-1].urandom_seed='0'
|
||||
|
||||
delete system.ntp
|
||||
set system.ntp='timeserver'
|
||||
set system.ntp.enabled='0'
|
||||
set system.ntp.enable_server='0'
|
||||
add_list system.ntp.server='0.pool.ntp.org'
|
||||
add_list system.ntp.server='1.pool.ntp.org'
|
||||
add_list system.ntp.server='2.pool.ntp.org'
|
||||
add_list system.ntp.server='3.pool.ntp.org'
|
||||
|
||||
delete system.debug
|
||||
set system.debug='debug'
|
||||
set system.debug.sms_utils_debug_level='4'
|
||||
EOF
|
||||
|
||||
if json_is_a system object; then
|
||||
json_select system
|
||||
local hostname
|
||||
#if json_get_var hostname hostname; then
|
||||
# uci -q set "system.@system[-1].hostname=$hostname"
|
||||
#fi
|
||||
|
||||
if json_is_a ntpserver array; then
|
||||
local keys key
|
||||
json_get_keys keys ntpserver
|
||||
json_select ntpserver
|
||||
uci -q delete "system.ntp.server"
|
||||
|
||||
for key in $keys; do
|
||||
local server
|
||||
if json_get_var server "$key"; then
|
||||
uci -q add_list "system.ntp.server=$server"
|
||||
fi
|
||||
done
|
||||
json_select ..
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
||||
}
|
||||
|
||||
generate_rssimon() {
|
||||
local key="$1"
|
||||
local cfg="rssid_$key"
|
||||
local refresh threshold
|
||||
|
||||
json_select rssimon
|
||||
json_select "$key"
|
||||
json_get_vars refresh threshold
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete system.$cfg
|
||||
set system.$cfg='rssid'
|
||||
set system.$cfg.dev='$key'
|
||||
set system.$cfg.refresh='$refresh'
|
||||
set system.$cfg.threshold='$threshold'
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_led() {
|
||||
local key="$1"
|
||||
local cfg="led_$key"
|
||||
|
||||
json_select led
|
||||
json_select "$key"
|
||||
json_get_vars name sysfs type trigger default
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete system.$cfg
|
||||
set system.$cfg='led'
|
||||
set system.$cfg.name='$name'
|
||||
set system.$cfg.sysfs='$sysfs'
|
||||
set system.$cfg.trigger='$trigger'
|
||||
set system.$cfg.default='$default'
|
||||
EOF
|
||||
|
||||
case "$type" in
|
||||
gpio)
|
||||
local gpio inverted
|
||||
json_get_vars gpio inverted
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.trigger='gpio'
|
||||
set system.$cfg.gpio='$gpio'
|
||||
set system.$cfg.inverted='$inverted'
|
||||
EOF
|
||||
;;
|
||||
|
||||
netdev)
|
||||
local device mode
|
||||
json_get_vars device mode
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.trigger='netdev'
|
||||
set system.$cfg.mode='$mode'
|
||||
set system.$cfg.dev='$device'
|
||||
EOF
|
||||
;;
|
||||
|
||||
usb)
|
||||
local device
|
||||
json_get_vars device
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.trigger='usbdev'
|
||||
set system.$cfg.interval='50'
|
||||
set system.$cfg.dev='$device'
|
||||
EOF
|
||||
;;
|
||||
|
||||
usbport)
|
||||
local ports port
|
||||
json_get_values ports ports
|
||||
uci set system.$cfg.trigger='usbport'
|
||||
for port in $ports; do
|
||||
uci add_list system.$cfg.port=$port
|
||||
done
|
||||
;;
|
||||
|
||||
rssi)
|
||||
local iface minq maxq offset factor
|
||||
json_get_vars iface minq maxq offset factor
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.trigger='rssi'
|
||||
set system.$cfg.iface='rssid_$iface'
|
||||
set system.$cfg.minq='$minq'
|
||||
set system.$cfg.maxq='$maxq'
|
||||
set system.$cfg.offset='$offset'
|
||||
set system.$cfg.factor='$factor'
|
||||
EOF
|
||||
;;
|
||||
|
||||
switch)
|
||||
local port_mask speed_mask mode
|
||||
json_get_vars port_mask speed_mask mode
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.port_mask='$port_mask'
|
||||
set system.$cfg.speed_mask='$speed_mask'
|
||||
set system.$cfg.mode='$mode'
|
||||
EOF
|
||||
;;
|
||||
|
||||
portstate)
|
||||
local port_state
|
||||
json_get_vars port_state
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.port_state='$port_state'
|
||||
EOF
|
||||
;;
|
||||
|
||||
timer|oneshot)
|
||||
local delayon delayoff
|
||||
json_get_vars delayon delayoff
|
||||
uci -q batch <<-EOF
|
||||
set system.$cfg.trigger='$type'
|
||||
set system.$cfg.delayon='$delayon'
|
||||
set system.$cfg.delayoff='$delayoff'
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
generate_gpioswitch() {
|
||||
local cfg="$1"
|
||||
|
||||
json_select gpioswitch
|
||||
json_select "$cfg"
|
||||
local name pin default
|
||||
json_get_vars name pin default
|
||||
uci -q batch <<-EOF
|
||||
delete system.$cfg
|
||||
set system.$cfg='gpio_switch'
|
||||
set system.$cfg.name='$name'
|
||||
set system.$cfg.gpio_pin='$pin'
|
||||
set system.$cfg.value='$default'
|
||||
EOF
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
generate_hwinfo() {
|
||||
local parameter="$1"
|
||||
local temp
|
||||
|
||||
json_select hwinfo
|
||||
json_get_var temp "$parameter"
|
||||
json_select ..
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set hwinfo.hwinfo='hwinfo'
|
||||
set hwinfo.hwinfo.$parameter='$temp'
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_bluetooth() {
|
||||
uci -q batch <<-EOF
|
||||
set blesem.general='section'
|
||||
set blesem.general.enabled='0'
|
||||
set blesem.settings='app'
|
||||
set blesem.settings.refresh_time='30000'
|
||||
EOF
|
||||
}
|
||||
|
||||
add_firewall_zone() {
|
||||
local ifname
|
||||
|
||||
json_select network
|
||||
json_select "$1"
|
||||
json_get_vars ifname
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
fw3 -q network "$1" || fw3 -q device "$ifname" && return
|
||||
|
||||
uci -q batch <<-EOF
|
||||
add firewall zone
|
||||
set firewall.@zone[-1].name='$1'
|
||||
set firewall.@zone[-1].network='$1'
|
||||
set firewall.@zone[-1].input='REJECT'
|
||||
set firewall.@zone[-1].output='ACCEPT'
|
||||
set firewall.@zone[-1].forward='REJECT'
|
||||
|
||||
add firewall forwarding
|
||||
set firewall.@forwarding[-1].src='$1'
|
||||
set firewall.@forwarding[-1].dest='wan'
|
||||
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].name='Allow-DNS-$1'
|
||||
set firewall.@rule[-1].src='$1'
|
||||
set firewall.@rule[-1].dest_port='53'
|
||||
set firewall.@rule[-1].proto='tcp udp'
|
||||
set firewall.@rule[-1].target='ACCEPT'
|
||||
|
||||
add firewall rule
|
||||
set firewall.@rule[-1].name='Allow-DHCP-$1'
|
||||
set firewall.@rule[-1].src='$1'
|
||||
set firewall.@rule[-1].dest_port='67'
|
||||
set firewall.@rule[-1].proto='udp'
|
||||
set firewall.@rule[-1].family='ipv4'
|
||||
set firewall.@rule[-1].target='ACCEPT'
|
||||
EOF
|
||||
}
|
||||
|
||||
add_dhcp() {
|
||||
|
||||
json_select network
|
||||
json_select "$1"
|
||||
json_get_vars _dhcp
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
[ "$_dhcp" = "1" ] || return
|
||||
uci -q batch <<-EOF
|
||||
set dhcp.$1='dhcp'
|
||||
set dhcp.$1.interface='$1'
|
||||
set dhcp.$1.start='100'
|
||||
set dhcp.$1.limit='150'
|
||||
set dhcp.$1.leasetime='1h'
|
||||
EOF
|
||||
}
|
||||
|
||||
json_init
|
||||
json_load "$(cat ${CFG})"
|
||||
|
||||
umask 077
|
||||
|
||||
if [ ! -s /etc/config/network ]; then
|
||||
touch /etc/config/network
|
||||
generate_static_network
|
||||
|
||||
json_get_keys keys network
|
||||
for key in $keys; do
|
||||
generate_network $key
|
||||
add_firewall_zone "$key"
|
||||
add_dhcp "$key"
|
||||
done
|
||||
|
||||
json_get_keys keys switch
|
||||
for key in $keys; do generate_switch $key; done
|
||||
|
||||
generate_dynamic_lte
|
||||
fi
|
||||
|
||||
if [ ! -s /etc/config/system ]; then
|
||||
touch /etc/config/system
|
||||
generate_static_system
|
||||
|
||||
json_get_keys keys rssimon
|
||||
for key in $keys; do generate_rssimon $key; done
|
||||
|
||||
json_get_keys keys gpioswitch
|
||||
for key in $keys; do generate_gpioswitch $key; done
|
||||
|
||||
json_get_keys keys led
|
||||
for key in $keys; do generate_led $key; done
|
||||
fi
|
||||
|
||||
if [ ! -s /etc/config/hwinfo ]; then
|
||||
touch /etc/config/hwinfo
|
||||
json_get_keys keys hwinfo
|
||||
for key in $keys; do generate_hwinfo $key; done
|
||||
fi
|
||||
|
||||
if [ ! -s /etc/config/blesem ]; then
|
||||
bluetooth=""
|
||||
json_select hwinfo
|
||||
json_get_vars bluetooth
|
||||
[ "$bluetooth" -eq 1 ] && {
|
||||
touch /etc/config/blesem
|
||||
touch /etc/config/ble_devices
|
||||
generate_bluetooth
|
||||
}
|
||||
fi
|
||||
|
||||
uci commit
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
awk -f - $* <<EOF
|
||||
function bitcount(c) {
|
||||
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
|
||||
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
|
||||
c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
|
||||
c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
|
||||
c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
|
||||
return c
|
||||
}
|
||||
|
||||
function ip2int(ip) {
|
||||
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
|
||||
return ret
|
||||
}
|
||||
|
||||
function int2ip(ip,ret,x) {
|
||||
ret=and(ip,255)
|
||||
ip=rshift(ip,8)
|
||||
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
|
||||
return ret
|
||||
}
|
||||
|
||||
function compl32(v) {
|
||||
ret=xor(v, 0xffffffff)
|
||||
return ret
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
slpos=index(ARGV[1],"/")
|
||||
if (slpos == 0) {
|
||||
ipaddr=ip2int(ARGV[1])
|
||||
dotpos=index(ARGV[2],".")
|
||||
if (dotpos == 0)
|
||||
netmask=compl32(2**(32-int(ARGV[2]))-1)
|
||||
else
|
||||
netmask=ip2int(ARGV[2])
|
||||
} else {
|
||||
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
|
||||
netmask=compl32(2**(32-int(substr(ARGV[1],slpos+1)))-1)
|
||||
ARGV[4]=ARGV[3]
|
||||
ARGV[3]=ARGV[2]
|
||||
}
|
||||
|
||||
network=and(ipaddr,netmask)
|
||||
broadcast=or(network,compl32(netmask))
|
||||
|
||||
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
|
||||
limit=network+1
|
||||
if (start<limit) start=limit
|
||||
|
||||
end=start+ARGV[4]
|
||||
limit=or(network,compl32(netmask))-1
|
||||
if (end>limit) end=limit
|
||||
|
||||
print "IP="int2ip(ipaddr)
|
||||
print "NETMASK="int2ip(netmask)
|
||||
print "BROADCAST="int2ip(broadcast)
|
||||
print "NETWORK="int2ip(network)
|
||||
print "PREFIX="32-bitcount(compl32(netmask))
|
||||
|
||||
# range calculations:
|
||||
# ipcalc <ip> <netmask> <start> <num>
|
||||
|
||||
if (ARGC > 3) {
|
||||
print "START="int2ip(start)
|
||||
print "END="int2ip(end)
|
||||
}
|
||||
}
|
||||
EOF
|
|
@ -1,207 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2015 The Linux Foundation. All rights reserved.
|
||||
# Copyright (c) 2011-2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/teltonika-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
setup_json() {
|
||||
local model="$1"
|
||||
|
||||
case "$model" in
|
||||
RUTX08*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
|
||||
ucidef_set_hwinfo usb ethernet ios
|
||||
;;
|
||||
RUTX09*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
|
||||
ucidef_add_static_modem_info "$model" "3-1" "2" "gps_out"
|
||||
ucidef_set_hwinfo dual_sim usb gps mobile ethernet ios
|
||||
;;
|
||||
RUTX10*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
|
||||
ucidef_set_hwinfo bluetooth usb wifi dual_band_ssid ethernet ios
|
||||
;;
|
||||
RUTX11*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
|
||||
ucidef_add_static_modem_info "$model" "3-1" "2" "gps_out"
|
||||
ucidef_set_hwinfo dual_sim usb gps mobile wifi dual_band_ssid bluetooth ethernet ios
|
||||
;;
|
||||
RUTXR1*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
ucidef_add_static_modem_info "$model" "3-1" "2"
|
||||
ucidef_set_hwinfo dual_sim usb mobile wifi dual_band_ssid ethernet sfp_port
|
||||
ucidef_set_release_version "2.3.1"
|
||||
;;
|
||||
RUTX12*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
# builtin and primary should be first modem
|
||||
ucidef_add_static_modem_info "$model" "3-1" "1" "primary" "gps_out"
|
||||
ucidef_add_static_modem_info "$model" "1-1.2" "1"
|
||||
ucidef_set_hwinfo usb gps mobile wifi dual_band_ssid bluetooth ethernet ios
|
||||
ucidef_set_release_version "2.3.1"
|
||||
;;
|
||||
RUTX14*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
ucidef_add_static_modem_info "$model" "1-1" "2" "gps_out"
|
||||
ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios at_sim
|
||||
ucidef_set_release_version "2.6.1"
|
||||
;;
|
||||
RUTX18*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
|
||||
ucidef_add_static_modem_info "$model" "2-1" "2" "gps_out"
|
||||
ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios
|
||||
;;
|
||||
TRB2*)
|
||||
ucidef_set_led_switch "lan" "LAN" "eth_led" "switch0" "0x04"
|
||||
ucidef_set_interface_lan "eth0"
|
||||
ucidef_add_static_modem_info "$model" "1-1.4" "2" "gps_out"
|
||||
ucidef_add_serial_capabilities "rs232 rs485" \
|
||||
"300 600 1200 2400 4800 9600 14400 19200 38400 56000 57600 115200 \
|
||||
230400 460800 921600 1000000 3000000" \
|
||||
"7 8"
|
||||
ucidef_set_hwinfo dual_sim mobile gps ethernet ios
|
||||
;;
|
||||
RUT200* |\
|
||||
RUT241*)
|
||||
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x2"
|
||||
ucidef_set_led_switch "wan" "WAN" "eth2_led" "switch0" "0x1"
|
||||
ucidef_add_switch "switch0" "1:lan" "0:wan" "6@eth0"
|
||||
ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
|
||||
ucidef_set_interface_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)"
|
||||
ucidef_add_static_modem_info "$model" "1-1" "1"
|
||||
[ "${model:7:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \
|
||||
ethernet || ucidef_set_hwinfo mobile wifi ethernet ios
|
||||
;;
|
||||
RUT2*)
|
||||
ucidef_set_led_switch "lan" "LAN" "lan_led" "switch0" "0x04"
|
||||
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_static_modem_info "$model" "1-1" "1"
|
||||
[ "${model:6:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \
|
||||
ethernet || ucidef_set_hwinfo mobile wifi ethernet ios
|
||||
;;
|
||||
RUT300*)
|
||||
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x02"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan4" "LAN4" "eth4_led" "switch0" "0x04"
|
||||
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
|
||||
ucidef_set_hwinfo usb ethernet ios
|
||||
;;
|
||||
RUT360*)
|
||||
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10"
|
||||
ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1"
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_static_modem_info "$model" "1-1" "1"
|
||||
ucidef_set_hwinfo mobile wifi dual_band_ssid ethernet ios
|
||||
;;
|
||||
RUT950*)
|
||||
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
|
||||
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
ucidef_add_static_modem_info "$model" "1-1" "2"
|
||||
[ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim mobile \
|
||||
wifi ethernet || ucidef_set_hwinfo dual_sim mobile wifi ethernet ios
|
||||
;;
|
||||
RUT955*)
|
||||
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
|
||||
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
ucidef_add_static_modem_info "$model" "1-1.4" "2" "gps_out"
|
||||
[ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim usb gps \
|
||||
mobile wifi ethernet || ucidef_set_hwinfo dual_sim usb gps \
|
||||
mobile wifi ethernet ios
|
||||
ucidef_add_serial_capabilities "rs232" \
|
||||
"200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 \
|
||||
230400 460800 500000 576000" \
|
||||
"5 6 7 8"
|
||||
ucidef_add_serial_capabilities "rs485" \
|
||||
"300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400 \
|
||||
460800 500000 576000 921600 1000000 1152000 1500000 2000000 \
|
||||
2500000 3000000" \
|
||||
"8"
|
||||
;;
|
||||
TRB140*)
|
||||
ucidef_set_interface_lan "eth0 rndis0"
|
||||
ucidef_add_trb14x_lte_modem "$model"
|
||||
ucidef_add_nand_info "$model"
|
||||
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile ethernet || \
|
||||
ucidef_set_hwinfo mobile ethernet ios
|
||||
;;
|
||||
TRB141*)
|
||||
ucidef_set_interface_lan "rndis0"
|
||||
ucidef_add_trb14x_lte_modem "$model"
|
||||
ucidef_add_nand_info "$model"
|
||||
ucidef_set_hwinfo mobile ios
|
||||
;;
|
||||
TRB142* |\
|
||||
TRB145*)
|
||||
ucidef_set_interface_lan "rndis0"
|
||||
ucidef_add_trb14x_lte_modem "$model"
|
||||
ucidef_add_nand_info "$model"
|
||||
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile || \
|
||||
ucidef_set_hwinfo mobile ios
|
||||
[ "${model:5:1}" = "2" ] && local rs="rs232"
|
||||
ucidef_add_serial_capabilities "${rs:-rs485}" \
|
||||
"300 600 1200 2400 4800 9600 19200 38400 57600 115200 460800" \
|
||||
"5 6 7 8"
|
||||
[ "${model:5:2}" = "23" -o "${model:5:2}" = "52" ] && \
|
||||
ucidef_set_release_version "7.1"
|
||||
;;
|
||||
TCR100*)
|
||||
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10"
|
||||
ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1"
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_set_interface guest proto static type bridge \
|
||||
guest 1 _wireless true _dhcp true
|
||||
ucidef_add_static_modem_info "$model" "1-1" "1"
|
||||
ucidef_set_hwinfo mobile wifi dual_band_ssid wps ethernet
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported hardware. Network interfaces not intialized"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#~ Get model name for RUTX products
|
||||
model="$(mnf_info --name)" 2>/dev/null
|
||||
|
||||
platform="$(cat /proc/device-tree/platform)" 2>/dev/null
|
||||
|
||||
board_config_update
|
||||
setup_json "$model"
|
||||
|
||||
ucidef_set_board_platform "$platform"
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
|
@ -1,70 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
|
||||
START=10
|
||||
STOP=90
|
||||
|
||||
uci_apply_defaults() {
|
||||
. /lib/functions/system.sh
|
||||
|
||||
cd /etc/uci-defaults || return 0
|
||||
files="$(find . -type f | sort)"
|
||||
[ -z "$files" ] && return 0
|
||||
mkdir -p /tmp/.uci
|
||||
for file in $files; do
|
||||
( . "./$file" ) && rm -f "$file"
|
||||
done
|
||||
uci commit
|
||||
}
|
||||
|
||||
boot() {
|
||||
[ -f /proc/mounts ] || /sbin/mount_root
|
||||
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
|
||||
|
||||
mkdir -p /var/run
|
||||
mkdir -p /var/log
|
||||
mkdir -p /var/lock
|
||||
mkdir -p /var/state
|
||||
mkdir -p /var/tmp
|
||||
mkdir -p /tmp/.uci
|
||||
chmod 0700 /tmp/.uci
|
||||
touch /var/log/wtmp
|
||||
touch /var/log/lastlog
|
||||
mkdir -p /tmp/resolv.conf.d
|
||||
touch /tmp/resolv.conf.d/resolv.conf.auto
|
||||
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
|
||||
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
||||
grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
|
||||
grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore
|
||||
|
||||
# mount all entries in fstab
|
||||
/bin/mount -a &
|
||||
|
||||
# /log directory might be created on preinit
|
||||
# symlink /storage to /log on TRB14X devices
|
||||
[ -d /storage -a ! -h /log ] && {
|
||||
rm -rf /log
|
||||
ln -sf /storage /log
|
||||
}
|
||||
|
||||
# Wifi ---
|
||||
param=$(/sbin/mnf_info "--name")
|
||||
router_name=${param:0:6}
|
||||
if [ $router_name == "RUTX08" ] || [ $router_name == "RUTX09" ]; then
|
||||
rm /etc/modules.d/ath10k
|
||||
fi
|
||||
|
||||
/bin/board_detect
|
||||
|
||||
/sbin/kmodloader
|
||||
|
||||
/bin/config_generate
|
||||
uci_apply_defaults
|
||||
|
||||
[ -f "/etc/config/teltonika" ] && rm /etc/config/teltonika
|
||||
|
||||
# temporary hack until configd exists
|
||||
/sbin/reload_config
|
||||
# leave finished boot script indication
|
||||
touch /var/run/boot-done
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
|
||||
START=95
|
||||
boot() {
|
||||
mount_root done
|
||||
rm -f /sysupgrade.tgz && sync
|
||||
|
||||
# process user commands
|
||||
[ -f /etc/rc.local ] && {
|
||||
sh /etc/rc.local
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
START=94
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
|
||||
load_gpio_switch()
|
||||
{
|
||||
local name
|
||||
local gpio_pin
|
||||
local value
|
||||
|
||||
config_get gpio_pin "$1" gpio_pin
|
||||
config_get name "$1" name
|
||||
config_get value "$1" value 0
|
||||
|
||||
[ -z "$gpio_pin" ] && {
|
||||
echo >&2 "Skipping gpio_switch '$name' due to missing gpio_pin"
|
||||
return 1
|
||||
}
|
||||
|
||||
local gpio_path
|
||||
if [ -n "$(echo "$gpio_pin" | grep -E "^[0-9]+$")" ]; then
|
||||
gpio_path="/sys/class/gpio/gpio${gpio_pin}"
|
||||
|
||||
# export GPIO pin for access
|
||||
[ -d "$gpio_path" ] || {
|
||||
echo "$gpio_pin" >/sys/class/gpio/export
|
||||
# we need to wait a bit until the GPIO appears
|
||||
[ -d "$gpio_path" ] || sleep 1
|
||||
}
|
||||
|
||||
# direction attribute only exists if the kernel supports changing the
|
||||
# direction of a GPIO
|
||||
if [ -e "${gpio_path}/direction" ]; then
|
||||
# set the pin to output with high or low pin value
|
||||
{ [ "$value" = "0" ] && echo "low" || echo "high"; } \
|
||||
>"$gpio_path/direction"
|
||||
else
|
||||
{ [ "$value" = "0" ] && echo "0" || echo "1"; } \
|
||||
>"$gpio_path/value"
|
||||
fi
|
||||
else
|
||||
gpio_path="/sys/class/gpio/${gpio_pin}"
|
||||
|
||||
[ -d "$gpio_path" ] && {
|
||||
{ [ "$value" = "0" ] && echo "0" || echo "1"; } \
|
||||
>"$gpio_path/value"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "system"
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
[ -e /sys/class/gpio/ ] && {
|
||||
config_load system
|
||||
config_foreach load_gpio_switch gpio_switch
|
||||
}
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008 OpenWrt.org
|
||||
|
||||
START=96
|
||||
|
||||
load_led() {
|
||||
local name
|
||||
local sysfs
|
||||
local trigger
|
||||
local dev
|
||||
local ports
|
||||
local mode
|
||||
local default
|
||||
local delayon
|
||||
local delayoff
|
||||
local interval
|
||||
|
||||
config_get sysfs $1 sysfs
|
||||
config_get name $1 name "$sysfs"
|
||||
config_get trigger $1 trigger "none"
|
||||
config_get dev $1 dev
|
||||
config_get ports $1 port
|
||||
config_get mode $1 mode
|
||||
config_get_bool default $1 default "0"
|
||||
config_get delayon $1 delayon
|
||||
config_get delayoff $1 delayoff
|
||||
config_get interval $1 interval "50"
|
||||
config_get port_state $1 port_state
|
||||
config_get delay $1 delay "150"
|
||||
config_get message $1 message ""
|
||||
config_get gpio $1 gpio "0"
|
||||
config_get inverted $1 inverted "0"
|
||||
|
||||
if [ "$trigger" = "rssi" ]; then
|
||||
# handled by rssileds userspace process
|
||||
return
|
||||
fi
|
||||
|
||||
[ "$trigger" = "usbdev" ] && {
|
||||
# Backward compatibility: translate to the new trigger
|
||||
trigger="usbport"
|
||||
# Translate port of root hub, e.g. 4-1 -> usb4-port1
|
||||
ports=$(echo "$dev" | sed -n 's/^\([0-9]*\)-\([0-9]*\)$/usb\1-port\2/p')
|
||||
# Translate port of extra hub, e.g. 2-2.4 -> 2-2-port4
|
||||
[ -z "$ports" ] && ports=$(echo "$dev" | sed -n 's/\./-port/p')
|
||||
}
|
||||
|
||||
[ -e /sys/class/leds/${sysfs}/brightness ] && {
|
||||
echo "setting up led ${name}"
|
||||
|
||||
printf "%s %s %d\n" \
|
||||
"$sysfs" \
|
||||
"$(sed -ne 's/^.*\[\(.*\)\].*$/\1/p' /sys/class/leds/${sysfs}/trigger)" \
|
||||
"$(cat /sys/class/leds/${sysfs}/brightness)" \
|
||||
>> /var/run/led.state
|
||||
|
||||
[ "$default" = 0 ] &&
|
||||
echo 0 >/sys/class/leds/${sysfs}/brightness
|
||||
|
||||
echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null
|
||||
ret="$?"
|
||||
|
||||
[ $default = 1 ] &&
|
||||
cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness
|
||||
|
||||
[ $ret = 0 ] || {
|
||||
echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module"
|
||||
return 1
|
||||
}
|
||||
case "$trigger" in
|
||||
"netdev")
|
||||
[ -n "$dev" ] && {
|
||||
echo $dev > /sys/class/leds/${sysfs}/device_name
|
||||
for m in $mode; do
|
||||
[ -e "/sys/class/leds/${sysfs}/$m" ] && \
|
||||
echo 1 > /sys/class/leds/${sysfs}/$m
|
||||
done
|
||||
echo $interval > /sys/class/leds/${sysfs}/interval
|
||||
}
|
||||
;;
|
||||
|
||||
"timer"|"oneshot")
|
||||
[ -n "$delayon" ] && \
|
||||
echo $delayon > /sys/class/leds/${sysfs}/delay_on
|
||||
[ -n "$delayoff" ] && \
|
||||
echo $delayoff > /sys/class/leds/${sysfs}/delay_off
|
||||
;;
|
||||
|
||||
"usbport")
|
||||
local p
|
||||
|
||||
for p in $ports; do
|
||||
echo 1 > /sys/class/leds/${sysfs}/ports/$p
|
||||
done
|
||||
;;
|
||||
|
||||
"port_state")
|
||||
[ -n "$port_state" ] && \
|
||||
echo $port_state > /sys/class/leds/${sysfs}/port_state
|
||||
;;
|
||||
|
||||
"gpio")
|
||||
echo $gpio > /sys/class/leds/${sysfs}/gpio
|
||||
echo $inverted > /sys/class/leds/${sysfs}/inverted
|
||||
;;
|
||||
|
||||
switch[0-9]*)
|
||||
local port_mask speed_mask
|
||||
|
||||
config_get port_mask $1 port_mask
|
||||
[ -n "$port_mask" ] && \
|
||||
echo $port_mask > /sys/class/leds/${sysfs}/port_mask
|
||||
config_get speed_mask $1 speed_mask
|
||||
[ -n "$speed_mask" ] && \
|
||||
echo $speed_mask > /sys/class/leds/${sysfs}/speed_mask
|
||||
[ -n "$mode" ] && \
|
||||
echo "$mode" > /sys/class/leds/${sysfs}/mode
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
start() {
|
||||
[ -e /sys/class/leds/ ] && {
|
||||
[ -s /var/run/led.state ] && {
|
||||
local led trigger brightness
|
||||
while read led trigger brightness; do
|
||||
[ -e "/sys/class/leds/$led/trigger" ] && \
|
||||
echo "$trigger" > "/sys/class/leds/$led/trigger"
|
||||
|
||||
[ -e "/sys/class/leds/$led/brightness" ] && \
|
||||
echo "$brightness" > "/sys/class/leds/$led/brightness"
|
||||
done < /var/run/led.state
|
||||
rm /var/run/led.state
|
||||
}
|
||||
|
||||
config_load system
|
||||
config_foreach load_led led
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 Teltonika Networks
|
||||
# Copyright (C) 2022 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
|
||||
START=2
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
PROG=/bin/board_track
|
||||
NAME=board_track
|
||||
PIDCOUNT=1
|
||||
|
||||
start_service() {
|
||||
. /lib/functions
|
||||
|
||||
[ "$(board_name)" != "teltonika,rutx" ] && return 0
|
||||
local pid_file="/var/run/${NAME}.${PIDCOUNT}.pid"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param file /etc/config/system
|
||||
|
||||
procd_set_param respawn
|
||||
|
||||
procd_set_param stdout 1
|
||||
procd_set_param pidfile $pid_file
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "system"
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Copyright (C) 2021 Teltonika
|
||||
|
||||
START=50
|
||||
STOP=51
|
||||
USE_PROCD=1
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "ntpserver"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
. /lib/functions.sh
|
||||
local enabled
|
||||
|
||||
config_load ntpserver
|
||||
config_get enabled general enabled "0"
|
||||
|
||||
[ "$enabled" -gt 0 ] || return
|
||||
|
||||
logger -t "ntpd" "Starting NTP server"
|
||||
procd_open_instance
|
||||
procd_set_param respawn 0
|
||||
procd_set_param command "ntpd" -ln
|
||||
procd_close_instance
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
|
||||
ipq40xx_power_auto() {
|
||||
# change scaling governor as ondemand to enable clock scaling based on system load
|
||||
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
|
||||
# set scaling min freq as 200 MHz
|
||||
echo "716000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
|
||||
|
||||
# Change sampling rate for frequency scaling decisions to 1s, from 10 ms
|
||||
#echo "1000000" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
|
||||
|
||||
# Change sampling rate for frequency down scaling decision to 10s
|
||||
#echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
|
||||
|
||||
# Change the CPU load threshold above which frequency is up-scaled to
|
||||
# turbo frequency,to 50%
|
||||
#echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
|
||||
}
|
||||
|
||||
start() {
|
||||
. /lib/functions.sh
|
||||
|
||||
local board=$(board_name)
|
||||
case "$board" in
|
||||
teltonika,rutx | ap-dk01.1-c1 | ap-dk01.1-c2 | ap-dk04.1-c1 | ap-dk04.1-c2 | ap-dk04.1-c3 | \
|
||||
ap-dk04.1-c4 | ap-dk04.1-c5 | ap-dk05.1-c1 | ap-dk06.1-c1 | ap-dk07.1-c1 | ap-dk07.1-c2 | ap-dk07.1-c3)
|
||||
ipq40xx_power_auto ;;
|
||||
esac
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
start() {
|
||||
mask=4
|
||||
for rps in /sys/class/net/eth0/queues/rx-*
|
||||
do
|
||||
echo "$mask" > "$rps/rps_cpus"
|
||||
done
|
||||
for irq in $(grep -F "ath10k_ahb" /proc/interrupts | cut -d: -f1 | sed 's, *,,')
|
||||
do
|
||||
echo "$mask" > "/proc/irq/$irq/smp_affinity"
|
||||
mask=8
|
||||
done
|
||||
|
||||
mask=2
|
||||
for irq in $(grep -F "edma_eth_rx" /proc/interrupts | cut -d: -f1 | sed 's, *,,')
|
||||
do
|
||||
echo "$mask" > "/proc/irq/$irq/smp_affinity"
|
||||
done
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
|
||||
START=11
|
||||
|
||||
apply_defaults() {
|
||||
local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
|
||||
local min_free frag_low_thresh frag_high_thresh
|
||||
|
||||
if [ "$mem" -gt 65536 ]; then # 128M
|
||||
min_free=16384
|
||||
elif [ "$mem" -gt 32768 ]; then # 64M
|
||||
#Too high for RUT3 device, lets make 2048
|
||||
#min_free=8192
|
||||
min_free=2048
|
||||
else
|
||||
min_free=1024
|
||||
frag_low_thresh=393216
|
||||
frag_high_thresh=524288
|
||||
fi
|
||||
|
||||
sysctl -qw vm.min_free_kbytes="$min_free"
|
||||
|
||||
[ "$frag_low_thresh" ] && sysctl -qw \
|
||||
net.ipv4.ipfrag_low_thresh="$frag_low_thresh" \
|
||||
net.ipv4.ipfrag_high_thresh="$frag_high_thresh" \
|
||||
net.ipv6.ip6frag_low_thresh="$frag_low_thresh" \
|
||||
net.ipv6.ip6frag_high_thresh="$frag_high_thresh" \
|
||||
net.netfilter.nf_conntrack_frag6_low_thresh="$frag_low_thresh" \
|
||||
net.netfilter.nf_conntrack_frag6_high_thresh="$frag_high_thresh"
|
||||
|
||||
# first set default, then all interfaces to avoid races with appearing interfaces
|
||||
if [ -d /proc/sys/net/ipv6/conf ]; then
|
||||
echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
|
||||
for iface in /proc/sys/net/ipv6/conf/*/accept_ra; do
|
||||
echo 0 > "$iface"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
apply_defaults
|
||||
for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do
|
||||
[ -f "$CONF" ] && sysctl -e -p "$CONF" >&-
|
||||
done
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
|
||||
START=00
|
||||
STOP=90
|
||||
|
||||
RTC_DEV=/dev/rtc0
|
||||
HWCLOCK=/sbin/hwclock
|
||||
|
||||
boot() {
|
||||
# start && exit 0
|
||||
|
||||
local maxtime="$(maxtime)"
|
||||
local curtime="$(date +%s)"
|
||||
[ $curtime -lt $maxtime ] && date -s @$maxtime
|
||||
}
|
||||
|
||||
start() {
|
||||
boot
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
|
||||
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
|
||||
}
|
||||
|
||||
maxtime() {
|
||||
local file newest
|
||||
|
||||
for file in $( find /etc -type f ) ; do
|
||||
[ -z "$newest" -o "$newest" -ot "$file" ] && newest=$file
|
||||
done
|
||||
[ "$newest" ] && date -r "$newest" +%s
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
|
||||
START=10
|
||||
USE_PROCD=1
|
||||
|
||||
validate_system_section() {
|
||||
uci_load_validate system system "$1" "$2" \
|
||||
'hostname:string:%%NAME%%' \
|
||||
'conloglevel:uinteger' \
|
||||
'buffersize:uinteger' \
|
||||
'timezone:string:UTC' \
|
||||
'zonename:string'
|
||||
}
|
||||
|
||||
system_config() {
|
||||
[ "$2" = 0 ] || {
|
||||
echo "validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "$hostname" > /proc/sys/kernel/hostname
|
||||
[ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
|
||||
echo "$timezone" > /tmp/TZ
|
||||
[ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/${zonename// /_}" ] \
|
||||
&& ln -sf "/usr/share/zoneinfo/${zonename// /_}" /tmp/localtime \
|
||||
&& rm -f /tmp/TZ
|
||||
|
||||
# apply timezone to kernel
|
||||
hwclock -u --systz
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
config_load system
|
||||
config_foreach validate_system_section system system_config
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "system"
|
||||
procd_add_validation validate_system_section
|
||||
}
|
||||
|
||||
start_service() {
|
||||
reload_service
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
|
||||
STOP=90
|
||||
|
||||
restart() {
|
||||
:
|
||||
}
|
||||
|
||||
stop() {
|
||||
sync
|
||||
/bin/umount -a -d -r
|
||||
}
|
|
@ -1,284 +0,0 @@
|
|||
#!/bin/ash
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
ucidef_add_nand_info() {
|
||||
local model="$1"
|
||||
|
||||
model=${model:0:7}
|
||||
|
||||
json_select_object nand
|
||||
|
||||
case "$model" in
|
||||
TRB1412)
|
||||
json_add_int blocksize 128
|
||||
json_add_int pagesize 2048
|
||||
json_add_int subpagesize 2048
|
||||
;;
|
||||
TRB1422 |\
|
||||
TRB1423 |\
|
||||
TRB1452)
|
||||
json_add_int blocksize 256
|
||||
json_add_int pagesize 4096
|
||||
json_add_int subpagesize 4096
|
||||
;;
|
||||
TRB14*0)
|
||||
json_add_int blocksize 128
|
||||
json_add_int pagesize 2048
|
||||
json_add_int subpagesize 2048
|
||||
;;
|
||||
TRB14*1)
|
||||
json_add_int blocksize 256
|
||||
json_add_int pagesize 4096
|
||||
json_add_int subpagesize 4096
|
||||
;;
|
||||
esac
|
||||
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_add_static_modem_info() {
|
||||
#Parameters: model usb_id sim_count other_params
|
||||
local model usb_id count
|
||||
local modem_counter=0
|
||||
local sim_count=1
|
||||
|
||||
model="$1"
|
||||
usb_id="$2"
|
||||
|
||||
[ -n "$3" ] && sim_count="$3"
|
||||
|
||||
json_get_keys count modems
|
||||
[ -n "$count" ] && modem_counter="$(echo "$count" | wc -w)"
|
||||
|
||||
json_select_array "modems"
|
||||
json_add_object
|
||||
json_add_string id "$usb_id"
|
||||
json_add_string num "$((modem_counter + 1))"
|
||||
json_add_boolean builtin 1
|
||||
json_add_int simcount "$sim_count"
|
||||
|
||||
for i in "$@"; do
|
||||
case "$i" in
|
||||
primary)
|
||||
json_add_boolean primary 1
|
||||
;;
|
||||
gps_out)
|
||||
json_add_boolean gps_out 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
json_close_object
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_add_trb14x_lte_modem() {
|
||||
print_array() {
|
||||
json_add_array $1
|
||||
for element in $2
|
||||
do
|
||||
json_add_string "" "$(echo $element)"
|
||||
done
|
||||
json_close_array
|
||||
}
|
||||
#Parameters: model primary
|
||||
local model vendor product boudrate gps type desc control region modem_counter
|
||||
modem_counter=1
|
||||
json_select_array "modems"
|
||||
|
||||
model="$1"
|
||||
|
||||
model=${model:0:7}
|
||||
|
||||
case "$model" in
|
||||
TRB1422)
|
||||
vendor=05c6
|
||||
product=9215
|
||||
;;
|
||||
TRB1412 |\
|
||||
TRB1423 |\
|
||||
TRB1452 |\
|
||||
TRB140*)
|
||||
vendor=2c7c
|
||||
product=0125
|
||||
;;
|
||||
TRB14*)
|
||||
vendor=2c7c
|
||||
product=0121
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$model" in
|
||||
TRB1412 |\
|
||||
TRB14*0)
|
||||
region="EU"
|
||||
[ "$product" = "0121" ] && {
|
||||
lte_bands="1 3 7 8 20 28"
|
||||
trysg_bands="wcdma_2100 wcdma_900"
|
||||
dug_bands="gsm_1800 gsm_900"
|
||||
}
|
||||
[ "$product" = "0125" ] && {
|
||||
lte_bands="1 3 7 8 20 28 38 40 41"
|
||||
trysg_bands="wcdma_2100 wcdma_900"
|
||||
dug_bands="gsm_1800 gsm_900"
|
||||
}
|
||||
;;
|
||||
TRB1422)
|
||||
region="CE"
|
||||
lte_bands="1 3 5 8 34 38 39 40 41"
|
||||
trysg_bands="bc-0-a-system bc-0-b-system wcdma_2100 wcdma_900"
|
||||
dug_bands="gsm_1800 gsm_900"
|
||||
;;
|
||||
TRB1423 |\
|
||||
TRB1452 |\
|
||||
TRB14*1)
|
||||
region="AU"
|
||||
[ "$product" = "0121" ] && {
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="wcdma_2100 wcdma_1900 wcdma_900 wcdma_850"
|
||||
dug_bands="gsm_1800 gsm_900 gsm_850 gsm_1900"
|
||||
}
|
||||
[ "$product" = "0125" ] && {
|
||||
lte_bands="1 2 3 4 5 7 8 28 40"
|
||||
trysg_bands="wcdma_2100 wcdma_1900 wcdma_900 wcdma_850"
|
||||
dug_bands="gsm_1800 gsm_900 gsm_850 gsm_1900"
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -f "/lib/network/wwan/$vendor:$product" ] && {
|
||||
devicename="3-1"
|
||||
json_set_namespace defaults old_cb
|
||||
json_load "$(cat /lib/network/wwan/$vendor:$product)"
|
||||
json_get_vars gps boudrate type desc control stop_bits
|
||||
json_set_namespace $old_cb
|
||||
|
||||
[ "${devicename%%:*}" = "$devicename" ] && {
|
||||
json_add_object
|
||||
json_add_string id "$devicename"
|
||||
json_add_string num "$modem_counter"
|
||||
json_add_string vendor "$vendor"
|
||||
json_add_string product "$product"
|
||||
json_add_string stop_bits "$stop_bits"
|
||||
json_add_string gps "$gps"
|
||||
json_add_string boudrate "$boudrate"
|
||||
json_add_string type "$type"
|
||||
json_add_string desc "$desc"
|
||||
json_add_string region "$region"
|
||||
json_add_string control "$control"
|
||||
json_add_int simcount 1
|
||||
json_add_boolean builtin 1
|
||||
[ -n "$2" ] && json_add_boolean primary 1
|
||||
json_add_object service_modes
|
||||
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
|
||||
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
|
||||
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands"
|
||||
json_close_object
|
||||
json_close_object
|
||||
}
|
||||
}
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_add_serial_capabilities() {
|
||||
json_select_array serial
|
||||
json_add_object
|
||||
[ -n "$1" ] && {
|
||||
json_select_array devices
|
||||
for d in $1; do
|
||||
json_add_string "" $d
|
||||
done
|
||||
json_select ..
|
||||
}
|
||||
|
||||
json_select_array bauds
|
||||
for b in $2; do
|
||||
json_add_string "" $b
|
||||
done
|
||||
json_select ..
|
||||
|
||||
json_select_array data_bits
|
||||
for n in $3; do
|
||||
json_add_string "" $n
|
||||
done
|
||||
json_select ..
|
||||
json_close_object
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_hwinfo() {
|
||||
local function
|
||||
local dual_sim=0
|
||||
local wifi=0
|
||||
local dual_band_ssid=0
|
||||
local wps=0
|
||||
local mobile=0
|
||||
local gps=0
|
||||
local usb=0
|
||||
local bluetooth=0
|
||||
local ethernet=0
|
||||
local sfp_port=0
|
||||
local ios=0
|
||||
|
||||
for function in "$@"; do
|
||||
case "$function" in
|
||||
dual_sim)
|
||||
dual_sim=1
|
||||
;;
|
||||
wifi)
|
||||
wifi=1
|
||||
;;
|
||||
dual_band_ssid)
|
||||
dual_band_ssid=1
|
||||
;;
|
||||
wps)
|
||||
wps=1
|
||||
;;
|
||||
mobile)
|
||||
mobile=1
|
||||
;;
|
||||
gps)
|
||||
gps=1
|
||||
;;
|
||||
usb)
|
||||
usb=1
|
||||
;;
|
||||
bluetooth)
|
||||
bluetooth=1
|
||||
;;
|
||||
ethernet)
|
||||
ethernet=1
|
||||
;;
|
||||
sfp_port)
|
||||
sfp_port=1
|
||||
;;
|
||||
ios)
|
||||
ios=1
|
||||
;;
|
||||
at_sim)
|
||||
at_sim=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
json_select_object hwinfo
|
||||
json_add_boolean dual_sim "$dual_sim"
|
||||
json_add_boolean usb "$usb"
|
||||
json_add_boolean bluetooth "$bluetooth"
|
||||
json_add_boolean wifi "$wifi"
|
||||
json_add_boolean dual_band_ssid "$dual_band_ssid"
|
||||
json_add_boolean wps "$wps"
|
||||
json_add_boolean mobile "$mobile"
|
||||
json_add_boolean gps "$gps"
|
||||
json_add_boolean ethernet "$ethernet"
|
||||
json_add_boolean sfp_port "$sfp_port"
|
||||
json_add_boolean ios "$ios"
|
||||
json_add_boolean at_sim "$at_sim"
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_release_version() {
|
||||
json_add_string release_version "$1"
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
is_ios_enabled() {
|
||||
local ios
|
||||
json_load_file "/etc/board.json" && \
|
||||
json_select hwinfo && \
|
||||
json_get_var ios ios && [ "$ios" = "1" ]
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
export IMAGE="$1"
|
||||
COMMAND="$2"
|
||||
|
||||
export INTERACTIVE=0
|
||||
export VERBOSE=1
|
||||
export CONFFILES=/tmp/sysupgrade.conffiles
|
||||
|
||||
RAMFS_COPY_BIN= # extra programs for temporary ramfs root
|
||||
RAMFS_COPY_DATA= # extra data files
|
||||
|
||||
include /lib/upgrade
|
||||
|
||||
|
||||
supivot() { # <new_root> <old_root>
|
||||
/bin/mount | grep "on $1 type" 2>&- 1>&- || /bin/mount -o bind $1 $1
|
||||
mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
|
||||
/bin/mount -o noatime,move /proc $1/proc && \
|
||||
pivot_root $1 $1$2 || {
|
||||
/bin/umount -l $1 $1
|
||||
return 1
|
||||
}
|
||||
|
||||
/bin/mount -o noatime,move $2/sys /sys
|
||||
/bin/mount -o noatime,move $2/dev /dev
|
||||
/bin/mount -o noatime,move $2/tmp /tmp
|
||||
/bin/mount -o noatime,move $2/overlay /overlay 2>&-
|
||||
return 0
|
||||
}
|
||||
|
||||
switch_to_ramfs() {
|
||||
for binary in \
|
||||
/bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
|
||||
pivot_root mount_root reboot sync kill sleep \
|
||||
md5sum hexdump cat zcat bzcat dd tar \
|
||||
ls basename find cp mv rm mkdir rmdir mknod touch chmod \
|
||||
'[' printf wc grep awk sed cut \
|
||||
mtd partx losetup mkfs.ext4 nandwrite flash_erase \
|
||||
ubiupdatevol ubiattach ubiblock ubiformat \
|
||||
ubidetach ubirsvol ubirmvol ubimkvol \
|
||||
snapshot snapshot_tool date \
|
||||
dumpimage $RAMFS_COPY_BIN
|
||||
do
|
||||
local file="$(command -v "$binary" 2>/dev/null)"
|
||||
[ -n "$file" ] && install_bin "$file"
|
||||
done
|
||||
install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh /lib/upgrade/do_stage2 /usr/share/libubox/jshn.sh $RAMFS_COPY_DATA
|
||||
|
||||
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
|
||||
|
||||
supivot $RAM_ROOT /mnt || {
|
||||
v "Failed to switch over to ramfs. Please reboot."
|
||||
exit 1
|
||||
}
|
||||
|
||||
/bin/mount -o remount,ro /mnt
|
||||
/bin/umount -l /mnt
|
||||
|
||||
grep /overlay /proc/mounts > /dev/null && {
|
||||
/bin/mount -o noatime,remount,ro /overlay
|
||||
/bin/umount -l /overlay
|
||||
}
|
||||
}
|
||||
|
||||
kill_remaining() { # [ <signal> [ <loop> ] ]
|
||||
local loop_limit=10
|
||||
|
||||
local sig="${1:-TERM}"
|
||||
local loop="${2:-0}"
|
||||
local run=true
|
||||
local stat
|
||||
local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
|
||||
|
||||
vn "Sending $sig to remaining processes ..."
|
||||
|
||||
while $run; do
|
||||
run=false
|
||||
for stat in /proc/[0-9]*/stat; do
|
||||
[ -f "$stat" ] || continue
|
||||
|
||||
local pid name state ppid rest
|
||||
read pid name state ppid rest < $stat
|
||||
name="${name#(}"; name="${name%)}"
|
||||
|
||||
# Skip PID1, our parent, ourself and our children
|
||||
[ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue
|
||||
|
||||
local cmdline
|
||||
read cmdline < /proc/$pid/cmdline
|
||||
|
||||
# Skip kernel threads
|
||||
[ -n "$cmdline" ] || continue
|
||||
|
||||
_vn " $name"
|
||||
kill -$sig $pid 2>/dev/null
|
||||
|
||||
[ $loop -eq 1 ] && run=true
|
||||
done
|
||||
|
||||
let loop_limit--
|
||||
[ $loop_limit -eq 0 ] && {
|
||||
_v
|
||||
v "Failed to kill all processes."
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
_v
|
||||
}
|
||||
|
||||
indicate_upgrade
|
||||
|
||||
killall -9 telnetd
|
||||
killall -9 dropbear
|
||||
killall -9 ash
|
||||
|
||||
kill_remaining TERM
|
||||
sleep 3
|
||||
kill_remaining KILL 1
|
||||
|
||||
sleep 1
|
||||
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
|
||||
if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
|
||||
platform_pre_upgrade "$IMAGE"
|
||||
fi
|
||||
|
||||
if [ -n "$(rootfs_type)" ]; then
|
||||
v "Switching to ramdisk..."
|
||||
switch_to_ramfs
|
||||
fi
|
||||
|
||||
# Exec new shell from ramfs
|
||||
exec /bin/busybox ash -c "$COMMAND"
|
|
@ -1,120 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
PS_ON=1
|
||||
PS_OFF=2
|
||||
|
||||
MPS=0
|
||||
MLBL="modem"
|
||||
|
||||
modem_reset() {
|
||||
local label="$1"
|
||||
|
||||
[ -e "/sys/class/gpio/${label}_reset/value" ] || return
|
||||
|
||||
echo 1 > "/sys/class/gpio/${label}_reset/value"
|
||||
sleep 1
|
||||
echo 0 > "/sys/class/gpio/${label}_reset/value"
|
||||
}
|
||||
|
||||
modem_off() {
|
||||
local label="$1"
|
||||
|
||||
[ -e "/sys/class/gpio/${label}_reset/value" ] || return
|
||||
|
||||
echo 1 > "/sys/class/gpio/${label}_reset/value"
|
||||
}
|
||||
|
||||
modem_power() {
|
||||
local label="$1"
|
||||
|
||||
[ -e "/sys/class/gpio/${label}_power/value" ] || return
|
||||
|
||||
# simulate power press
|
||||
echo 1 > "/sys/class/gpio/${label}_power/value"
|
||||
sleep 1
|
||||
echo 0 > "/sys/class/gpio/${label}_power/value"
|
||||
}
|
||||
|
||||
modem_list() {
|
||||
local list="modem"
|
||||
local label
|
||||
|
||||
[ "$(modem_fetch_primary)" -eq 0 ] && {
|
||||
echo "${list}"
|
||||
return
|
||||
}
|
||||
|
||||
for m in /sys/class/gpio/modem*_power; do
|
||||
label="$(basename $m | awk -F_ '{print $1}')"
|
||||
[ "${label}" != "modem" ] && list="${list},${label}"
|
||||
done
|
||||
|
||||
echo "${list}"
|
||||
}
|
||||
|
||||
modem_fetch_primary() {
|
||||
local modem modems primary
|
||||
|
||||
json_init
|
||||
json_load_file "/etc/board.json"
|
||||
|
||||
json_get_keys modems modems
|
||||
json_select modems
|
||||
|
||||
for modem in $modems; do
|
||||
json_select "$modem"
|
||||
json_get_vars primary
|
||||
|
||||
[ -n "$primary" ] && {
|
||||
echo 1
|
||||
return
|
||||
}
|
||||
|
||||
json_select ..
|
||||
done
|
||||
echo 0
|
||||
}
|
||||
|
||||
modem_is_available() {
|
||||
local label="$1"
|
||||
[ -e "/sys/class/gpio/${label}_power/value" ]
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage $0 <option>
|
||||
Control modem power state.
|
||||
|
||||
Options:
|
||||
-p, --power-on power on modem
|
||||
-s, --shutdown shutdown modem
|
||||
-r, --reboot reboot modem
|
||||
-m, --modem <label> use specified modem instead of default one
|
||||
|
||||
Available modem labels:
|
||||
$(modem_list)
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-p | --power-on) MPS="${PS_ON}";;
|
||||
-s | --shutdown) MPS="${PS_OFF}";;
|
||||
-r | --reboot) MPS="${PS_ON}";;
|
||||
-m | --modem) MLBL="$2"; shift;;
|
||||
-*) echo "Invalid option: $1"; usage;;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ "${MPS}" -eq 0 ] && usage
|
||||
modem_is_available "${MLBL}" || usage
|
||||
|
||||
case "${MPS}" in
|
||||
"${PS_ON}") modem_reset "${MLBL}"; sleep 1; modem_power "${MLBL}";;
|
||||
"${PS_OFF}") modem_off "${MLBL}";;
|
||||
esac
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-n|--name)
|
||||
echo $(dd if=/dev/mtd13 bs=1 count=12 skip=16 2>/dev/null)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue