View Single Post
Old 05-12-2016, 09:16 AM   #125
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by geekmaster View Post
Thanks. My search for a magic bullet has been fruitless, pointless, frustrating, and a unhealthy. I have no idea how to duplicate missing config files -- I barely understand config files even when they ARE provided. I need to study that first, it seems. Most of my career (even when programming for unix-ish machines) was done using CP/M or MS-DOS or Windows machines for the build tools. The unix-ish (or more commonly bare metal with no firmware other than mine) systems were just the target, and I have plugged in too many thousands of EPROMS over the years. So yeah, my lifetime coding reflexes do not work well here unless I have a toolchain that "just works" without thinking about it instead of thinking about my application...

I will be done posting here for a bit while I study, but I will keep an eye out for anything y'all post to this thread. A working toolchain would be nice...
Reverse engineering a (menu) config file:

One of those things I putter around on when bored with life.
Also one of the things I have never finished.
But the basics are:

Going forward with menuconfig (kernel, busybox, uClibc, buildroot, etc):

You want feature: "Churn Butter on Wednesday" -
Find in menuconfig menus and then set to: 'yes' -
When the makefile is later run -
Finding symbol: CBW_CONFIG='y' it adds to the string OBJS-Y += cbw.o -
Later in the makefile processing all objects mentioned in the OBJS-Y (string) symbol are built -

Each *.o file built has its own set of (run-time) symbols.

The final <whatever> being built has an accumulation of symbols from each of its components.

So to reverse the process:

First a little prep work -
make allyes
that **should** (but will not) build every possible *.o in its tree

Now run a script (using a language that supports associative keyes) to list (using a standard elf tool) sysmbols in each *.o.
Make a catalog (when you find an entry point symbol cbw_init, do):
cbw_init: cbw.o, CBW_CONFIG=y, etc. etc. etc.

Now run a script on the final <whatever> was built -
For each symbol found, look it up in the above catalog, append the configuration symbol (CBW_CONFIG=y) to the output list you are building.

With an object like uClibc.so - ELF tools will give you the symbol list and details -

For the K1's kernel (also built with menuconfig):
cat /proc/kallsyms
while the kernel is running (do it now - before we both forget).
(/proc/kallsyms contains a list of symbols from every *.o = 'y' or 'm' when the kernel was built)
knc1 is offline   Reply With Quote