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

📄 menuconfig

📁 嵌入式试验箱S3C2410的bootloader源代码
💻
📖 第 1 页 / 共 2 页
字号:
		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		}		else if ($1 ~ /mainmenu_option|endmenu/) {			printf("") >>menu		} 		else if ($1 == "source") {			parser($2,menu)		}		else {			print >>menu		}	}}'}## Parse all the config.in files into mini scripts.#function parse_config_files () {	rm -f MCmenu*	echo "function MCmenu0 () {" >MCmenu0	echo 'default=$1' >>MCmenu0	echo "menu_name 'Main Menu'" >>MCmenu0	if [ "_$single_menu_mode" = "_TRUE" ]	then		parser2	else		parser1	fi	echo "comment ''"	>>MCmenu0	echo "g_alt_config" 	>>MCmenu0	echo "s_alt_config" 	>>MCmenu0	echo "}" >>MCmenu0	#	# These mini scripts must be sourced into the current	# environment in order for all of this to work.  Leaving	# them on the disk as executables screws up the recursion	# in activate_menu(), among other things.  Once they are	# sourced we can discard them.	#	for i in MCmenu*	do		echo -n "."		source ./$i	done	rm -f MCmenu*}## This is the menu tree's bootstrap.## Executes the parsed menus on demand and creates a set of functions,# one per configuration option.  These functions will in turn execute# dialog commands or recursively call other menus.#function activate_menu () {	rm -f lxdialog.scrltmp	while true	do		comment_ctr=0		#So comment lines get unique tags		$1 "$default" 2> MCerror #Create the lxdialog menu & functions		if [ "$?" != "0" ]		then			clear			cat <<EOMMenuconfig has encountered a possible error in one of the kernel'sconfiguration files and is unable to continue.  Here is the errorreport:EOM			sed 's/^/ Q> /' MCerror			cat <<EOMPlease report this to the maintainer <mec@shout.net>.  You may alsosend a problem report to <linux-kernel@vger.kernel.org>.Please indicate the kernel version you are trying to configure andwhich menu you were trying to enter when this error occurred.EOM			cleanup			exit 1		fi		rm -f MCerror		. ./MCradiolists		#Source the menu's functions		. ./MCmenu 2>MCdialog.out	#Activate the lxdialog menu		ret=$?		read selection <MCdialog.out		case "$ret" in		0|3|4|5|6)			defaults="$selection$defaults"  #pseudo stack			case "$ret" in			0) eval $selection   ;;			3) eval $selection y ;;			4) eval $selection n ;;			5) eval $selection m ;;			6) eval $selection c ;;			esac			default="${defaults%%*}" defaults="${defaults#*}"			;;		2)				default="${selection%%\ *}"			case "$selection" in			*"-->"*|*"alt_config"*)				show_readme ;;			*)				eval help $selection ;;			esac			;;		255|1)			break			;;		139)			stty sane			clear			cat <<EOMThere seems to be a problem with the lxdialog companion utility which isbuilt prior to running Menuconfig.  Usually this is an indicator that youhave upgraded/downgraded your ncurses libraries and did not remove the old ncurses header file(s) in /usr/include or /usr/include/ncurses.It is VERY important that you have only one set of ncurses header filesand that those files are properly version matched to the ncurses libraries installed on your machine.You may also need to rebuild lxdialog.  This can be done by moving tothe /usr/src/linux/scripts/lxdialog directory and issuing the "make clean all" command.If you have verified that your ncurses install is correct, you may emailthe maintainer <mec@shout.net> or post a message to<linux-kernel@vger.kernel.org> for additional assistance. EOM			cleanup			exit 139			;;		esac	done}## Create a menu item to load an alternate configuration file.#g_alt_config () {	echo -n "get_alt_config 'Load an Alternate Configuration File' "\		>>MCmenu}## Get alternate config file name and load the # configuration from it.#get_alt_config () {	set -f ## Switch file expansion OFF	while true	do		ALT_CONFIG="${ALT_CONFIG:-$DEFAULTS}"		$DIALOG --backtitle "$backtitle" \			--inputbox "\Enter the name of the configuration file you wish to load.  \Accept the name shown to restore the configuration you \last retrieved.  Leave blank to abort."\			11 55 "$ALT_CONFIG" 2>MCdialog.out		if [ "$?" = "0" ]		then			ALT_CONFIG=`cat MCdialog.out`			[ "_" = "_$ALT_CONFIG" ] && break			if eval [ -r "$ALT_CONFIG" ]			then				eval load_config_file "$ALT_CONFIG"				break			else				echo -ne "\007"				$DIALOG	--backtitle "$backtitle" \					--infobox "File does not exist!"  3 38				sleep 2			fi		else			cat <<EOM >help.outFor various reasons, one may wish to keep several different kernelconfigurations available on a single machine.  If you have saved a previous configuration in a file other than thekernel's default, entering the name of the file here will allow youto modify that configuration.If you are uncertain, then you have probably never used alternate configuration files.  You should therefor leave this blank to abort.EOM			$DIALOG	--backtitle "$backtitle"\				--title "Load Alternate Configuration"\				--textbox help.out $ROWS $COLS		fi	done	set +f ## Switch file expansion ON	rm -f help.out MCdialog.out}## Create a menu item to store an alternate config file.#s_alt_config () {	echo -n "save_alt_config 'Save Configuration to an Alternate File' "\		 >>MCmenu}## Get an alternate config file name and save the current# configuration to it.#save_alt_config () {	set -f  ## Switch file expansion OFF				while true	do		$DIALOG --backtitle "$backtitle" \			--inputbox "\Enter a filename to which this configuration should be saved \as an alternate.  Leave blank to abort."\			10 55 "$ALT_CONFIG" 2>MCdialog.out		if [ "$?" = "0" ]		then			ALT_CONFIG=`cat MCdialog.out`			[ "_" = "_$ALT_CONFIG" ] && break			if eval touch $ALT_CONFIG 2>/dev/null			then				eval save_configuration $ALT_CONFIG				load_functions  ## RELOAD				break			else				echo -ne "\007"				$DIALOG	--backtitle "$backtitle" \					--infobox "Can't create file!  Probably a nonexistent directory." 3 60				sleep 2			fi		else			cat <<EOM >help.outFor various reasons, one may wish to keep different kernelconfigurations available on a single machine.  Entering a file name here will allow you to later retrieve, modifyand use the current configuration as an alternate to whatever configuration options you have selected at that time.If you are uncertain what all this means then you should probablyleave this blank.EOM			$DIALOG	--backtitle "$backtitle"\				--title "Save Alternate Configuration"\				--textbox help.out $ROWS $COLS		fi	done	set +f  ## Switch file expansion ON	rm -f help.out MCdialog.out}## Load config options from a file.# Converts all "# OPTION is not set" lines to "OPTION=n" lines#function load_config_file () {	awk '	  /# .* is not set.*/ { printf("%s=n\n", $2) }	! /# .* is not set.*/ { print }	' $1 >.tmpconfig	source ./.tmpconfig	rm -f .tmpconfig}## Just what it says.#save_configuration () {        echo	echo -n "Saving your kernel configuration."	#	# Now, let's redefine the configuration functions for final	# output to the config files.	#	# Nested function definitions, YIPEE!	#	function bool () {		set_x_info "$2" "n"		eval define_bool "$2" "$x"	}	function tristate () {		set_x_info "$2" "n"		eval define_tristate "$2" "$x"	}	function dep_tristate () {		set_x_info "$2" "n"		var="$2"		shift 2		while [ $# -gt 0 ]; do			if   [ "$1" = y ]; then				shift			elif [ "$1" = m -a "$x" != n ]; then				x=m; shift			else 				x=n; shift $#			fi		done		define_tristate "$var" "$x"	}	function dep_bool () {		set_x_info "$2" "n"		var="$2"		shift 2		while [ $# -gt 0 ]; do			if   [ "$1" = y ]; then				shift			else 				x=n; shift $#			fi		done		define_bool "$var" "$x"	}	function dep_mbool () {		set_x_info "$2" "n"		var="$2"		shift 2		while [ $# -gt 0 ]; do			if   [ "$1" = y -o "$1" = m ]; then				shift			else 				x=n; shift $#			fi		done		define_bool "$var" "$x"	}	function int () {		set_x_info "$2" "$3"		echo "$2=$x" 		>>$CONFIG		echo "#define $2 ($x)"	>>$CONFIG_H	}	function hex () {		set_x_info "$2" "$3"		echo "$2=$x" 			 >>$CONFIG		echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H	}	function string () {		set_x_info "$2" "$3"		echo "$2=\"$x\"" 			 >>$CONFIG		echo "#define $2 \"$x\""	>>$CONFIG_H	}	function define_hex () {		eval $1="$2"               	echo "$1=$2"			>>$CONFIG		echo "#define $1 0x${2##*[x,X]}"	>>$CONFIG_H	}	function define_int () {		eval $1="$2"		echo "$1=$2" 			>>$CONFIG		echo "#define $1 ($2)"		>>$CONFIG_H	}	function define_string () {		eval $1="$2"		echo "$1=\"$2\""		>>$CONFIG		echo "#define $1 \"$2\""	>>$CONFIG_H	}	function define_bool () {		define_tristate "$1" "$2"	}	function define_tristate () {		eval $1="$2"   		case "$2" in         	y)                	echo "$1=y" 		>>$CONFIG                	echo "#define $1 1"	>>$CONFIG_H                	;;         	m)			if [ "$CONFIG_MODULES" = "y" ]			then                		echo "$1=m"		   >>$CONFIG                		echo "#undef  $1"	   >>$CONFIG_H                		echo "#define $1_MODULE 1" >>$CONFIG_H			else                		echo "$1=y" 		>>$CONFIG                		echo "#define $1 1"	>>$CONFIG_H			fi                	;;         	n)			echo "# $1 is not set"	>>$CONFIG                	echo "#undef  $1"	>>$CONFIG_H                	;;        	esac	}	function choice () {		#		# Find the first choice that's already set to 'y'		#		choices="$2"		default="$3"		current=		chosen=		set -- $choices		while [ -n "$2" ]		do			if eval [ "_\$$2" = "_y" ]			then				current=$1				break			fi			shift ; shift		done		#		# Use the default if none were set.  		#		: ${current:=$default}		#		# Output all choices (to be compatible with other configs).		#		set -- $choices		while [ -n "$2" ]		do			case "$1" in			"$current"*)	if [ -z "$chosen" ]; then						define_bool "$2" "y"						chosen=1					else						define_bool "$2" "n"					fi ;;			*)		define_bool "$2" "n" ;;			esac			shift ; shift		done	}	function mainmenu_name () {		:	}	function mainmenu_option () {		comment_is_option=TRUE	}	function endmenu () {		:	}	function comment () {		if [ "$comment_is_option" ]		then			comment_is_option=			echo        >>$CONFIG			echo "#"    >>$CONFIG			echo "# $1" >>$CONFIG			echo "#"    >>$CONFIG			echo         >>$CONFIG_H			echo "/*"    >>$CONFIG_H			echo " * $1" >>$CONFIG_H			echo " */"   >>$CONFIG_H		fi	}	echo -n "."	DEF_CONFIG="${1:-.config}"	DEF_CONFIG_H="include/autoconf.h"	CONFIG=.tmpconfig	CONFIG_H=.tmpconfig.h	echo "#" >$CONFIG	echo "# Automatically generated by make menuconfig: don't edit" >>$CONFIG	echo "#" >>$CONFIG	echo "/*" >$CONFIG_H	echo " * Automatically generated by make menuconfig: don't edit" >>$CONFIG_H	echo " */" >>$CONFIG_H	echo "#define AUTOCONF_INCLUDED" >> $CONFIG_H	echo -n "."	if . $CONFIG_IN >>.menuconfig.log 2>&1	then		if [ "$DEF_CONFIG" = ".config" ]		then			mv $CONFIG_H $DEF_CONFIG_H		fi		if [ -f "$DEF_CONFIG" ]		then			rm -f ${DEF_CONFIG}.old			mv $DEF_CONFIG ${DEF_CONFIG}.old		fi		mv $CONFIG $DEF_CONFIG					return 0	else		return 1	fi}## Remove temporary files#cleanup () {	cleanup1	cleanup2}cleanup1 () {	rm -f MCmenu* MCradiolists MCdialog.out help.out}cleanup2 () {	rm -f .tmpconfig .tmpconfig.h}set_geometry () {	# Some distributions export these with incorrect values	# which can really screw up some ncurses programs.	LINES=  COLUMNS=	ROWS=${1:-24}  COLS=${2:-80} 	# Just in case the nasty rlogin bug returns.	#	[ $ROWS = 0 ] && ROWS=24	[ $COLS = 0 ] && COLS=80	if [ $ROWS -lt 19 -o $COLS -lt 80 ]	then		echo -e "\n\007Your display is too small to run Menuconfig!"		echo "It must be at least 19 lines by 80 columns."		exit 1	fi 	ROWS=$((ROWS-4))  COLS=$((COLS-5))}set_geometry `stty size 2>/dev/null`menu_instructions="\Arrow keys navigate the menu.  \<Enter> selects submenus --->.  \Highlighted letters are hotkeys.  \Pressing <Y> includes, <N> excludes.  \Press <Esc><Esc> to exit, <?> for Help.\n  \Legend: [*] built-in, [ ] excluded"radiolist_instructions="\Use the arrow keys to navigate this window or \press the hotkey of the item you wish to select \followed by the <SPACE BAR>.Press <?> for additional information about this option."inputbox_instructions_int="\Please enter a decimal value. \Fractions will not be accepted.  \Use the <TAB> key to move from the input field to the buttons below it."inputbox_instructions_hex="\Please enter a hexadecimal value. \Use the <TAB> key to move from the input field to the buttons below it."inputbox_instructions_string="\Please enter a string value. \Use the <TAB> key to move from the input field to the buttons below it."DIALOG="./scripts/lxdialog/lxdialog"kernel_version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"backtitle="VIVI v$kernel_version Configuration"trap "cleanup ; exit 1" 1 2 15## Locate default files.#CONFIG_IN=./config.inif [ "$1" != "" ] ; then	CONFIG_IN=$1fiDEFAULTS=arch/defconfigif [ -f .config ]; then  DEFAULTS=.configfiif [ -f $DEFAULTS ]then  echo "Using defaults found in" $DEFAULTS  load_config_file $DEFAULTSelse  echo "No defaults found"fi# Fresh new log.>.menuconfig.log# Load the functions used by the config.in files.echo -n "Preparing scripts: functions" load_functionsif [ ! -e $CONFIG_IN ]then	echo "Your main config.in file ($CONFIG_IN) does not exist"	exit 1fiif [ ! -x $DIALOG ]then	echo "Your lxdialog utility does not exist"	exit 1fi## Read config.in files and parse them into one shell function per menu.#echo -n ", parsing"parse_config_files $CONFIG_INecho "done."## Start the ball rolling from the top.#activate_menu MCmenu0## All done!#cleanup1## Confirm and Save#if $DIALOG --backtitle "$backtitle" \	   --yesno "Do you wish to save your new kernel configuration?" 5 60then	save_configuration	echo	echo	echo "*** End of VIVI configuration."	echo "*** Check the top-level Makefile for additional configuration."	echo "*** Next, you must run 'make'."	echoelse	echo    	echo 	echo Your kernel configuration changes were NOT saved.	echofi# Remove log if empty.if [ ! -s .menuconfig.log ] ; then	rm -f .menuconfig.logfiexit 0

⌨️ 快捷键说明

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