#! /bin/sh ############################################################################# # # Generate the vendor/product menu entries for the top level config # # davidm@snapgear.com # ############################################################################# fix_name() { echo $1 | tr '[\-\.\/\+a-z]' '[____A-Z]' } ############################################################################# # # the header of the config # echo "mainmenu_name 'DSLinux Configuration'" ############################################################################# # # Figure out the vendor/products dynamically, allows people to add there # own without messin with the config.in file # echo "mainmenu_option next_comment" echo "comment 'DSLinux build type selection'" #echo "comment 'Select the Vendor you wish to target'" #echo -n "choice 'Vendor' \"" # #oldv= #find vendors -name config.arch -print | sed -e 's?/? ?g' | \ # sort | while read t1 v p t2 #do # [ "$v" = "config" ] && continue # [ "$v" = "$oldv" ] && continue # echo "${v} CONFIG_DEFAULTS_`fix_name ${v}` \\" # oldv=$v #done #echo "\" SnapGear" #echo "endmenu" # echo "mainmenu_option next_comment" # echo "comment 'Product Selection'" echo "comment 'To pick a build, move the cursor all the way down to the'" echo "comment 'selection menu and press return.'" echo "comment 'See the help menu inside the selection menu if you'" echo "comment 'are not sure what type of build you want.'" # Make sure the build choice menu shows up... echo "define_bool CONFIG_DEFAULTS_NINTENDO y" oldv= def= find vendors -name config.arch -print | sed -e 's?/? ?g' | \ (sort; echo "END END END END") | while read t1 v p t2 do [ "$v" = "config" ] && continue if [ "$v" != "$oldv" ] then [ "$def" -o "$v" = END ] && echo "\" $def" [ "$def" -o "$v" = END ] && echo "fi" [ "$v" = END ] && break echo "if [ \"\$CONFIG_DEFAULTS_`fix_name ${v}`\" = \"y\" ]; then" echo -n "choice '' \"" def="${p}" fi if [ -f "vendors/$v/$p/config.languages" ] then for i in `cat "vendors/$v/$p/config.languages"` do [ "$def" = "${p}" ] && def="${p}\\($i\\)" echo "${p}($i) CONFIG_DEFAULTS_`fix_name ${v}`_`fix_name ${p}`_`fix_name ${i}` \\" done else echo "${p} CONFIG_DEFAULTS_`fix_name ${v}`_`fix_name ${p}` \\" fi oldv=$v done echo "bool 'Compile a release build' CONFIG_DEFAULTS_RELEASE_BUILD" echo "endmenu" ############################################################################# echo "mainmenu_option next_comment" echo "comment 'Kernel/Library/Defaults Selection'" # # Which kernel do they want, if only one then just set it, I don't # expect an explosion of kernels just yet ;-) # KERNELS="`ls -d linux-* 2>/dev/null`" NKERNELS="`echo ${KERNELS} | wc -w`" if [ ${NKERNELS} -gt 1 ]; then echo -n "choice 'Kernel Version' \"" for i in ${KERNELS}; do VER=${i##linux-} CFG="CONFIG_DEFAULTS_KERNEL_`echo ${VER%%.x}|sed -e 's/[-\.]/_/g'`" DEF="linux-${VER}" echo "${DEF} ${CFG} \\" done echo "\" $DEF" elif [ ${NKERNELS} -eq 1 ]; then VER=${KERNELS##linux-} CFG="CONFIG_DEFAULTS_KERNEL_`echo ${VER%%.x}|sed -e 's/[-\.]/_/g'`" echo "comment 'Kernel is linux-${VER}'" echo "define_bool ${CFG} y" else echo "ERROR: you have no kernels available in this directory." >&2 exit 1 fi ############################################################################# # # Which libc do they want, if only one then just set it, I don't # expect an explosion of libc's just yet ;-) # LIBCS="None `ls -d lib/libc uClibc uClibc-* glibc glibc-* 2>/dev/null`" NLIBCS="`echo ${LIBCS} | wc -w`" if [ ${NLIBCS} -gt 1 ]; then echo -n "choice 'Libc Version' \"" for i in ${LIBCS}; do [ "$i" = "lib/libc" ] && i=uC-libc CFG="CONFIG_DEFAULTS_LIBC_`fix_name ${i}`" DEF="${i}" echo "${DEF} ${CFG} \\" done echo "\" $DEF" elif [ ${NLIBCS} -eq 1 ]; then [ "$LIBCS" = "lib/libc" ] && LIBCS=uC-libc CFG="CONFIG_DEFAULTS_LIBC_`fix_name ${LIBCS}`" echo "comment 'Libc is ${LIBCS}'" echo "define_bool ${CFG} y" else echo "ERROR: you have no libc available in this directory." >&2 exit 1 fi # echo "endmenu" ############################################################################# # # the rest of the config # # echo "mainmenu_option next_comment" # echo "comment 'Configuration Overrides'" cat <