Path: blob/master/arch/mips/tools/generic-board-config.sh
26424 views
#!/bin/sh1# SPDX-License-Identifier: GPL-2.0-or-later2#3# Copyright (C) 2017 Imagination Technologies4# Author: Paul Burton <[email protected]>5#6# This script merges configuration fragments for boards supported by the7# generic MIPS kernel. It checks each for requirements specified using8# formatted comments, and then calls merge_config.sh to merge those9# fragments which have no unmet requirements.10#11# An example of requirements in your board config fragment might be:12#13# # require CONFIG_CPU_MIPS32_R2=y14# # require CONFIG_CPU_LITTLE_ENDIAN=y15#16# This would mean that your board is only included in kernels which are17# configured for little endian MIPS32r2 CPUs, and not for example in kernels18# configured for 64 bit or big endian systems.19#2021srctree="$1"22objtree="$2"23ref_cfg="$3"24cfg="$4"25boards_origin="$5"26shift 52728# Only print Skipping... lines if the user explicitly specified BOARDS=. In the29# general case it only serves to obscure the useful output about what actually30# was included.31case ${boards_origin} in32"command line")33print_skipped=134;;35environment*)36print_skipped=137;;38*)39print_skipped=040;;41esac4243for board in $@; do44board_cfg="${srctree}/arch/mips/configs/generic/board-${board}.config"45if [ ! -f "${board_cfg}" ]; then46echo "WARNING: Board config '${board_cfg}' not found"47continue48fi4950# For each line beginning with # require, cut out the field following51# it & search for that in the reference config file. If the requirement52# is not found then the subshell will exit with code 1, and we'll53# continue on to the next board.54grep -E '^# require ' "${board_cfg}" | \55cut -d' ' -f 3- | \56while read req; do57case ${req} in58*=y)59# If we require something =y then we check that a line60# containing it is present in the reference config.61grep -Eq "^${req}\$" "${ref_cfg}" && continue62;;63*=n)64# If we require something =n then we just invert that65# check, considering the requirement met if there isn't66# a line containing the value =y in the reference67# config.68grep -Eq "^${req/%=n/=y}\$" "${ref_cfg}" || continue69;;70*)71echo "WARNING: Unhandled requirement '${req}'"72;;73esac7475[ ${print_skipped} -eq 1 ] && echo "Skipping ${board_cfg}"76exit 177done || continue7879# Merge this board config fragment into our final config file80${srctree}/scripts/kconfig/merge_config.sh \81-m -O ${objtree} ${cfg} ${board_cfg} \82| grep -Ev '^(#|Using)'83done848586