From c8ab92f6dc233a7bc8cae1027fe559cde90dc476 Mon Sep 17 00:00:00 2001 From: Piotr Kubik Date: Thu, 18 Apr 2024 11:02:39 +0200 Subject: [PATCH] iop: Remove legacy commands and files refs #14205 --- iop/config | 335 ----------------- iop/iop.completion | 2 +- iop/scripts/feeds_update-legacy.sh | 88 ----- iop/scripts/genconfig-legacy.sh | 535 ---------------------------- iop/scripts/genconfig_min-legacy.sh | 503 -------------------------- 5 files changed, 1 insertion(+), 1462 deletions(-) delete mode 100644 iop/config delete mode 100755 iop/scripts/feeds_update-legacy.sh delete mode 100755 iop/scripts/genconfig-legacy.sh delete mode 100755 iop/scripts/genconfig_min-legacy.sh diff --git a/iop/config b/iop/config deleted file mode 100644 index be45665f3..000000000 --- a/iop/config +++ /dev/null @@ -1,335 +0,0 @@ -############ -# Generic # -########## - -# Build # -CONFIG_BUILD_LOG=y -CONFIG_CCACHE=y -CONFIG_DEBUG=y -CONFIG_DEVEL=y -# CONFIG_USE_SSTRIP is not set -CONFIG_USE_STRIP=y -# CONFIG_SIGNED_PACKAGES is not set - -CONFIG_JSON_CYCLONEDX_SBOM=y -CONFIG_INCLUDE_CONFIG=y - -# Image # -CONFIG_TARGET_CUSTOMER="IOPSYS" -CONFIG_TARGET_ROOTFS_TARGZ=y - -# Although UBIFS and EXT4 images work on all non-secure-boot devices, -# squashfs is the only officially supported rootfs filesystem. -# A writable rootfs is useful for developping an debugging preinit code. -# CONFIG_TARGET_ROOTFS_UBIFS is not set -# CONFIG_TARGET_ROOTFS_EXT4FS is not set - -# /etc/banner and /etc/device_info # -CONFIG_IMAGEOPT=y -CONFIG_VERSIONOPT=y -CONFIG_VERSION_MANUFACTURER="IOPSYS" -CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/" -CONFIG_VERSION_DIST="IOWRT" - -# OpenWrt is given by CONFIG_VERSION_NUMBER which we do not want to override. -# disabling CONFIG_VERSION_FILENAMES will hide the OpenWrt version from the image filename -# CONFIG_VERSION_FILENAMES is not set - -# CONFIG_VERSION_CODE is set to the IOWRT version instead by the genconfig-script and -# CONFIG_VERSION_CODE_FILENAMES will put it into the image filename. -CONFIG_VERSION_CODE_FILENAMES=y - -CONFIG_VERSION_HOME_URL="https://iopsys.eu" -CONFIG_VERSION_BUG_URL="https://iopsys.eu" -CONFIG_VERSION_SUPPORT_URL="https://iopsys.eu" - -# /lib/preinit # -CONFIG_PREINITOPT=y -# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set -CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y -CONFIG_TARGET_PREINIT_TIMEOUT=1 -# CONFIG_TARGET_PREINIT_SHOW_NETMSG is not set -# CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG is not set -CONFIG_TARGET_PREINIT_IFNAME="" -CONFIG_TARGET_PREINIT_IP="" -CONFIG_TARGET_PREINIT_NETMASK="" -CONFIG_TARGET_PREINIT_BROADCAST="" - -# Mirror # -CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/" - - -################## -# IOWRT Add-ons # -################ - -# EasySoC HAL # -CONFIG_PACKAGE_qosmngr=y -CONFIG_PACKAGE_libwifiutils=y -CONFIG_PACKAGE_wifimngr=y - -# Multi-AP # -CONFIG_PACKAGE_ieee1905=y -CONFIG_IEEE1905_CMDU_SA_IS_ALMAC=y -CONFIG_PACKAGE_ieee1905-topology-plugin=y -CONFIG_PACKAGE_decollector=y -CONFIG_PACKAGE_map-agent=y -CONFIG_PACKAGE_map-controller=y - -# Network # -CONFIG_PACKAGE_hostmngr=y -CONFIG_PACKAGE_netmode=y -CONFIG_PACKAGE_urlfilter=y - -# System # -CONFIG_PACKAGE_imonitor=m -CONFIG_PACKAGE_questd=y -CONFIG_PACKAGE_rulengd=y -CONFIG_PACKAGE_usermngr=y - -# TR-x69 # -CONFIG_PACKAGE_libbbfdm=y -CONFIG_PACKAGE_bbfdmd=y -CONFIG_PACKAGE_icwmp=y -CONFIG_PACKAGE_obuspa=y -CONFIG_PACKAGE_bulkdata=y -CONFIG_PACKAGE_periodicstats=y -CONFIG_PACKAGE_stunc=y -CONFIG_PACKAGE_swmodd=y -CONFIG_PACKAGE_twamp=y -CONFIG_PACKAGE_udpecho-client=y -CONFIG_PACKAGE_udpecho-server=y -CONFIG_PACKAGE_userinterface=y -CONFIG_PACKAGE_xmppc=y -CONFIG_PACKAGE_timemngr=y -CONFIG_PACKAGE_self-diagnostics=y - -# WebGUI # -CONFIG_PACKAGE_sulu=y - - -############ -# Network # -########## - -# Protocols # -CONFIG_PACKAGE_6in4=y -CONFIG_PACKAGE_6rd=y -CONFIG_PACKAGE_6to4=y -CONFIG_PACKAGE_chat=y -CONFIG_PACKAGE_comgt=y -CONFIG_PACKAGE_comgt-directip=y -CONFIG_PACKAGE_comgt-ncm=y -CONFIG_PACKAGE_ds-lite=y -CONFIG_PACKAGE_firewall=y -# CONFIG_PACKAGE_firewall4 is not set -CONFIG_PACKAGE_gre=y -CONFIG_PACKAGE_map=y -CONFIG_PACKAGE_ntfs-3g=y -CONFIG_PACKAGE_ntpd=y -CONFIG_PACKAGE_odhcp6c=y -CONFIG_PACKAGE_odhcpd=y -CONFIG_PACKAGE_ppp-mod-pppoa=y -CONFIG_PACKAGE_ppp-mod-pppoe=y -CONFIG_PACKAGE_ppp-mod-pppol2tp=y -CONFIG_PACKAGE_ppp-mod-pptp=y -CONFIG_PACKAGE_ppp-multilink=y -# CONFIG_PACKAGE_ppp is not set -CONFIG_PACKAGE_relayd=y -CONFIG_PACKAGE_umbim=y -CONFIG_PACKAGE_uqmi=y -CONFIG_PACKAGE_wwan=y -CONFIG_PACKAGE_xl2tpd=y - -# Services # -CONFIG_PACKAGE_atftpd=y -CONFIG_PACKAGE_ddns-scripts=y -CONFIG_PACKAGE_dnsmasq=y -CONFIG_PACKAGE_ssdpd=y -CONFIG_PACKAGE_miniupnpd-iptables=y -CONFIG_PACKAGE_mosquitto-client-ssl=y -CONFIG_PACKAGE_mosquitto-ssl=y -CONFIG_PACKAGE_nginx=y -CONFIG_PACKAGE_openvpn-easy-rsa=y -CONFIG_PACKAGE_openvpn-openssl=y -CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y -# CONFIG_PACKAGE_qos-scripts is not set -CONFIG_PACKAGE_rdnssd=y -CONFIG_PACKAGE_vsftpd-tls=y - -# Tools and Utilities # -CONFIG_PACKAGE_curl=y -CONFIG_PACKAGE_libcurl=y -CONFIG_LIBCURL_CRYPTO_AUTH=y -# CONFIG_LIBCURL_MBEDTLS is not set -CONFIG_LIBCURL_OPENSSL=y -CONFIG_PACKAGE_ethtool=y -CONFIG_PACKAGE_ip-bridge=y -CONFIG_PACKAGE_ip-full=y -CONFIG_PACKAGE_iperf3=y -CONFIG_PACKAGE_ipset=y -CONFIG_PACKAGE_ip6tables-zz-legacy=y -CONFIG_PACKAGE_iptables-zz-legacy=y -CONFIG_PACKAGE_iptables-mod-conntrack-extra=y -CONFIG_PACKAGE_iptables-mod-extra=y -CONFIG_PACKAGE_iptables-mod-filter=y -CONFIG_PACKAGE_iptables-mod-ipmark=y -CONFIG_PACKAGE_iptables-mod-ipopt=y -CONFIG_PACKAGE_iptables-mod-nflog=y -CONFIG_PACKAGE_iptables-mod-nfqueue=y -CONFIG_PACKAGE_iputils-arping=y -CONFIG_PACKAGE_iputils-ping=y -CONFIG_PACKAGE_ndisc6=y -CONFIG_PACKAGE_rdisc6=y -CONFIG_PACKAGE_resolveip=y -CONFIG_PACKAGE_socat=y -CONFIG_PACKAGE_tcpdump=y -CONFIG_PACKAGE_traceroute6=y - - -############ -# System # -########## - -CONFIG_PACKAGE_at=y -CONFIG_PACKAGE_ca-certificates=y -CONFIG_PACKAGE_crun=y -CONFIG_PACKAGE_getopt=y -CONFIG_PACKAGE_gpiod-tools=y -# CONFIG_PACKAGE_iwatchdog is not set -CONFIG_PACKAGE_jq=y -CONFIG_PACKAGE_libcap-bin=y -CONFIG_PACKAGE_libustream-openssl=y -# CONFIG_PACKAGE_libustream-wolfssl is not set -CONFIG_PACKAGE_lscpu=y -CONFIG_PACKAGE_nand-utils=y -CONFIG_PACKAGE_openssl-util=y -CONFIG_OPENSSL_WITH_COMPRESSION=y -CONFIG_PACKAGE_procd-ujail=m -CONFIG_PACKAGE_quota=y -CONFIG_PACKAGE_rpcd=y -CONFIG_PACKAGE_rpcd-mod-rpcsys=y -CONFIG_PACKAGE_rpcd-mod-rrdns=y -CONFIG_PACKAGE_strace=y -CONFIG_PACKAGE_terminfo=y -CONFIG_PACKAGE_uledd=y -# The urandom-seed package is very strange. It seeds urandom with urandom... -# Disable it. Most SoCs nowadays has HW random generators anyway. -# CONFIG_PACKAGE_urandom-seed is not set -# CONFIG_PACKAGE_urngd is not set -CONFIG_PACKAGE_usb-modeswitch=y -CONFIG_PACKAGE_uuidgen=y -CONFIG_PACKAGE_zoneinfo-core=y -CONFIG_PACKAGE_zoneinfo-europe=y - - -################ -# LuCI WebGUI # -############## - -# BEGIN: luci-nginx metapackage with some changes -# We do not want libiwinfo-lua on non-WiFi targets, but it is already -# depended on by other luci-packages, so no need to take it in explicitly -CONFIG_PACKAGE_luci-mod-admin-full=y -CONFIG_PACKAGE_luci-app-firewall=y -CONFIG_PACKAGE_luci-app-opkg=y -CONFIG_PACKAGE_luci-proto-ppp=y -CONFIG_PACKAGE_luci-proto-ipv6=y -# CONFIG_LUCI_JSMIN is not set -# CONFIG_LUCI_CSSTIDY is not set -CONFIG_PACKAGE_luci-mod-dashboard=y -CONFIG_PACKAGE_luci-theme-openwrt-2020=y -CONFIG_PACKAGE_nginx-mod-luci=y - - -############ -# BusyBox # -########## - -CONFIG_BUSYBOX_CUSTOM=y -CONFIG_BUSYBOX_CONFIG_ADDUSER=y -CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y -CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y -CONFIG_BUSYBOX_CONFIG_CTTYHACK=y -CONFIG_BUSYBOX_CONFIG_DELUSER=y -CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y -CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100 -# CONFIG_BUSYBOX_CONFIG_HTTPD is not set -# CONFIG_BUSYBOX_CONFIG_INSMOD is not set -# CONFIG_BUSYBOX_CONFIG_MODINFO is not set -# CONFIG_BUSYBOX_CONFIG_MODPROBE is not set -CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_BLACKLIST=y -CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y -CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y -CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules" -CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" -# CONFIG_BUSYBOX_CONFIG_IP is not set -CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999 -CONFIG_BUSYBOX_CONFIG_LOGIN=y -# CONFIG_BUSYBOX_CONFIG_LSMOD is not set -CONFIG_BUSYBOX_CONFIG_LSPCI=y -CONFIG_BUSYBOX_CONFIG_LSUSB=y -CONFIG_BUSYBOX_CONFIG_MICROCOM=y -# CONFIG_BUSYBOX_CONFIG_RMMOD is not set -CONFIG_BUSYBOX_CONFIG_STTY=y -CONFIG_BUSYBOX_CONFIG_TFTP=y -CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_AUTH_MD5=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_BASIC_AUTH=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CGI=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_ERROR_PAGES=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_GZIP=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_PROXY=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_RANGES=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SETUID=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y -CONFIG_BUSYBOX_CONFIG_FEATURE_HTTPD_USE_SENDFILE=y -CONFIG_BUSYBOX_CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y -# CONFIG_BUSYBOX_CONFIG_FEATURE_NOLOGIN is not set -CONFIG_BUSYBOX_CONFIG_FEATURE_SECURETTY=y -# CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_BLOCKSIZE is not set -CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_GET=y -CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y -# CONFIG_BUSYBOX_CONFIG_WGET is not set -# CONFIG_BUSYBOX_CONFIG_LOGIN_SCRIPTS is not set -# CONFIG_BUSYBOX_CONFIG_LOGIN_SESSION_AS_CHILD is not set -# CONFIG_BUSYBOX_CONFIG_PAM is not set -# CONFIG_BUSYBOX_CONFIG_TFTP_DEBUG is not set -# CONFIG_BUSYBOX_CONFIG_NTPD is not set -CONFIG_BUSYBOX_CONFIG_MOUNTPOINT=y -CONFIG_BUSYBOX_CONFIG_RUN_PARTS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_FANCY=y -CONFIG_BUSYBOX_CONFIG_FEATURE_GZIP_LEVELS=y -CONFIG_BUSYBOX_CONFIG_GZIP_FAST=2 -CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_SLEEP=y -CONFIG_BUSYBOX_CONFIG_FEATURE_FLOAT_SLEEP=y -CONFIG_BUSYBOX_CONFIG_FLOAT_DURATION=y -CONFIG_BUSYBOX_CONFIG_USLEEP=y -CONFIG_BUSYBOX_CONFIG_REALPATH=y -CONFIG_BUSYBOX_CONFIG_TTY=y -CONFIG_BUSYBOX_CONFIG_BLOCKDEV=y -CONFIG_BUSYBOX_CONFIG_PARTPROBE=y -CONFIG_BUSYBOX_CONFIG_LFS=y -CONFIG_BUSYBOX_CONFIG_FDISK=y -CONFIG_BUSYBOX_CONFIG_FDISK_SUPPORT_LARGE_DISKS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE=y -CONFIG_BUSYBOX_CONFIG_FEATURE_GPT_LABEL=y -CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_ADVANCED=y -CONFIG_BUSYBOX_CONFIG_IONICE=y -CONFIG_BUSYBOX_CONFIG_RENICE=y -CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_BTRFS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y -CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y -CONFIG_BUSYBOX_CONFIG_TIMEOUT=y -CONFIG_BUSYBOX_CONFIG_NOHUP=y -CONFIG_BUSYBOX_CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512" -# CONFIG_BUSYBOX_CONFIG_ARPING is not set -# CONFIG_BUSYBOX_CONFIG_PING is not set -# CONFIG_BUSYBOX_CONFIG_PING6 is not set -# CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_PING is not set diff --git a/iop/iop.completion b/iop/iop.completion index 8445c5966..cd17335e8 100644 --- a/iop/iop.completion +++ b/iop/iop.completion @@ -33,7 +33,7 @@ _iop() prev="${COMP_WORDS[COMP_CWORD-1]}" iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \ - feeds_update feeds_update-legacy genconfig genconfig-legacy \ + feeds_update genconfig \ generate_tarballs install_key \ scp_changes setup_host ssh_install_key status \ update_package update_feed_branches ssh_upgrade smoketest" diff --git a/iop/scripts/feeds_update-legacy.sh b/iop/scripts/feeds_update-legacy.sh deleted file mode 100755 index 663f8e8ae..000000000 --- a/iop/scripts/feeds_update-legacy.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -function feeds_update-legacy { - heads=1 - developer=0 - override=1 - force=1 - - function update_failure { - if [ $force == 1 ]; then - echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2 - else - echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2 - exit 1 - fi - } - - while getopts "inFh" opt; do - case $opt in - i) - heads=0 - ;; - n) - override=0 - ;; - F) - force=0 - ;; - h|\?) - echo "Usage: ./iop feeds_update-legacy [-i] [-n] [-F] [-h]" - echo - echo "OPTIONS:" - echo " -i - Only update index. Do not change HEAD in feeds." - echo " -n - Do not replace core packages with iopsys versions." - echo " -F - Do not force update if there are inaccessible feeds." - echo " -h - Display this help message and exit." - exit 1 - ;; - esac - done - - git remote -v | grep -qE '(git@|ssh://)' && developer=1 - - cp .config .genconfig_config_bak - - if [ $heads == 1 ]; then - if [ $developer == 1 ]; then - ./scripts/feeds update -g || update_failure - else - ./scripts/feeds update || update_failure - fi - fi - ./scripts/feeds update -ai || exit 1 - - # replace core packages with iopsys versions - if [ $override == 1 ]; then - ./scripts/feeds install -f -p openwrt_core -a || exit 1 - ./scripts/feeds install -f -p qualcomm -a || exit 1 - fi - - ( - echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update' - echo 'FEED_DEVICES_DIRS:=' - find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n' - ) > target/linux/feed-devices/feed-devices-list.mk || exit 1 - - # targets need to be installed explicitly - for target in $(ls ./feeds/targets); do - ./scripts/feeds install -f -p targets $target || exit 1 - done - - # install all packages - ./scripts/feeds install -a || exit 1 - - # remove broken symlinks ( for packages that are no longer in the feed ) - find -L package/feeds -maxdepth 2 -type l -delete || exit 1 - - cp .genconfig_config_bak .config - make defconfig || exit 1 - - # record when we last run this script - touch tmp/.iop_bootstrap || exit 1 - - # always return true - exit 0 -} - -register_command "feeds_update-legacy" "Update feeds to point to commit hashes from feeds.conf - legacy mode" diff --git a/iop/scripts/genconfig-legacy.sh b/iop/scripts/genconfig-legacy.sh deleted file mode 100755 index 331d227c9..000000000 --- a/iop/scripts/genconfig-legacy.sh +++ /dev/null @@ -1,535 +0,0 @@ -#!/bin/bash - -function genconfig-legacy { - export CLEAN=0 - export DIRTY="--dirty" - export IMPORT=1 - export SRCTREEOVERR=0 - export FILEDIR="files/" - CURRENT_CONFIG_FILE=".current_config_file" - export CONFIGPATH="package/feeds/iopsys/iop" - CUSTPATH="customerconfigs" - export CUSTCONF="customerconfigs/customers" - export VERBOSE=0 - export DEVELOPER=0 - target="bogus" - target_config_path="" - brcmbca_feed="target/linux/feeds/brcmbca" - airoha_feed="target/linux/feeds/airoha" - x86_feed="target/linux/feeds/x86" - armsr_feed="target/linux/feeds/armsr" - mediatek_feed="target/linux/feeds/mediatek" - qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx" - qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx" - - Red='\033[0;31m' # Red - Color_Off='\033[0m' # Text Reset - Yellow='\033[0;33m' # Yellow - - function find_last { - egrep "^[ #]*${1}[ =]" $2 | tail -n1 - } - - function is_new { - for opt in $conf_warned - do - if [ "$opt" == "$1" ] - then - return 1 - fi - done - # option not found return true - return 0 - } - - function verify_config { - local conf_opt - local conf_org - local conf_new - - while read -r line - do - conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|') - if [ -n "${conf_opt}" ] - then - conf_org=$(find_last ${conf_opt} .genconfig.config) - conf_new=$(find_last ${conf_opt} .config) - if [ "$conf_org" != "$conf_new" ] - then - if is_new $conf_opt - then - echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config" - echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]" - echo "This is a real problem somebody needs to investigate" - echo "" - conf_warned="$conf_warned $conf_opt" - fi - else - true - # for debug to see all options - #echo -e "wanted [$conf_org] got [$conf_new]" - fi - fi - done < .genconfig.config - } - - # Takes a board name and returns the target name in global var $target - set_target() { - local profile=$1 - - [ -n "$profile" ] || return - - if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then - local targetpath="./target/linux/feeds/$TARGET" - local profiles= - local pfound=0 - - if [ -e "$targetpath/genconfig" ]; then - profiles=$(cd $targetpath; ./genconfig) - - for p in $profiles; do - if [ $p == $profile ]; then - pfound=1 - break - fi - done - fi - - if [ $pfound -eq 1 ]; then - target="$(echo $TARGET | tr '-' '_')" - target_config_path="$targetpath/config" - fi - - return - fi - - [ -e $brcmbca_feed/genconfig ] && - brcmbca=$(cd $brcmbca_feed; ./genconfig) - [ -e $airoha_feed/genconfig ] && - airoha=$(cd $airoha_feed; ./genconfig) - [ -e $x86_feed/genconfig ] && - x86=$(cd $x86_feed; ./genconfig) - [ -e $armsr_feed/genconfig ] && - armsr=$(cd $armsr_feed; ./genconfig) - [ -e $mediatek_feed/genconfig ] && - mediatek=$(cd $mediatek_feed; ./genconfig) - [ -e $qualcomm_ipq95xx_feed/genconfig ] && - ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig) - [ -e $qualcomm_ipq53xx_feed/genconfig ] && - ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig) - - if [ "$profile" == "LIST" ]; then - for list in brcmbca airoha x86 armsr mediatek ipq95xx ipq53xx; do - echo "$list based boards:" - a=$(echo "${!list}" | sort) - for b in $a; do - echo -e "\t$b" - done - done - return - fi - - for p in $airoha; do - if [ $p == $profile ]; then - target="airoha" - target_config_path="$airoha_feed/config" - return - fi - done - - for p in $x86; do - if [ $p == $profile ]; then - target="x86" - target_config_path="$x86_feed/config" - return - fi - done - - for p in $armsr; do - if [ $p == $profile ]; then - target="armsr" - target_config_path="$armsr_feed/config" - return - fi - done - - for p in $mediatek; do - if [ $p == $profile ]; then - target="mediatek" - target_config_path="$mediatek_feed/config" - return - fi - done - - for p in $ipq95xx; do - if [ $p == $profile ]; then - target="ipq95xx" - target_config_path="$qualcomm_ipq95xx_feed/config" - return - fi - done - - for p in $ipq53xx; do - if [ $p == $profile ]; then - target="ipq53xx" - target_config_path="$qualcomm_ipq53xx_feed/config" - return - fi - done - - for p in $brcmbca; do - if [ $p == $profile ]; then - target="brcmbca" - target_config_path="$brcmbca_feed/config" - return - fi - done - } - - git remote -v | grep -qE '(git@|ssh://)' && { - DEVELOPER=1 - } - - v() { - [ "$VERBOSE" -ge 1 ] && echo "$@" - } - - usage() { - echo - echo 1>&2 "Usage: $0 genconfig-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" - echo - echo -e " -c|--clean\t\tRemove all files under ./files and import from config " - echo -e " -D|--no-dirty\t\tIgnore dirty tree" - echo -e " -v|--verbose\t\tVerbose" - echo -e " -n|--no-update\tDo NOT! Update customer config before applying" - echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from" - echo -e " -s|--override\t\tEnable 'Package source tree override'" - echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread" - echo -e " -h|--help\t\tShow this message" - echo -e " -l|--list [customer]\tList all Customers or all boards for one customer" - echo -e " -a|--list-all\t\tList all Customers and their board types" - echo -e " -b|--boards\t\tList all board types" - echo - echo "Example ./iop genconfig-legacy eg400 OPERATORX" - echo "(if no customerconfig is chosen, iopsys config will be used)" - echo - exit 0 - } - - list_customers() - { - local ALL="$1" - local CUSTOMER="$2" - if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then - local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common)" - if [ "$boards" ]; then - echo "$CUSTOMER has following boards:" - for board in $boards; do - echo -e "\t$board" - done - else - echo "No boards found for $CUSTOMER" - fi - elif [ "$CUSTOMER" ]; then - echo "No customer called $CUSTOMER" - exit 1 - elif [ -d $CUSTCONF ]; then - local customers="$(ls -1 $CUSTCONF)" - if [ "$customers" -a "$ALL" == 1 ]; then - for customer in $customers; do - echo $customer - local boards="$(ls -1 $CUSTCONF/$customer | grep -v common)" - if [ "$boards" ]; then - for board in $boards; do - echo -e "\t$board" - done - else - echo "has no boards" - fi - done - elif [ "$customers" ]; then - echo -e "$customers" - else - echo "no customers found" - fi - else - echo "No $CUSTCONF folder found" - fi - exit 0 - } - - - generate_config() - { - DIFFFILE="$1" - MASTERFILE="$2" - while read p; do - v "$p" - sed -r -i "$p" $MASTERFILE - done < $DIFFFILE - } - - setup_dirs() - { - git remote -v | grep -q http || { - CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)" - if git ls-remote $CUSTREPO -q 2>/dev/null; then - if [ ! -d "$CUSTPATH" ]; then - echo "Cloning $CUSTBRANCH branch of $CUSTREPO" - git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || { - DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)" - echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO" - git clone "$CUSTREPO" "$CUSTPATH" - } - elif [ $IMPORT -eq 1 ]; then - cd $CUSTPATH - echo "Checking out $CUSTBRANCH branch in $CUSTPATH" - git checkout "$CUSTBRANCH" 2>/dev/null || { - DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)" - echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH" - } - v "git pull" - git pull - cd - >/dev/null #go back - fi - else - echo "You do not have access to $CUSTREPO" - fi - } - - if [ ! -d "$FILEDIR" ]; then - mkdir -p $FILEDIR - elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then - v "rm -rf $FILEDIR*" - rm -rf $FILEDIR* - fi - } - - get_subtarget_for_device() { - readonly target="$1" - readonly device="$2" - readonly targetinfo_file="tmp/info/.targetinfo-feeds_$target" - readonly target_profile_line="Target-Profile: DEVICE_$device" - # We want to know after which Target: $target/$subtarget line - # our $target_profile_line appears - # This is a crude way to "parse" the file using shell 🤯 - # 1. grep for both lines with line number output - # 2. grep again to determine the device profile line that we looked for - # but output one context line before as well to determine corresponding subtarget line - # 4. Use head and sed to extract the subtarget - grep "^Target: $target/\|^$target_profile_line" "$targetinfo_file" \ - | grep -E -B1 "^$target_profile_line" \ - | head -n1 \ - | sed -E "s|^Target: $target/||" - } - - create_and_copy_files() - { - local BOARDTYPE=$1 - shift - local CUSTOMERS=$@ - - # Validate seleced board and customers - set_target $BOARDTYPE - if [ $target == "bogus" ]; then - echo "Hardware profile does not exist" - exit 1 - elif [ -n "$CUSTOMERS" ]; then - for CUSTOMER in $CUSTOMERS; do - if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then - echo "Customer profile for '$CUSTOMER' does not exist" - exit 1 - elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then - echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'" - if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then - echo "Common profile configuration will be used" - else - exit 1 - fi - fi - done - fi - - # Generate base config - rm -f .config - v "Config $BOARDTYPE selected" - v "cp $CONFIGPATH/config .config" - cp $CONFIGPATH/config .config - - if [ -f $target_config_path/config ]; then - cat $target_config_path/config >> .config - echo "" >> .config - fi - if [ -f $target_config_path/$BOARDTYPE/config ]; then - cat $target_config_path/$BOARDTYPE/config >> .config - echo "" >> .config - fi - # hack to support custom-devices until we have deprecated this genconfig-script... - local custom_found=false - local used_config_file - - for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do - if [ "$custom_found" = "true" ]; then - echo - echo "Error was found!" - echo "Please use only one path." - echo "Two instances of $target/config/$BOARDTYPE exists:" - echo "Path 1: $used_config_file" - echo "Path 2: $config_file" - return 1 - fi - if [ -f "$config_file" ]; then - cat "$config_file" >> .config - echo "" >> .config - custom_found=true - used_config_file=$config_file - fi - done - - # Special handling for targets which use TARGET_DEVICES - case "$target" in - airoha | mediatek | brcmbca | ipq95xx | ipq53xx) - # This assumes the device name to be unique within one target, - # which is a fair assumption to make. - local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")" - if [ -z "$subtarget" ]; then - echo "Error determining subtarget for $target / ${BOARDTYPE}" - return 1 - fi - echo "CONFIG_TARGET_${target}=y" >> .config - echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config - echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config - echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config - echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config - ;; - *) - echo "CONFIG_TARGET_${target}=y" >> .config - echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config - ;; - esac - - echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE - - # Add customerconfig diff if a customer is selected - if [ -n "$CUSTOMERS" ]; then - for CUSTOMER in $CUSTOMERS; do - if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then - v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR" - cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR - fi - if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then - v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR" - cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR - fi - if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then - v "Apply $CUSTCONF/$CUSTOMER/common/common.diff" - cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config - echo "" >> .config - fi - if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then - v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" - cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config - echo "" >> .config - fi - done - fi - - # Set target version - local git_version - if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then - echo "ERROR: Failed getting version via git describe, exiting." >&2 - return 1 - fi - local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}" - local version_lower="${version,,}" - echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config - echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config - echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config - - # Enable Package source tree override if selected - [ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config - - # developer mode selected ? - echo "CONFIG_DEVEL=y" >>.config - if [ $DEVELOPER -eq 1 ]; then - # rewrite url to clone with ssh instead of http - echo "CONFIG_GITMIRROR_REWRITE=y" >>.config - else - echo "# CONFIG_GITMIRROR_REWRITE is not set" >>.config - fi - - if [ -n "$BRCM_MAX_JOBS" ] - then - echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config - fi - - # Force regeneration of kernel Makefile - # Needed to disable kmods for iopsys-brcm targets - touch package/kernel/linux/Makefile - - # we need to signal to bradcom SDK that we have changed the board id - # currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name - # so just touch that file. - [ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null - - # Store generated config - cp .config .genconfig.config - - # Set default values based on selected parameters - v "$(make defconfig 2>&1)" - - echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"') - - # Clean base-file package to force rebuild when changing profile - v "$(make package/base-files/clean 2>&1)" - - verify_config - } - - ####### main ##### - if [ ! -e tmp/.iop_bootstrap ]; then - echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration." - echo "Run: iop feeds_update" - exit 1 - fi - - if [ $# -eq 0 ]; then - echo Current profile: - cat $CURRENT_CONFIG_FILE - echo "Try ./iop genconfig-legacy -h' to get instructions if you want to change current config" - exit 0 - else - while [ -n "$1" ]; do - case "$1" in - - -c|--clean) export CLEAN=1;; - -D|--no-dirty) export DIRTY="";; - -n|--no-update) export IMPORT=0;; - -v|--verbose) export VERBOSE="$(($VERBOSE + 1))";; - -t|--target) export TARGET="$2"; shift;; - -p|--profile) export PROFILE="$2"; shift;; - -r|--repo) export CUSTREPO="$2"; shift;; - -s|--override) export SRCTREEOVERR=1;; - -S|--brcmsingel) export BRCM_MAX_JOBS=1;; - -h|--help) usage;; - -l|--list) list_customers 0 $2;; - -a|--list-all)list_customers 1;; - -b|--boards)set_target LIST;exit 0;; - -*) - echo "Invalid option: $1 " - echo "Try -h or --help for more information." - exit 1 - ;; - *) break;; - esac - shift; - done - - CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}" - - setup_dirs - create_and_copy_files "$@" || exit 1 - fi -} - -register_command "genconfig-legacy" "Generate configuration for board and customer - legacy mode" diff --git a/iop/scripts/genconfig_min-legacy.sh b/iop/scripts/genconfig_min-legacy.sh deleted file mode 100755 index cfec183d1..000000000 --- a/iop/scripts/genconfig_min-legacy.sh +++ /dev/null @@ -1,503 +0,0 @@ -#!/bin/bash - -function genconfig_min-legacy { - export CLEAN=0 - export DIRTY="--dirty" - export SRCTREEOVERR=0 - export FILEDIR="files/" - CURRENT_CONFIG_FILE=".current_config_file" - export CONFIGPATH="package/feeds/iopsys/iop" - CUSTPATH="customerconfigs" - export CUSTCONF="customerconfigs/customers" - export VERBOSE=0 - export DEVELOPER=0 - target="bogus" - target_config_path="" - brcmbca_feed="target/linux/feeds/brcmbca" - airoha_feed="target/linux/feeds/airoha" - x86_feed="target/linux/feeds/x86" - armsr_feed="target/linux/feeds/armsr" - mediatek_feed="target/linux/feeds/mediatek" - qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx" - qualcomm_ipq53xx_feed="target/linux/feeds/ipq53xx" - - Red='\033[0;31m' # Red - Color_Off='\033[0m' # Text Reset - Yellow='\033[0;33m' # Yellow - - function find_last { - egrep "^[ #]*${1}[ =]" $2 | tail -n1 - } - - function is_new { - for opt in $conf_warned - do - if [ "$opt" == "$1" ] - then - return 1 - fi - done - # option not found return true - return 0 - } - - function verify_config { - local conf_opt - local conf_org - local conf_new - - while read -r line - do - conf_opt=$(echo $line | grep "^[ #]*CONFIG_" | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|') - if [ -n "${conf_opt}" ] - then - conf_org=$(find_last ${conf_opt} .genconfig.config) - conf_new=$(find_last ${conf_opt} .config) - if [ "$conf_org" != "$conf_new" ] - then - if is_new $conf_opt - then - echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config" - echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]" - echo "This is a real problem somebody needs to investigate" - echo "" - conf_warned="$conf_warned $conf_opt" - fi - else - true - # for debug to see all options - #echo -e "wanted [$conf_org] got [$conf_new]" - fi - fi - done < .genconfig.config - } - - # Takes a board name and returns the target name in global var $target - set_target() { - local profile=$1 - - [ -n "$profile" ] || return - - if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then - local targetpath="./target/linux/feeds/$TARGET" - local profiles= - local pfound=0 - - if [ -e "$targetpath/genconfig" ]; then - profiles=$(cd $targetpath; ./genconfig) - - for p in $profiles; do - if [ $p == $profile ]; then - pfound=1 - break - fi - done - fi - - if [ $pfound -eq 1 ]; then - target="$(echo $TARGET | tr '-' '_')" - target_config_path="$targetpath/config" - fi - - return - fi - - [ -e $brcmbca_feed/genconfig ] && - brcmbca=$(cd $brcmbca_feed; ./genconfig) - [ -e $airoha_feed/genconfig ] && - airoha=$(cd $airoha_feed; ./genconfig) - [ -e $x86_feed/genconfig ] && - x86=$(cd $x86_feed; ./genconfig) - [ -e $armsr_feed/genconfig ] && - armsr=$(cd $armsr_feed; ./genconfig) - [ -e $mediatek_feed/genconfig ] && - mediatek=$(cd $mediatek_feed; ./genconfig) - [ -e $qualcomm_ipq95xx_feed/genconfig ] && - ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig) - [ -e $qualcomm_ipq53xx_feed/genconfig ] && - ipq53xx=$(cd $qualcomm_ipq53xx_feed; ./genconfig) - - if [ "$profile" == "LIST" ]; then - for list in brcmbca airoha x86 armsr mediatek ipq95xx ipq53xx; do - echo "$list based boards:" - a=$(echo "${!list}" | sort) - for b in $a; do - echo -e "\t$b" - done - done - return - fi - - for p in $airoha; do - if [ $p == $profile ]; then - target="airoha" - target_config_path="$airoha_feed/config" - return - fi - done - - for p in $x86; do - if [ $p == $profile ]; then - target="x86" - target_config_path="$x86_feed/config" - return - fi - done - - for p in $armsr; do - if [ $p == $profile ]; then - target="armsr" - target_config_path="$armsr_feed/config" - return - fi - done - - for p in $mediatek; do - if [ $p == $profile ]; then - target="mediatek" - target_config_path="$mediatek_feed/config" - return - fi - done - - for p in $ipq95xx; do - if [ $p == $profile ]; then - target="ipq95xx" - target_config_path="$qualcomm_ipq95xx_feed/config" - return - fi - done - - for p in $ipq53xx; do - if [ $p == $profile ]; then - target="ipq53xx" - target_config_path="$qualcomm_ipq53xx_feed/config" - return - fi - done - - for p in $brcmbca; do - if [ $p == $profile ]; then - target="brcmbca" - target_config_path="$brcmbca_feed/config" - return - fi - done - } - - git remote -v | grep -qE '(git@|ssh://)' && { - DEVELOPER=1 - } - - v() { - [ "$VERBOSE" -ge 1 ] && echo "$@" - } - - usage() { - echo - echo 1>&2 "Usage: $0 genconfig_min-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" - echo - echo -e " -c|--clean\t\tRemove all files under ./files and import from config " - echo -e " -D|--no-dirty\t\tIgnore dirty tree" - echo -e " -v|--verbose\t\tVerbose" - echo -e " -n|--no-update\tDo NOT! Update customer config before applying" - echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from" - echo -e " -s|--override\t\tEnable 'Package source tree override'" - echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread" - echo -e " -h|--help\t\tShow this message" - echo -e " -l|--list [customer]\tList all Customers or all boards for one customer" - echo -e " -a|--list-all\t\tList all Customers and their board types" - echo -e " -b|--boards\t\tList all board types" - echo - echo "Example ./iop genconfig_min-legacy eg400 OPERATORX" - echo "(if no customerconfig is chosen, iopsys config will be used)" - echo - exit 0 - } - - list_customers() - { - local ALL="$1" - local CUSTOMER="$2" - if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then - local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common )" - if [ "$boards" ]; then - echo "$CUSTOMER has following boards:" - for board in $boards; do - echo -e "\t$board" - done - else - echo "No boards found for $CUSTOMER" - fi - elif [ "$CUSTOMER" ]; then - echo "No customer called $CUSTOMER" - exit 1 - elif [ -d $CUSTCONF ]; then - local customers="$(ls -1 $CUSTCONF)" - if [ "$customers" -a "$ALL" == 1 ]; then - for customer in $customers; do - echo $customer - local boards="$(ls -1 $CUSTCONF/$customer | grep -v common )" - if [ "$boards" ]; then - for board in $boards; do - echo -e "\t$board" - done - else - echo "has no boards" - fi - done - elif [ "$customers" ]; then - echo -e "$customers" - else - echo "no customers found" - fi - else - echo "No $CUSTCONF folder found" - fi - exit 0 - } - - - generate_config() - { - DIFFFILE="$1" - MASTERFILE="$2" - while read p; do - v "$p" - sed -r -i "$p" $MASTERFILE - done < $DIFFFILE - } - - setup_dirs() - { - - if [ ! -d "$FILEDIR" ]; then - mkdir -p $FILEDIR - elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then - v "rm -rf $FILEDIR*" - rm -rf $FILEDIR* - fi - } - - get_subtarget_for_device() { - readonly target="$1" - readonly device="$2" - readonly targetinfo_file="tmp/info/.targetinfo-feeds_$target" - readonly target_profile_line="Target-Profile: DEVICE_$device" - # We want to know after which Target: $target/$subtarget line - # our $target_profile_line appears - # This is a crude way to "parse" the file using shell 🤯 - # 1. grep for both lines with line number output - # 2. grep again to determine the device profile line that we looked for - # but output one context line before as well to determine corresponding subtarget line - # 4. Use head and sed to extract the subtarget - grep "^Target: $target/\|^$target_profile_line" "$targetinfo_file" \ - | grep -E -B1 "^$target_profile_line" \ - | head -n1 \ - | sed -E "s|^Target: $target/||" - } - - create_and_copy_files() - { - local BOARDTYPE=$1 - shift - local CUSTOMERS=$@ - - # Validate seleced board and customers - set_target $BOARDTYPE - if [ $target == "bogus" ]; then - echo "Hardware profile does not exist" - exit 1 - elif [ -n "$CUSTOMERS" ]; then - for CUSTOMER in $CUSTOMERS; do - if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then - echo "Customer profile for '$CUSTOMER' does not exist" - exit 1 - elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then - echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'" - if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then - echo "Common profile configuration will be used" - else - exit 1 - fi - fi - done - fi - - # Generate base config - rm -f .config - v "Config $BOARDTYPE selected" - v "cp $CONFIGPATH/config .config" - cp $CONFIGPATH/config .config - - if [ -f $target_config_path/config ]; then - cat $target_config_path/config >> .config - echo "" >> .config - fi - if [ -f $target_config_path/$BOARDTYPE/config ]; then - cat $target_config_path/$BOARDTYPE/config >> .config - echo "" >> .config - fi - # hack to support custom-devices until we have deprecated this genconfig-script... - local custom_found=false - local used_config_file - - for config_file in feeds/*/devices/$target/config/$BOARDTYPE/config; do - if [ "$custom_found" = "true" ]; then - echo - echo "Error was found!" - echo "Please use only one path." - echo "Two instances of $target/config/$BOARDTYPE exists:" - echo "Path 1: $used_config_file" - echo "Path 2: $config_file" - return 1 - fi - if [ -f "$config_file" ]; then - cat "$config_file" >> .config - echo "" >> .config - custom_found=true - used_config_file=$config_file - fi - done - - # Special handling for targets which use TARGET_DEVICES - case "$target" in - airoha | mediatek | brcmbca | ipq95xx | ipq53xx) - # This assumes the device name to be unique within one target, - # which is a fair assumption to make. - local subtarget="$(get_subtarget_for_device "${target/_/-}" "$BOARDTYPE")" - if [ -z "$subtarget" ]; then - echo "Error determining subtarget for $target / ${BOARDTYPE}" - return 1 - fi - echo "CONFIG_TARGET_${target}=y" >> .config - echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config - echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config - echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config - echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config - ;; - *) - echo "CONFIG_TARGET_${target}=y" >> .config - echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config - ;; - esac - - echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE - - # Add customerconfig diff if a customer is selected - if [ -n "$CUSTOMERS" ]; then - for CUSTOMER in $CUSTOMERS; do - if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then - v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR" - cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR - fi - if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then - v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR" - cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR - fi - if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then - v "Apply $CUSTCONF/$CUSTOMER/common/common.diff" - cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config - echo "" >> .config - fi - if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then - v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" - cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config - echo "" >> .config - fi - done - fi - - # Set target version - local git_version - if ! git_version="$(git describe --always $DIRTY --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then - echo "ERROR: Failed getting version via git describe, exiting." >&2 - return 1 - fi - local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}" - local version_lower="${version,,}" - echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config - echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config - echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config - - # Enable Package source tree override if selected - [ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config - - # developer mode selected ? - echo "CONFIG_DEVEL=y" >>.config - - if [ -n "$BRCM_MAX_JOBS" ] - then - echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config - fi - - # Force regeneration of kernel Makefile - # Needed to disable kmods for iopsys-brcm targets - touch package/kernel/linux/Makefile - - # we need to signal to bradcom SDK that we have changed the board id - # currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name - # so just touch that file. - [ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null - - # Store generated config - cp .config .genconfig.config - - # Set default values based on selected parameters - v "$(make defconfig 2>&1)" - - echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"') - - # Clean base-file package to force rebuild when changing profile - v "$(make package/base-files/clean 2>&1)" - - verify_config - } - - ####### main ##### - if [ ! -e tmp/.iop_bootstrap ]; then - echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration." - echo "Run: iop feeds_update" - exit 1 - fi - - if [ $# -eq 0 ]; then - echo Current profile: - cat $CURRENT_CONFIG_FILE - echo "Try ./iop genconfig_min-legacy -h' to get instructions if you want to change current config" - exit 0 - else - while [ -n "$1" ]; do - case "$1" in - - -c|--clean) export CLEAN=1;; - -D|--no-dirty) export DIRTY="";; - -n|--no-update) export IMPORT=0;; - -v|--verbose) export VERBOSE="$(($VERBOSE + 1))";; - -t|--target) export TARGET="$2"; shift;; - -p|--profile) export PROFILE="$2"; shift;; - -r|--repo) export CUSTREPO="$2"; shift;; - -s|--override) export SRCTREEOVERR=1;; - -S|--brcmsingel) export BRCM_MAX_JOBS=1;; - -h|--help) usage;; - -l|--list) list_customers 0 $2;; - -a|--list-all)list_customers 1;; - -b|--boards)set_target LIST;exit 0;; - -*) - echo "Invalid option: $1 " - echo "Try -h or --help for more information." - exit 1 - ;; - *) break;; - esac - shift; - done - - CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}" - - setup_dirs - create_and_copy_files "$@" - fi -} - -register_command "genconfig_min-legacy" "Generate configuration for customer with manual board configuration - legacy mode"