[OLPC-devel] Re: buildrom issues

Ronald G Minnich rminnich at lanl.gov
Wed Jun 28 19:12:34 EDT 2006


Jordan Crouse wrote:
> On 28/06/06 08:57 -0600, Ronald G Minnich wrote:
> 
>>gcc -shared -o libiw.so.28 -Wl,-soname,libiw.so.28  -lm -lc iwlib.so
>>/usr/bin/ld: errno@@GLIBC_PRIVATE: TLS definition in /lib/libc.so.6 
>>section .tbss mismatches non-TLS reference in iwlib.so
>>iwlib.so: could not read symbols: Bad value
> 
> 
> Hmm - yeah, something very bad is happening there.  I'll look into it,
> but I can't promise you anything before tommorrow (Thursday).

I'm having a bad day with this stuff today. the mkelfimage step won't 
even work any more -- bad redirection at some point. Not my lucky day :-)

> One interesting thing to do is to define a variable like this:
> 
> ifeq ($(VERBOSE),y)
> VFLAG=
> else
> VFLAG=@
> endif
> 
> And then putting $(VFLAG) on the front of those lines you want to see when
> VERBOSE=y instead of the hardcoded @.

excellent idea.


> I'm really of two minds on that - one one hand, the shell prompt is good,
> but on the other hand, its not really very useful in a production
> environment.  I wonder if we could continue to develop the klb, but add some
> code to exec() a shell with a key-press at the right time.  Then, when
> the klb goes to production, the shell, and the magic key press disappear.

I like it all but the 'disappear' part. Sometimes, when things are 
really going south, there's nothing like a shell.

how about  this?

int ash(void)
{
         int pid = fork();

         if (pid < 0) {
                 print("Fork failed errno %d\n", errno);
                 return errno;
         }

         if (pid) {
                 int w;
                 w = wait();
                 return w;
         }

         execl("/bin/ash", "ash", 0);
         print("exec failed errno %d\n", errno);
         exit(2);
}

and:
int startup(void)
{
         int opt;
         char c;

         print("Select option:\n");

         print("1 - boot from NAND flash (JFFS2)\n");
         print("2 - boot from USB device (EXT2)\n");
         print("3 - fork off  /bin/ash\n");

         scanf("%1d", &opt);


         switch(opt) {
         case 1:
                 select_options();
                 return load_exec_nand_image(kernel_file, kernel_cmdline,
                         initrd_file);
         case 2:
                 select_options();
                 return load_exec_usb_image(kernel_file, kernel_cmdline,
                         initrd_file);
         case 3:
                 return ash();
         default:
                 print("unsupported option!\n");
                 return 1;
         }
}

but there's something weird with the busybox build. The /bin/ash can't 
be executed due to some strange problem with .so's. So I am building it 
static for now, and that works -- I had to remove all IP support to make 
it fit.

In fact, if I simply do this:
chroot initrd-fs /bin/busybox

it will fail with "not found" as the error. ld.so problem? libc.so.0 
problem? not sure.

The problem with klb (oops, kbl, my fault) is that when things go wrong, 
you are basically stuck. We have to assume that things will go wrong -- 
especially at 10M count. If there is not some way to get to a command 
prompt, people are going to be very, very frustated. You can write a 
shell in few lines:
get a line
tokenize it
execl
as long as you don't get too fancy: no readline, no redirect, pipe, etc. 
I think something minimal is going to be very helpful. It need not be 
ash, but I think we'll want something.

After 6 years of doing these 'no shell' embedded systems, I'm finding my 
life is a lot better when I get a kernel and shell out of flash -- I can 
really do much better diagnosis.

ron



More information about the Devel mailing list