akaros/scripts/make_kconfig_info.sh
<<
>>
Prefs
   1#!/bin/bash
   2# Barret Rhoden <brho@cs.berkeley.edu>
   3# Builds a giant string of Kconfig options
   4
   5if [ $# -ne 2 ]
   6then
   7        echo "Need your .config and output file args!"
   8        exit -1
   9fi
  10
  11CONFIG_FILE=$1
  12KCONFIG_C=$2
  13
  14echo "// This was automatically generated with $0, do not edit" > $KCONFIG_C
  15
  16# Here's the guts of it.  Ignore the comments, ignore the empty lines, replace
  17# all " with \" (since we're making a string), and print a record at a time.
  18# It'll look like "CONFIG_foo\nCONFIG_bar\n".
  19
  20echo -n "const char *__kconfig_str = \"" >> $KCONFIG_C
  21
  22grep -v '^#' $CONFIG_FILE | grep -v '^$' \
  23                          | sed 's/"/\\"/g' \
  24                          | awk '{printf "%s\\n", $1}' \
  25                          >> $KCONFIG_C
  26echo "\";" >> $KCONFIG_C
  27