⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menuconfig

📁 skyeye for pxa270
💻
📖 第 1 页 / 共 2 页
字号:
#! /bin/sh## This script is used to configure the SkyEye library.# Borrowed from linux kernel configuration scripts.## This script attempts to parse the configuration files, which are# scattered throughout the source tree, and creates a temporary# set of mini scripts which are in turn used to create nested menus and# radiolists.## It uses a very modified/mutilated version of the "dialog" utility# written by Savio Lam (lam836@cs.cuhk.hk). Savio is not responsible# for this script or the version of dialog used by this script.# Please do not contact him with questions. The official version of # dialog is available at sunsite.unc.edu or a sunsite mirror.### Change this to TRUE if you prefer all configure options listed# in a single menu rather than the standard menu hierarchy.#single_menu_mode=## Make sure we're really running bash.#[ -z "$BASH" ] && { echo "Menuconfig requires bash" 1>&2; exit 1; }## Cache function definitions, turn off posix compliance#set -h +o posix# Given a configuration variable, set the global variable $x to its value,# and the global variable $info to the string " (NEW)" if this is a new# variable.## This function looks for: (1) the current value, or (2) the default value# from the arch-dependent defconfig file, or (3) a default passed by the caller.function set_x_info () {    eval x=\$$1    if [ -z "$x" ]; then	eval `sed -n -e 's/# \(.*\) is not set.*/\1=n/' -e "/^$1=/p" arch/$ARCH/defconfig`	eval x=\${$1:-\"$2\"}	eval $1=$x	#eval INFO_$1="' (NEW)'"    fi    eval info=\"\$INFO_$1\"}## Load the functions used by the config.in files.## I do this because these functions must be redefined depending# on whether they are being called for interactive use or for# saving a configuration to a file.## Thank the heavens bash supports nesting function definitions.#load_functions () {## Additional comments#function comment () {	comment_ctr=$[ comment_ctr + 1 ]	echo -ne "': $comment_ctr' '--- $1' " >>MCmenu}## Define a boolean to a specific value.#function define_bool () {	eval $1=$2}function define_tristate () {	eval $1=$2}function define_hex () {	eval $1=$2}function define_int () {	eval $1=$2}function define_string () {	eval $1=\"$2\"}function define_mystring () {	eval $1=$2}function define_mystring_null () {	eval $1=$2}## Create a boolean (Yes/No) function for our current menu# which calls our local bool function.#function bool () {	set_x_info "$2" "n"	case $x in	y|m)	flag="*" ;;	n)	flag=" " ;;	esac	echo -ne "'$2' '[$flag] $1$info' " >>MCmenu	echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists}## Create a tristate (Yes/No/Module) radiolist function# which calls our local tristate function.## Collapses to a boolean (Yes/No) if module support is disabled.#function tristate () {	if [ "$CONFIG_MODULES" != "y" ]	then		bool "$1" "$2"	else		set_x_info "$2" "n"			case $x in		y) flag="*" ;;		m) flag="M" ;;		*) flag=" " ;;		esac			echo -ne "'$2' '<$flag> $1$info' " >>MCmenu			echo -e "		function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists	fi}## Create a tristate radiolist function which is dependent on# another SkyEye configuration option.## Quote from the original configure script:##function dep_tristate () {	ques="$1"	var="$2"	dep=y	shift 2	while [ $# -gt 0 ]; do		if   [ "$1" = y ]; then			shift		elif [ "$1" = m ]; then			dep=m			shift		else			dep=n			shift $#		fi	done	if [ "$dep" = y ]; then	    tristate "$ques" "$var"	elif [ "$dep" = m ]; then	    mod_bool "$ques" "$var"	else 	    define_tristate "$var" n	fi}##   Same as above, but now only Y and N are allowed as dependency#   (i.e. third and next arguments).#function dep_bool () {	ques="$1"	var="$2"	dep=y	shift 2	while [ $# -gt 0 ]; do		if [ "$1" = y ]; then			shift		else			dep=n			shift $#		fi	done	if [ "$dep" = y ]; then	    bool "$ques" "$var"	else 	    define_bool "$var" n	fi}function dep_mbool () {	ques="$1"	var="$2"	dep=y	shift 2	while [ $# -gt 0 ]; do		if [ "$1" = y -o "$1" = m ]; then			shift		else			dep=n			shift $#		fi	done	if [ "$dep" = y ]; then	    bool "$ques" "$var"	else 	    define_bool "$var" n	fi}## Add a menu item which will call our local int function.# function int () {	set_x_info "$2" "$3"	echo -ne "'$2' '($x) $1$info' " >>MCmenu	echo -e "function $2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists}## Add a menu item which will call our local hex function.# function hex () {	set_x_info "$2" "$3"	x=${x##*[x,X]}	echo -ne "'$2' '($x) $1$info' " >>MCmenu	echo -e "function $2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists}## Add a menu item which will call our local string function.# function string () {	set_x_info "$2" "$3"	echo -ne "'$2' '     $1: \"$x\"$info' " >>MCmenu	echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists}function mystring () {	set_x_info "$2" "$3"	echo -ne "'$2' '     $1: \"$x\"$info' " >>MCmenu	echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists}## Add a menu item which will call our local One-of-Many choice list.#function choice () {	#	# Need to remember params cause they're gonna get reset.	#	title=$1	choices=$2	default=$3	current=	#	# Find out if one of the choices is already set.	# If it's not then make it the default.	#	set -- $choices	firstchoice=$2	while [ -n "$2" ]	do		if eval [ \"_\$$2\" = \"_y\" ]		then			current=$1			break		fi		shift ; shift	done	: ${current:=$default}	echo -ne "'$firstchoice' '($current) $title' " >>MCmenu	echo -e "	function $firstchoice () \		{ l_choice '$title' \"$choices\" \"$current\" ;}" >>MCradiolists}} # END load_functions()function configure_help () {  if [ "$CONFIG_HELP_CHN" = "y" ]; then    CONFIGURE_HELPFILE=configs/Configure-zh.help  else    CONFIGURE_HELPFILE=configs/Configure.help  fi}## Extract available help for an option from Configure.help# and send it to standard output.## Most of this function was borrowed from the original kernel# Configure script.#function extract_help () {  configure_help  if [ -f $CONFIGURE_HELPFILE ]  then     #first escape regexp special characters in the argument:     var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g')     #now pick out the right help text:     text=$(sed -n "/^$var[ 	]*\$/,\${                        /^$var[ 	]*\$/c\\${var}:\\                        /^#/b                        /^[^ 	]/q                        s/^  //			/<file:\\([^>]*\\)>/s//\\1/g                        p                    }" $CONFIGURE_HELPFILE )     if [ -z "$text" ]     then          echo "There is no help available for this SkyEye configure option."	  return 1     else	  echo "$text"     fi  else	 echo "There is no help available for this SkyEye configure option."         return 1  fi}## Activate a help dialog.#function help () {	if extract_help $1 >help.out	then		$DIALOG	--backtitle "$backtitle" --title "$2"\			--textbox help.out $ROWS $COLS	else		$DIALOG	--backtitle "$backtitle" \			--textbox help.out $ROWS $COLS	fi	rm -f help.out}## Show the README file.#function show_readme () {	$DIALOG --backtitle "$backtitle" \		--textbox scripts/README.Menuconfig $ROWS $COLS}## Begin building the dialog menu command and Initialize the # Radiolist function file.#function menu_name () {	echo -ne "$DIALOG --title '$1'\			--backtitle '$backtitle' \			--menu '$menu_instructions' \			$ROWS $COLS $((ROWS-10)) \			'$default' " >MCmenu	>MCradiolists}## Add a submenu option to the menu currently under construction.#function submenu () {	echo -ne "'activate_menu $2' '$1  --->' " >>MCmenu}## Handle a boolean (Yes/No) option.#function l_bool () {	if [ -n "$2" ]	then		case "$2" in		y|m)	eval $1=y ;;		c)	eval x=\$$1		   	case $x in		   	y) eval $1=n ;;		   	n) eval $1=y ;;			*) eval $1=y ;;		   	esac ;;		*)	eval $1=n ;;		esac	else		echo -ne "\007"	fi}## Same as bool() except options are (Module/No)#function mod_bool () {	if [ "$CONFIG_MODULES" != "y" ]; then	    define_bool "$2" "n"	else	    set_x_info "$2" "n" 	    case $x in	    y|m) flag='M' ;;	    *)   flag=' ' ;;	    esac 	    echo -ne "'$2' '<$flag> $1$info' " >>MCmenu 	    echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists	fi}## Same as l_bool() except options are (Module/No)#function l_mod_bool() {	if [ -n "$2" ]	then		case "$2" in		y)	echo -en "\007"			${DIALOG} --backtitle "$backtitle" \				  --infobox "\This feature depends on another which has been configured as a module.  \As a result, this feature will be built as a module." 4 70			sleep 5			eval $1=m ;;		m)	eval $1=m ;;		c)	eval x=\$$1			case $x in			m) eval $1=n ;;			n) eval $1=m ;;			*) eval $1=m ;;			esac ;;		*)	eval $1=n ;;		esac	else		echo -ne "\007"	fi}## Handle a tristate (Yes/No/Module) option.#function l_tristate () {	if [ -n "$2" ]	then		eval x=\$$1		case "$2" in		y) eval $1=y ;;		m) eval $1=m ;;		c) eval x=\$$1		   case $x in		   y) eval $1=n ;;		   n) eval $1=m ;;		   m) eval $1=y ;;		   *) eval $1=y ;;		   esac ;;		*) eval $1=n ;;		esac	else		echo -ne "\007"	fi}## Create a dialog for entering an integer into a option.#function l_int () {	while true	do		if $DIALOG --title "$1" \			--backtitle "$backtitle" \			--inputbox "$inputbox_instructions_int" \			10 75 "$4" 2>MCdialog.out		then			answer="`cat MCdialog.out`"			answer="${answer:-$3}"			# Semantics of + and ? in GNU expr changed, so			# we avoid them:			if expr "$answer" : '0$' '|' "$answer" : '[1-9][0-9]*$' '|' "$answer" : '-[1-9][0-9]*$' >/dev/null			then				eval $2=\"$answer\"			else				eval $2=\"$3\"				echo -en "\007"				${DIALOG} --backtitle "$backtitle" \					--infobox "You have made an invalid entry." 3 43				sleep 2			fi			break		fi		help "$2" "$1"	done}## Create a dialog for entering a hexadecimal into a option.#function l_hex () {	while true	do		if $DIALOG --title "$1" \			--backtitle "$backtitle" \			--inputbox "$inputbox_instructions_hex" \			10 75 "$4" 2>MCdialog.out		then			answer="`cat MCdialog.out`"			answer="${answer:-$3}"			answer="${answer##*[x,X]}"			if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null			then				eval $2=\"$answer\"			else				eval $2=\"$3\"				echo -en "\007"				${DIALOG} --backtitle "$backtitle" \					--infobox "You have made an invalid entry." 3 43				sleep 2			fi			break		fi		help "$2" "$1"	done}## Create a dialog for entering a string into a option.#function l_string () {	while true	do		if $DIALOG --title "$1" \			--backtitle "$backtitle" \			--inputbox "$inputbox_instructions_string" \			10 75 "$4" 2>MCdialog.out		then			answer="`cat MCdialog.out`"			answer="${answer:-$3}"			#			# Someone may add a nice check for the entered			# string here...			#			eval $2=\"$answer\"			break		fi		help "$2" "$1"	done}## Handle a one-of-many choice list.#function l_choice () {	#	# Need to remember params cause they're gonna get reset.	#	title="$1"	choices="$2"	current="$3"        chosen=	#	# Scan current value of choices and set radiolist switches.	#	list=	set -- $choices	firstchoice=$2	while [ -n "$2" ]	do		case "$1" in		"$current"*)	if [ -z "$chosen" ]; then					list="$list $2 $1 ON "					chosen=1				else					list="$list $2 $1 OFF "				fi  ;;		*)		list="$list $2 $1 OFF " ;;		esac					shift ; shift	done	while true	do		if $DIALOG --title "$title" \			--backtitle "$backtitle" \			--radiolist "$radiolist_instructions" \			15 70 6 $list 2>MCdialog.out		then			choice=`cat MCdialog.out`			break		fi		help "$firstchoice" "$title"	done	#	# Now set the boolean value of each option based on	# the selection made from the radiolist.	#	set -- $choices	while [ -n "$2" ]	do		if [ "$2" = "$choice" ]		then			eval $2=\"y\"		else			eval $2=\"n\"		fi				shift ; shift	done}## Call awk, and watch for error codes, etc.#function callawk () {awk "$1" || { echo "Awk died with error code $?. Giving up."; exit 1; }}## A faster awk based recursive parser. (I hope)#function parser1 () {callawk 'BEGIN {	menu_no = 0	comment_is_option = 0	parser("'$CONFIG_IN'","MCmenu0")}function parser(ifile,menu) {	while (getline <ifile) {		if ($1 == "mainmenu_option") {			comment_is_option = "1"		}		else if ($1 == "comment" && comment_is_option == "1") {			comment_is_option= "0"			sub($1,"",$0)			++menu_no			printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu			newmenu = sprintf("MCmenu%d", menu_no);			printf( "function MCmenu%s () {\n"\				"default=$1\n"\				"menu_name %s\n",\				 menu_no, $0) >newmenu			parser(ifile, newmenu)		}		else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {			printf("") >>menu		}		else if ($1 ~ "endmenu") {			printf("}\n") >>menu			return		} 		else if ($1 == "source") {			parser($2,menu)		}		else {			print >>menu		}	}}'}## Secondary parser for single menu mode.#function parser2 () {callawk 'BEGIN {	parser("'$CONFIG_IN'","MCmenu0")}function parser(ifile,menu) {	while (getline <ifile) {		if ($0 ~ /^#|$MAKE|mainmenu_name/) {			printf("") >>menu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -