Subject: Re: Booting ML405 (Kernel panic - not syncing: No init found)

From: Neeraj Garg <[email-masked]>
Date: Thu, 17 Jul 2008 20:53:20 +0530

Hi,

I changed the owner of the busybox, and used chmod as you told me for 
bin/busybox but its permission are -rwsrwxr-x not srwxrwxr-x-r.

--for compiling helloworld I used $powerpc-405-linux-gnu-gcc -static 
helloworld.c -o helloworld

--For ramdisk creation I followed the following steps:

mkdir tmp/initrd
dd if=/dev/zero of=images/initrd.img bs=1k count=8192
/sbin/mke2fs -F -v -m0 images/initrd.img
mount -o loop images/initrd.img tmp/initrd
cp -av ramdisk/* tmp/initrd

//here ramdisk holds directory structure.. I copied directory structure 
from git, linux support ...but I changed lib and bin contents (bin
contents with busybox-1.10.3 installation, and lib contents with lib of 
my cross-compiler setup ,crosstool-0.28-rc35)

umount tmp/initrd
gzip < images/initrd.img > images/ramdisk.image.gz

----For making directory structure of ramdisk I followed following steps
for file in libc libcrypt libdl libm libpthread libresolv libutil
do
cp $file-*.so /home/neeraj/kerneldev/rootfs0.1/lib
cp -d $file.so.[*0-9] /home/neeraj/kerneldev/rootfs0.1/lib
done
cp -d ld*.so* /home/neeraj/kerneldev/rootfs0.1/lib

----And in menuconfig I selected filesystem as ramdisk with following 
settings
<*>   RAM block device support 
(16)    Default number of RAM disks
(32768) Default RAM disk size (kbytes) 

// I think here can be the issue

-------------------------------------------------------------------
Neeraj Garg

Ron Sass wrote:
> Hmmm... I think you've got a problem with your ramdisk.  There are
> a couple of issues but these alone don't explain your helloworld test.
>
> 1.  busybox should be set to root not neeraj 
> 2.  you need to setuid busybox for some apps to run
>     (chmod 4775 bin/busybox so that it is srwxrwxr-x-r)
> 3.  I would be wary of Yaghmour's text... it is a little dated
>     and if I remember correctly, he uses some regular expressions
>     to copy "just" the libraries you need to lib; but with
>     newer versions of gcc/glibc these regular expressions
>     don't catch everything
>
> Two questions:
>
> Can you tell me exactly what your cross-compile command-line looks
> like?  How are compiling helloworld?
>
> How are you creating the ramdisk?  How do you go from directory
> structure to ramdisk.image.gz?
>
> Ron
>
>   
>> Hi,
>>
>> --Ron,Permissions are -rwxrwxr-x for all and owner is neeraj itself. And 
>> shared libraries are present in lib/ . Now I have placed helloworld.elf 
>> (using printf to print helloworld, and linked with -static option) in 
>> bin/ and changed init=/bin/helloworld , again it says cannot execute 
>> /bin/helloworld.
>>
>> --John, we are using our custom hardware board, not exactly ML405 but 
>> its more or less similar to ML405, so I cannot use bit file provided for 
>> ML405. Till now we were using xilkernel, but now onward we are planning 
>> to use Linux. For serial console I have no option other than uartlite. 
>> This is how I compiled kernel :
>>
>> 1) make ARCH=ppc ml405_defconfig
>> 2) patched kernel src with EDK(10.1) , so as to change xparameter.h, and 
>> later made some changed in arch/ppc/boot/simple/embed_config.c and 
>> xparameters.h file.
>> 3) make ARCH=ppc menuconfig , and selected uartlite to be console and 
>> ramdisk as file system.
>> 4) Created ramdisk (as per Building embedded linux, Karim Yaghmour, 
>> however major and minor number for device nodes is similar to ramdisk 
>> provided at git.xilinx.com)
>> 5) I have placed this ramdisk in arch/ppc/boot/images
>> 6) And then issued $make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- 
>> zImge.initrd
>>
>>
>> --I have downloaded   ELDK4.1 and installed it. And when I compile 
>> simple helloworld.c using cross compiler, it says unresolved symbol 
>> 'printf' . Is there anything else to install with ELDK ?
>>
>>
>> -------------------------------------------------------------------
>> Neeraj Garg
>>
>>
>>
>> In addition to what John wrote, I would also investigate your ramdisk.
>> I would be sure to check that you have the permissions/owner set correctly
>> on bin/busybox.  Also, I would double check that, if you compiled busybox
>> with shared libraries, the shared libraries are in the right place
>> on your ramdisk.
>>
>>
>> Ron
>>
>>  >
>>  > Hi,
>>  >
>>  > Yes I am using ARCH=ppc (actual line is $make ARCH=ppc
>>  > CROSS_COMPILE=powerpc-405-linux-gnu- zImage.initrd ) for this I have
>>  > placed ramdisk.image.gz in arch/ppc/boot/images. In case of ARCH=powerpc
>>  > I cannot find processor type 405 , in make menuconfig. Thats why i am
>>  > using ARCH=ppc.
>>  >
>>
>> --------------060307000300070002040802
>> Content-Type: text/html; charset=ISO-8859-1
>> Content-Transfer-Encoding: 7bit
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <html>
>> <head>
>>   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
>> </head>
>> <body bgcolor="#ffffff" text="#000000">
>> Hi,<br>
>> <br>
>> --Ron,Permissions are -rwxrwxr-x for all and owner is neeraj itself.
>> And shared libraries are present in lib/ . Now I have placed
>> helloworld.elf (using printf to print helloworld, and linked with
>> -static option) in bin/ and changed init=/bin/helloworld , again it
>> says cannot execute /bin/helloworld. <br>
>> <br>
>> --John, we are using our custom hardware board, not exactly ML405 but
>> its more or less similar to ML405, so I cannot use bit file provided
>> for ML405. Till now we were using xilkernel, but now onward we are
>> planning to use Linux. For serial console I have no option other than
>> uartlite. This is how I compiled kernel :<br>
>> <br>
>> 1) make ARCH=ppc ml405_defconfig<br>
>> 2) patched kernel src with EDK(10.1) , so as to change xparameter.h,
>> and later made some changed in arch/ppc/boot/simple/embed_config.c and
>> xparameters.h file.<br>
>> 3) make ARCH=ppc menuconfig , and selected uartlite to be console and
>> ramdisk as file system.<br>
>> 4) Created ramdisk (as per Building embedded linux, Karim Yaghmour,
>> however major and minor number for device nodes is similar to ramdisk
>> provided at git.xilinx.com)<br>
>> 5) I have placed this ramdisk in arch/ppc/boot/images<br>
>> 6) And then issued $make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu-
>> zImge.initrd<br>
>> <br>
>> <br>
>> --I have downloaded &nbsp; ELDK4.1 and installed it. And when I compile
>> simple helloworld.c using cross compiler, it says unresolved symbol
>> 'printf' . Is there anything else to install with ELDK ?<br>
>> <br>
>> <br>
>> <div class="moz-signature">
>> <pre>-------------------------------------------------------------------
>> Neeraj Garg
>> </pre>
>> </div>
>> <br>
>> <br>
>> In addition to what John wrote, I would also investigate your ramdisk.
>> <br>
>> I would be sure to check that you have the permissions/owner set
>> correctly
>> <br>
>> on bin/busybox. &nbsp;Also, I would double check that, if you compiled
>> busybox
>> <br>
>> with shared libraries, the shared libraries are in the right place
>> <br>
>> on your ramdisk.<br>
>> <br>
>> <br>
>> Ron
>> <br>
>> <br>
>> &gt; <br>
>> &gt; Hi,
>> <br>
>> &gt; <br>
>> &gt; Yes I am using ARCH=ppc (actual line is $make ARCH=ppc <br>
>> &gt; CROSS_COMPILE=powerpc-405-linux-gnu- zImage.initrd ) for this I
>> have <br>
>> &gt; placed ramdisk.image.gz in arch/ppc/boot/images. In case of
>> ARCH=powerpc <br>
>> &gt; I cannot find processor type 405 , in make menuconfig. Thats why i
>> am <br>
>> &gt; using ARCH=ppc.
>> <br>
>> &gt; <br>
>> <font color="navy" face="Arial" size="2"><span
>>  style="font-size: 10pt; font-family: Arial; color: navy;"></span></font>
>> </body>
>> </html>
>>
>> --------------060307000300070002040802--
>>
>>
>> --===============0970715627==
>> Content-Type: text/plain; charset="us-ascii"
>> MIME-Version: 1.0
>> Content-Transfer-Encoding: 7bit
>> Content-Disposition: inline
>>
>> _______________________________________________
>> Linuxppc-embedded mailing list
>> [email-masked]
>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>> --===============0970715627==--
>>
>>