mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexander \"ghostrile\" Bierbrauer" <abierbrauer@gmx.org>
To: linux-kernel@vger.kernel.org
Subject: reading the kernel configuration using libkconfig.so
Date: Tue, 13 Jul 2004 23:10:07 +0200	[thread overview]
Message-ID: <200407132310.07170.abierbrauer@gmx.org> (raw)

Hey there,

I've started to code a tool for exporting the kernel configuration to a HTML 
file (inkl trees and so on.. could be used for HowTos). I've read qconf.cc 
gconf.c from /usr/src/linux/sripts/kconfig.

So far, so good.. the code compiles without any hassles... but I'm getting the 
following messages when I want to run my program (e.g. 
in /home/nomore/dev/lktexporter):

Code:

bash-2.05b$ ./lktexporter
/usr/src/linux/.config:4: syntax error, unexpected T_WORD
/usr/src/linux/.config:9: syntax error
/usr/src/linux/.config:12: syntax error, unexpected T_WORD
/usr/src/linux/.config:17: syntax error
/usr/src/linux/.config:20: syntax error, unexpected T_WORD
/usr/src/linux/.config:40: syntax error
/usr/src/linux/.config:43: syntax error, unexpected T_WORD
/usr/src/linux/.config:50: syntax error
/usr/src/linux/.config:53: syntax error, unexpected T_WORD
/usr/src/linux/.config:111: syntax error
/usr/src/linux/.config:115: syntax error, unexpected T_WORD
/usr/src/linux/.config:124: syntax error
/usr/src/linux/.config:127: syntax error, unexpected T_WORD
/usr/src/linux/.config:131: syntax error
/usr/src/linux/.config:134: syntax error, unexpected T_WORD
/usr/src/linux/.config:155: syntax error
/usr/src/linux/.config:163: syntax error, unexpected T_WORD


the first lines of the example config
Code:

#
# Automatically generated make config: don't edit
#
CONFIG_X86=y
CONFIG_MMU=y
CONFIG_UID16=y
CONFIG_GENERIC_ISA_DMA=y

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
CONFIG_CLEAN_COMPILE=y
CONFIG_STANDALONE=y
CONFIG_BROKEN_ON_SMP=y

#
# General setup
#
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y


I don't know what I'm doing wrong.. and can't see the differnece between my 
code and the ones from the kernel config tools. 'make menuconfig' is working 
with the above config file.

Here's my code so far:
Code:

#define LKC_DIRECT_LINK

#include <stdlib.h>
#include "lkc.h"


void fixup_rootmenu(struct menu *menu)
{
   struct menu *child;
   static int menu_cnt = 0;

   menu->flags |= MENU_ROOT;
   for (child = menu->list; child; child = child->next) {
      if (child->prompt && child->prompt->type == P_MENU) {
         menu_cnt++;
         fixup_rootmenu(child);
         menu_cnt--;
      } else if (!menu_cnt)
         fixup_rootmenu(child);
   }
}

void exportConfig(struct menu *menu)
{
   struct symbol *sym;
   struct property *prop;
   struct menu *child,*current;
   enum prop_type ptype;

   if (menu == &rootmenu) {
      current = &rootmenu;
   }

   //going through the complete list
   for (child = menu->list; child; child = child->next)
   {
      prop = child->prompt;
      sym = child->sym;
      ptype = prop ? prop->type : P_UNKNOWN;

      printf("prompt: %s\n",menu_get_prompt(child));      
   }
}

int main(int argc,char **argv)
{
   #ifndef LKC_DIRECT_LINK
   kconfig_load();
   #endif

   //reading the kernel configuration
   conf_parse("/usr/src/linux/.config");
   fixup_rootmenu(&rootmenu);
   
   if(conf_read(NULL))
   {
      printf("unable to load linux kernel configuration\n");
      return 1;
   }

   exportConfig(&rootmenu);

   return 0;
}


I've searched the web and the archives but didn't find any answers. If this 
isn't the right place for my questions, then would you please tell me where I 
can ask ?? 
Is there any place to get some neat documentation ?? And why isn't the code of 
the config tools documentated ? *argh* :]

any help is great !

Alexander

                 reply	other threads:[~2004-07-13 21:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407132310.07170.abierbrauer@gmx.org \
    --to=abierbrauer@gmx.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®