Unable to get serial console login prompt - PowerPC 440 Virtex 5 processor


Elvis Dowson
 

Hi,
       I am unable to get a serial console login prompt using yocto generate rootfilesystem (core-image-minimal), for a PowerPC 440 target. 

I saw on another thread that even for the pandaboard, a similar situation exists:

On 2012-07-30 13:11, Gary Thomas wrote:
On 2012-07-30 12:49, Jim Abernathy wrote:
On 07/30/2012 01:16 PM, Gary Thomas wrote:
I got core-image-minimal built without errors, Thanks, now I need to ask some questions about booting that image.  I'm assuming that I can follow the instructions on pandaboard.org
for creating the SD card format and just copy the deploy/image/ u-boot, MLO, uImage, and rootfs to the right places and boot the sdcard in the pandaboard. Anyway, that's what I
tried.  I'm connected to the panadboard via serial port and the U-Boot works and the uImage seems to be found, but I don't get a login console on the serial port:

U-Boot SPL 2011.12-dirty (Jul 30 2012 - 13:44:03)
Texas Instruments OMAP4430 ES2.1
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img


U-Boot 2011.12-dirty (Jul 30 2012 - 13:44:03)

CPU  : OMAP4430 ES2.1
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
reading boot.scr

** Unable to read "boot.scr" from mmc 0:1 **
reading uImage

4176404 bytes read
Booting from mmc0 ...
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux-3.1.0
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4176340 Bytes = 4 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Start with the obvious - check the bootparams in U-Boot.  Break into
the boot process and run the 'printenv' command.  What's the value of
the "console" variable?

n.b. I've not tried this exact setup on the PandaBoard.  I may have time
later today to do so.


I've just verified that this does fail when using yocto:master I'm pretty
sure that the problem is related to the use of GCC 4.7.1 - I've had similar
problems with ARM kernels & GCC 4.7.1 in the past.


Can someone confirm?

Any suggestions on how to get past this issue? Is serial console login prompt broken on yocto for targets other than Intel? Does it work on ARM or PowerPC at the moment, with the latest yocto updates as of today?

My /etc/inittab looks like this:

S:2345:respawn:/sbin/getty 9600 ttyS0

Here is the output of my kernel boot screen:

zImage starting: loaded at 0x00800000 (sp: 0x00d71fb0)                                            
Allocating 0x4cea6c bytes for kernel ...                                                          
gunzipping (0x00000000 <- 0x0080f000:0x009ddcf9)...done 0x3b15c0 bytes
Attached initrd image at 0x009de000-0x00d7088a
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0 ip=off root=/dev/ram rw
Finalizing device tree... flat tree at 0xd7e0e0
[    0.000000] Using Xilinx Virtex440 machine description
[    0.000000] Linux version 3.3.0-14.2-build1+ (elvis@eos) (gcc version 4.7.2 20120706 (prerelease) (GCC) ) #37 PREEMPT Tue Jul 31 21:12:34 GST 2012
[    0.000000] Found initrd at 0xc09de000:0xc0d7088a
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000000 -> 0x00010000
[    0.000000]   Normal   empty
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00010000
[    0.000000] MMU: Allocated 1088 bytes of context maps for 255 contexts
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0 ip=off root=/dev/ram rw
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 251200k/262144k available (3596k kernel code, 10944k reserved, 188k data, 1138k bss, 148k init)
[    0.000000] Kernel virtual memory layout:
[    0.000000]   * 0xfffdf000..0xfffff000  : fixmap
[    0.000000]   * 0xfde00000..0xfe000000  : consistent mem
[    0.000000]   * 0xfde00000..0xfde00000  : early ioremap
[    0.000000]   * 0xd1000000..0xfde00000  : vmalloc & ioremap
[    0.000000] NR_IRQS:512
[    0.000000] clocksource: timebase mult[2800000] shift[24] registered
[    0.000000] Console: colour dummy device 80x25
[    0.000455] pid_max: default: 32768 minimum: 301
[    0.000815] Mount-cache hash table entries: 512
[    0.008275] NET: Registered protocol family 16
[    0.014106] PCI: Probing PCI hardware
[    0.041141] bio: create slab <bio-0> at 0
[    0.042516] gpiochip_add: registered GPIOs 248 to 255 on device: /plb@0/gpio@81460000
[    0.043034] gpiochip_add: registered GPIOs 240 to 247 on device: /plb@0/gpio@81440000
[    0.043625] gpiochip_add: registered GPIOs 235 to 239 on device: /plb@0/gpio@81420000
[    0.044150] gpiochip_add: registered GPIOs 230 to 234 on device: /plb@0/gpio@81400000
[    0.045659] vgaarb: loaded
[    0.049556] Switching to clocksource timebase
[    0.088781] NET: Registered protocol family 2
[    0.089206] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.090770] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.091141] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.091343] TCP: Hash tables configured (established 8192 bind 8192)
[    0.091361] TCP reno registered
[    0.091381] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.091425] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.092019] NET: Registered protocol family 1
[    0.092849] RPC: Registered named UNIX socket transport module.
[    0.092879] RPC: Registered udp transport module.
[    0.092892] RPC: Registered tcp transport module.
[    0.092906] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.093223] Trying to unpack rootfs image as initramfs...
[    0.095276] rootfs image is not initramfs (no cpio magic); looks like an initrd
[    0.128489] Freeing initrd memory: 3660k freed
[    0.145577] ROMFS MTD (C) 2007 Red Hat, Inc.
[    0.146291] msgmni has been set to 499
[    0.147734] io scheduler noop registered
[    0.147760] io scheduler deadline registered
[    0.147911] io scheduler cfq registered (default)
[    0.180521] Console: switching to colour frame buffer device 80x30
[    0.444482] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.450055] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    4.334314] console [ttyS0] enabled
[    4.395802] brd: module loaded
[    4.441798] loop: module loaded
[    4.478911] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    4.555785] xsysace 83600000.sysace: No CF in slot
[    4.614718] Xilinx SystemACE device driver, major=254
[    4.675508] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    4.749052] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    4.830133] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    4.923700] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    5.038540] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    5.107812] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    5.207016] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    5.276713] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    5.377147] mousedev: PS/2 mouse device common for all mice
[    5.444373] i2c /dev entries driver
[    5.485910] Device Tree Probing 'i2c'
[    5.530167] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    5.607687] TCP cubic registered
[    5.645541] NET: Registered protocol family 17
[    6.441625] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    6.925869] RAMDISK: gzip image found at block 0
[    7.449824] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    7.834586] VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
[    7.914175] Freeing unused kernel memory: 148k freed


Best regards,

Elvis Dowson


Elvis Dowson
 

Hi,

On Jul 31, 2012, at 9:27 PM, Elvis Dowson wrote:

I am unable to get a serial console login prompt using yocto generate rootfilesystem (core-image-minimal), for a PowerPC 440 target. 

I'm now starting the process of debugging the init process step by step. 

I've just updated to the latest gcc-4.7.2 commit, as of today

SRCREV = "1653160670db186c6243997447ecbe6ce5056648"

I've created a simple hello world program, and used that as init, and I get an output as expected:

zImage starting: loaded at 0x00800000 (sp: 0x00d7bfb0)                     
Allocating 0x540e0c bytes for kernel ...                                   
gunzipping (0x00000000 <- 0x0080f000:0x00a17dda)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00d7a3e1
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/init
Finalizing device tree... flat tree at 0xd880e0
 PM: Adding info for No Bus:ttyv9
[    0.476678] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.481983] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.677477] console [ttyS0] enabled
[    0.741448] brd: module loaded
[    0.788283] loop: module loaded
[    0.825575] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.902300] xsysace 83600000.sysace: No CF in slot
[    0.961302] Xilinx SystemACE device driver, major=254
[    1.022246] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.095778] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.176850] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.270544] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.385416] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    1.454651] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    1.554024] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    1.623705] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    1.724252] mousedev: PS/2 mouse device common for all mice
[    1.791648] i2c /dev entries driver
[    1.833441] Device Tree Probing 'i2c'
[    1.877646] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    1.955298] TCP cubic registered
[    1.993143] NET: Registered protocol family 17
[    2.790356] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    3.274628] RAMDISK: gzip image found at block 0
[    3.798553] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    4.178791] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    4.248993] Freeing unused kernel memory: 152k freed

Hello world from myinit.c!

Inside the ramdisk, I just have a /dev folder, and it has nodes for console and ttyS0. So this means that the Xilinx hardware project using xps_uart16550_v3_00_a and the kernel drivers, etc, are all working.

Now to try to debug the init process.

Best regards,

Elvis Dowson


Elvis Dowson
 

Hi,

On Aug 4, 2012, at 12:59 AM, Elvis Dowson wrote:

Now to try to debug the init process.

I compiled bash statically by making the following changes:

diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 3684191..071d79e 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -11,7 +11,7 @@ inherit autotools gettext update-alternatives

 

 PARALLEL_MAKE = ""

 

-EXTRA_OECONF = "--enable-job-control"
+EXTRA_OECONF = "--enable-job-control --without-gnu-malloc --enable-static-link"
 export CC_FOR_BUILD = "${BUILD_CC}"

 

 ALTERNATIVE_${PN} = "sh"

That seems to be working! 

zImage starting: loaded at 0x00800000 (sp: 0x00d38fb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17ddd)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00d3797b
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/bash
Finalizing device tree... flat tree at 0xd450e0
 PM: Adding info for No Bus:ttyv9
[    0.473944] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.479429] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.674847] console [ttyS0] enabled
[    0.738939] brd: module loaded
[    0.785690] loop: module loaded
[    0.823018] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.899716] xsysace 83600000.sysace: No CF in slot
[    0.958789] Xilinx SystemACE device driver, major=254
[    1.019641] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.093183] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.174263] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.267929] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.382861] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    1.452151] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    1.551544] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    1.621222] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    1.721705] mousedev: PS/2 mouse device common for all mice
[    1.789048] i2c /dev entries driver
[    1.830824] Device Tree Probing 'i2c'
[    1.874996] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    1.952627] TCP cubic registered
[    1.990531] NET: Registered protocol family 17
[    2.786413] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    3.270686] RAMDISK: gzip image found at block 0
[    3.794609] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    4.158841] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    4.229004] Freeing unused kernel memory: 152k freed
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-4.2# 

I get a bash shell prompt with no issues. 

Not sure at this moment, if it was the updates to gcc-4.7.2 that fixed the problem or if there is still a problem with the init scripts.

I'll try to switch back to a non-static bash, and try booting the core-image-minimal filesystem once again.

Best regards,

Elvis Dowson


Elvis Dowson
 

Hi,

On Aug 4, 2012, at 1:30 AM, Elvis Dowson wrote:

I'll try to switch back to a non-static bash, and try booting the core-image-minimal filesystem once again.

Switching back to the core-image-default non-static bash version, didn't work. I get no bash prompt, even through I specified init=/bin/sh for the kernel bootargs

zImage starting: loaded at 0x00800000 (sp: 0x00dacfb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17ddd)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00dab775
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/bin/sh
Finalizing device tree... flat tree at 0xdb90e0
 PM: Adding info for No Bus:ttyv9
[    0.478914] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.484189] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.679634] console [ttyS0] enabled
[    0.743646] brd: module loaded
[    0.790371] loop: module loaded
[    0.827695] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.904387] xsysace 83600000.sysace: No CF in slot
[    0.963434] Xilinx SystemACE device driver, major=254
[    1.024322] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.097851] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.178937] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.272553] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.387465] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    1.456732] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    1.556112] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    1.625786] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    1.726276] mousedev: PS/2 mouse device common for all mice
[    1.793618] i2c /dev entries driver
[    1.835429] Device Tree Probing 'i2c'
[    1.879626] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    1.957193] TCP cubic registered
[    1.995099] NET: Registered protocol family 17
[    2.790435] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    3.274705] RAMDISK: gzip image found at block 0
[    3.681850] atkbd serio1: Frame/parity error: 02
[    3.858630] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    4.242871] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    4.313049] Freeing unused kernel memory: 152k freed

What should I do now to debug this issue further?

I have disabled image-prelink by not including it in my local.conf as follows:

# Remove image-prelink for PowerPC 32-bit and 64-bit targets.
USER_CLASSES ?= "buildstats image-mklibs"

Any thoughts on what I can try to do next, to narrow down the issue, with bash working statically, but not when linked with shared libraries?

Best regards,

Elvis Dowson


Tim Bird <tim.bird@...>
 

On 08/03/2012 03:05 PM, Elvis Dowson wrote:
Hi,

On Aug 4, 2012, at 1:30 AM, Elvis Dowson wrote:

I'll try to switch back to a non-static bash, and try booting the
core-image-minimal filesystem once again.
Switching back to the core-image-default non-static bash version, didn't work. I
get no bash prompt, even through I specified init=/bin/sh for the kernel bootargs

zImage starting: loaded at 0x00800000 (sp: 0x00dacfb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17ddd)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00dab775
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait
init=/bin/sh
Finalizing device tree... flat tree at 0xdb90e0
PM: Adding info for No Bus:ttyv9
[ 0.478914] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.484189] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[ 0.679634] console [ttyS0] enabled
[ 0.743646] brd: module loaded
[ 0.790371] loop: module loaded
[ 0.827695] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[ 0.904387] xsysace 83600000.sysace: No CF in slot
[ 0.963434] Xilinx SystemACE device driver, major=254
[ 1.024322] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[ 1.097851] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[ 1.178937] xilinx_emaclite 81000000.ethernet: MAC address is now
00:0a:35:b7:78:00
[ 1.272553] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000
mapped to 0xD10A0000, irq=17
[ 1.387465] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[ 1.456732] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to
0xd1036000, irq=22
[ 1.556112] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[ 1.625786] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to
0xd1038000, irq=23
[ 1.726276] mousedev: PS/2 mouse device common for all mice
[ 1.793618] i2c /dev entries driver
[ 1.835429] Device Tree Probing 'i2c'
[ 1.879626] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[ 1.957193] TCP cubic registered
[ 1.995099] NET: Registered protocol family 17
[ 2.790435] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[ 3.274705] RAMDISK: gzip image found at block 0
[ 3.681850] atkbd serio1: Frame/parity error: 02
[ 3.858630] input: AT Raw Set 2 keyboard as
/devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[ 4.242871] VFS: Mounted root (ext2 filesystem) on device 1:0.
[ 4.313049] Freeing unused kernel memory: 152k freed

What should I do now to debug this issue further?

I have disabled image-prelink by not including it in my local.conf as follows:

# Remove image-prelink for PowerPC 32-bit and 64-bit targets.
USER_CLASSES ?= "buildstats image-mklibs"

Any thoughts on what I can try to do next, to narrow down the issue, with bash
working statically, but not when linked with shared libraries?
I haven't debugged a static vs. dynamic boot-time issue for some years, but here
are a few ideas off the top of my head.

First, use readelf or objdump to validate where the binary is expecting to load the
dynamic linker from (that is, what directory path). Check that the linker and
all libraries are in the proper places (in the paths as specified in the ELF
headers for the program - bash in this case).

Second, try instrumenting (ie adding printks to) the loader path, and see if the kernel
knows what is failing. The way dynamic linking works is that the kernel loads the
program image (ELF file), and treats the dynamic linker (ldlinux.so) as it's "interpreter".
If you're not seeing an attempt to load the interpreter, then something is going wrong.
You could instrument the kernel "open" path to see all the files that are being opened
during the boot. ldlinux.so should be one of them. The linker should then be trying
to load the other libraries needed by the program. This should also result in open
calls (or possibly mmap calls).

Good luck.
-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Workgroup of the Linux Foundation
Senior Staff Engineer, Sony Network Entertainment
=============================


Khem Raj
 


On Aug 3, 2012, at 3:05 PM, Elvis Dowson <elvis.dowson@...> wrote:

Hi,

On Aug 4, 2012, at 1:30 AM, Elvis Dowson wrote:

I'll try to switch back to a non-static bash, and try booting the core-image-minimal filesystem once again.

Switching back to the core-image-default non-static bash version, didn't work. I get no bash prompt, even through I specified init=/bin/sh for the kernel bootargs

zImage starting: loaded at 0x00800000 (sp: 0x00dacfb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17ddd)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00dab775
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/bin/sh
Finalizing device tree... flat tree at 0xdb90e0
 PM: Adding info for No Bus:ttyv9
[    0.478914] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.484189] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.679634] console [ttyS0] enabled
[    0.743646] brd: module loaded
[    0.790371] loop: module loaded
[    0.827695] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.904387] xsysace 83600000.sysace: No CF in slot
[    0.963434] Xilinx SystemACE device driver, major=254
[    1.024322] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.097851] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.178937] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.272553] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.387465] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    1.456732] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    1.556112] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    1.625786] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    1.726276] mousedev: PS/2 mouse device common for all mice
[    1.793618] i2c /dev entries driver
[    1.835429] Device Tree Probing 'i2c'
[    1.879626] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    1.957193] TCP cubic registered
[    1.995099] NET: Registered protocol family 17
[    2.790435] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    3.274705] RAMDISK: gzip image found at block 0
[    3.681850] atkbd serio1: Frame/parity error: 02
[    3.858630] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    4.242871] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    4.313049] Freeing unused kernel memory: 152k freed

What should I do now to debug this issue further?

I have disabled image-prelink by not including it in my local.conf as follows:

# Remove image-prelink for PowerPC 32-bit and 64-bit targets.
USER_CLASSES ?= "buildstats image-mklibs"

Any thoughts on what I can try to do next, to narrow down the issue, with bash working statically, but not when linked with shared libraries?



OK couple of things.  You could boot into static bash thats good, keep it that way and bundle some dynamically linked programs into the root file system
may be just a hello world which is dynamically linked. I would also compile a static version of gdb and strace but that could be next steps.

then boot into this static shell and try to run the dynamically linked hello world. Does that work ?
if not we have a dynamic linking issue. 

Then you can go a step deeper and see whats going on. Many  a times interpreter is specified wrongly in the elf file.
and there could be dynamic linker issues too. But step at a time.


Best regards,

Elvis Dowson

_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Elvis Dowson
 

Hi,

On Aug 4, 2012, at 6:24 AM, Khem Raj wrote:

OK couple of things.  You could boot into static bash thats good, keep it that way and bundle some dynamically linked programs into the root file system
may be just a hello world which is dynamically linked. I would also compile a static version of gdb and strace but that could be next steps.

then boot into this static shell and try to run the dynamically linked hello world. Does that work ?
if not we have a dynamic linking issue. 

Then you can go a step deeper and see whats going on. Many  a times interpreter is specified wrongly in the elf file.
and there could be dynamic linker issues too. But step at a time.

I created a new 16GB ramdisk file, and put the core-image-minimal root filesystem into it. I then created a static version and a dynamic version of the helloworld program.

I find that the static version of the helloworld loads okay, but the dynamic version of the helloworld program doesn't give any output.

I guess this means we have a dynamic linking issue. 

I've attached the outputs of the readelf -h and -S commands, and the outputs of the objdump commands for the text and data sections for the helloworlddynamic program.

zImage starting: loaded at 0x00800000 (sp: 0x00f37fb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17de4)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x00f36f10
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/helloworlddynamic
Finalizing device tree... flat tree at 0xf440e0
 PM: Adding info for No Bus:ttyv9
[    0.492863] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.498167] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.693672] console [ttyS0] enabled
[    0.757577] brd: module loaded
[    0.804366] loop: module loaded
[    0.841663] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.918399] xsysace 83600000.sysace: No CF in slot
[    0.977368] Xilinx SystemACE device driver, major=254
[    1.038331] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.111862] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.192936] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.286646] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.401504] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'
[    1.470737] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22
[    1.570108] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'
[    1.639794] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23
[    1.740312] mousedev: PS/2 mouse device common for all mice
[    1.807658] i2c /dev entries driver
[    1.849416] Device Tree Probing 'i2c'
[    1.893623] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18
[    1.971280] TCP cubic registered
[    2.009127] NET: Registered protocol family 17
[    2.806385] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000
[    3.290656] RAMDISK: gzip image found at block 0
[    3.818580] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0
[    4.750816] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    4.820805] Freeing unused kernel memory: 152k freed


Here is the output of the readelf -h and -S commands:

${CROSS_COMPILE}readelf -h helloworlddynamic
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           PowerPC
  Version:                           0x1
  Entry point address:               0x1000032c
  Start of program headers:          52 (bytes into file)
  Start of section headers:          4216 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         36
  Section header string table index: 33

${CROSS_COMPILE}readelf -S helloworlddynamic
There are 36 section headers, starting at offset 0x1078:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        10000134 000134 00000d 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            10000144 000144 000020 00   A  0   0  4
  [ 3] .gnu.hash         GNU_HASH        10000164 000164 000020 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          10000184 000184 000070 10   A  5   1  4
  [ 5] .dynstr           STRTAB          100001f4 0001f4 000064 00   A  0   0  1
  [ 6] .gnu.version      VERSYM          10000258 000258 00000e 02   A  4   0  2
  [ 7] .gnu.version_r    VERNEED         10000268 000268 000030 00   A  5   1  4
  [ 8] .rela.dyn         RELA            10000298 000298 00000c 0c   A  4   0  4
  [ 9] .rela.plt         RELA            100002a4 0002a4 00003c 0c   A  4  23  4
  [10] .init             PROGBITS        100002e0 0002e0 00004c 00  AX  0   0  4
  [11] .text             PROGBITS        1000032c 00032c 000348 00  AX  0   0  4
  [12] .fini             PROGBITS        10000674 000674 000030 00  AX  0   0  4
  [13] .rodata           PROGBITS        100006a4 0006a4 000039 00   A  0   0  4
  [14] .eh_frame_hdr     PROGBITS        100006e0 0006e0 000014 00   A  0   0  4
  [15] .eh_frame         PROGBITS        100006f4 0006f4 00002c 00   A  0   0  4
  [16] .ctors            PROGBITS        10010720 000720 000008 00  WA  0   0  4
  [17] .dtors            PROGBITS        10010728 000728 000008 00  WA  0   0  4
  [18] .jcr              PROGBITS        10010730 000730 000004 00  WA  0   0  4
  [19] .got2             PROGBITS        10010734 000734 000008 00  WA  0   0  1
  [20] .dynamic          DYNAMIC         1001073c 00073c 0000c8 08  WA  5   0  4
  [21] .data             PROGBITS        10010804 000804 000008 00  WA  0   0  4
  [22] .got              PROGBITS        1001080c 00080c 000014 04 WAX  0   0  4
  [23] .plt              NOBITS          10010820 000820 000084 00 WAX  0   0  4
  [24] .bss              NOBITS          100108a4 000820 000008 00  WA  0   0  4
  [25] .comment          PROGBITS        00000000 000820 000027 01  MS  0   0  1
  [26] .debug_aranges    PROGBITS        00000000 000847 000038 00      0   0  1
  [27] .debug_info       PROGBITS        00000000 00087f 0001d6 00      0   0  1
  [28] .debug_abbrev     PROGBITS        00000000 000a55 00014d 00      0   0  1
  [29] .debug_line       PROGBITS        00000000 000ba2 000113 00      0   0  1
  [30] .debug_frame      PROGBITS        00000000 000cb8 00005c 00      0   0  4
  [31] .debug_str        PROGBITS        00000000 000d14 000154 01  MS  0   0  1
  [32] .debug_loc        PROGBITS        00000000 000e68 0000cf 00      0   0  1
  [33] .shstrtab         STRTAB          00000000 000f37 000140 00      0   0  1
  [34] .symtab           SYMTAB          00000000 001618 000520 10     35  58  4
  [35] .strtab           STRTAB          00000000 001b38 0002d6 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)


Here is the output of the objdump command:

${CROSS_COMPILE}objdump -d -j .text helloworlddynamic

helloworlddynamic:     file format elf32-powerpc


Disassembly of section .text:

1000032c <_start>:
1000032c: 7c 29 0b 78 mr      r9,r1
10000330: 54 21 00 36 rlwinm  r1,r1,0,0,27
10000334: 38 00 00 00 li      r0,0
10000338: 94 21 ff f0 stwu    r1,-16(r1)
1000033c: 7c 08 03 a6 mtlr    r0
10000340: 90 01 00 00 stw     r0,0(r1)
10000344: 3d 00 10 00 lis     r8,4096
10000348: 85 a8 06 a4 lwzu    r13,1700(r8)
1000034c: 48 01 05 34 b       10010880 <__libc_start_main@plt>

10000350 <deregister_tm_clones>:
10000350: 3d 20 10 01 lis     r9,4097
10000354: 3c 60 10 01 lis     r3,4097
10000358: 39 29 08 0c addi    r9,r9,2060
1000035c: 38 63 08 0c addi    r3,r3,2060
10000360: 39 29 00 03 addi    r9,r9,3
10000364: 7d 23 48 50 subf    r9,r3,r9
10000368: 2b 89 00 06 cmplwi  cr7,r9,6
1000036c: 4c bd 00 20 blelr+  cr7
10000370: 3d 20 00 00 lis     r9,0
10000374: 39 29 00 00 addi    r9,r9,0
10000378: 2f 89 00 00 cmpwi   cr7,r9,0
1000037c: 4d 9e 00 20 beqlr   cr7
10000380: 7d 29 03 a6 mtctr   r9
10000384: 4e 80 04 20 bctr

10000388 <register_tm_clones>:
10000388: 3c 60 10 01 lis     r3,4097
1000038c: 3d 20 10 01 lis     r9,4097
10000390: 38 63 08 0c addi    r3,r3,2060
10000394: 39 29 08 0c addi    r9,r9,2060
10000398: 7d 23 48 50 subf    r9,r3,r9
1000039c: 7d 29 16 70 srawi   r9,r9,2
100003a0: 7d 24 0e 70 srawi   r4,r9,1
100003a4: 7c 84 01 95 addze.  r4,r4
100003a8: 4d a2 00 20 beqlr+  
100003ac: 3d 20 00 00 lis     r9,0
100003b0: 39 29 00 00 addi    r9,r9,0
100003b4: 2f 89 00 00 cmpwi   cr7,r9,0
100003b8: 4d 9e 00 20 beqlr   cr7
100003bc: 7d 29 03 a6 mtctr   r9
100003c0: 4e 80 04 20 bctr

100003c4 <__do_global_dtors_aux>:
100003c4: 94 21 ff e0 stwu    r1,-32(r1)
100003c8: 7c 08 02 a6 mflr    r0
100003cc: 93 81 00 10 stw     r28,16(r1)
100003d0: 3f 80 10 01 lis     r28,4097
100003d4: 89 3c 08 a4 lbz     r9,2212(r28)
100003d8: 90 01 00 24 stw     r0,36(r1)
100003dc: 93 a1 00 14 stw     r29,20(r1)
100003e0: 2f 89 00 00 cmpwi   cr7,r9,0
100003e4: 93 c1 00 18 stw     r30,24(r1)
100003e8: 93 e1 00 1c stw     r31,28(r1)
100003ec: 40 9e 00 64 bne-    cr7,10000450 <__do_global_dtors_aux+0x8c>
100003f0: 3f a0 10 01 lis     r29,4097
100003f4: 3f c0 10 01 lis     r30,4097
100003f8: 3f e0 10 01 lis     r31,4097
100003fc: 3b bd 07 28 addi    r29,r29,1832
10000400: 3b de 07 2c addi    r30,r30,1836
10000404: 81 3f 08 a8 lwz     r9,2216(r31)
10000408: 7f dd f0 50 subf    r30,r29,r30
1000040c: 3b ff 08 a8 addi    r31,r31,2216
10000410: 7f de 16 70 srawi   r30,r30,2
10000414: 3b de ff ff addi    r30,r30,-1
10000418: 7f 89 f0 40 cmplw   cr7,r9,r30
1000041c: 40 9c 00 28 bge-    cr7,10000444 <__do_global_dtors_aux+0x80>
10000420: 39 29 00 01 addi    r9,r9,1
10000424: 55 2a 10 3a rlwinm  r10,r9,2,0,29
10000428: 91 3f 00 00 stw     r9,0(r31)
1000042c: 7d 3d 50 2e lwzx    r9,r29,r10
10000430: 7d 29 03 a6 mtctr   r9
10000434: 4e 80 04 21 bctrl
10000438: 81 3f 00 00 lwz     r9,0(r31)
1000043c: 7f 89 f0 40 cmplw   cr7,r9,r30
10000440: 41 9c ff e0 blt+    cr7,10000420 <__do_global_dtors_aux+0x5c>
10000444: 4b ff ff 0d bl      10000350 <deregister_tm_clones>
10000448: 39 20 00 01 li      r9,1
1000044c: 99 3c 08 a4 stb     r9,2212(r28)
10000450: 80 01 00 24 lwz     r0,36(r1)
10000454: 83 81 00 10 lwz     r28,16(r1)
10000458: 83 a1 00 14 lwz     r29,20(r1)
1000045c: 7c 08 03 a6 mtlr    r0
10000460: 83 c1 00 18 lwz     r30,24(r1)
10000464: 83 e1 00 1c lwz     r31,28(r1)
10000468: 38 21 00 20 addi    r1,r1,32
1000046c: 4e 80 00 20 blr

10000470 <call___do_global_dtors_aux>:
10000470: 94 21 ff f0 stwu    r1,-16(r1)
10000474: 7c 08 02 a6 mflr    r0
10000478: 90 01 00 14 stw     r0,20(r1)
1000047c: 80 01 00 14 lwz     r0,20(r1)
10000480: 38 21 00 10 addi    r1,r1,16
10000484: 7c 08 03 a6 mtlr    r0
10000488: 4e 80 00 20 blr

1000048c <frame_dummy>:
1000048c: 3c 60 10 01 lis     r3,4097
10000490: 81 23 07 30 lwz     r9,1840(r3)
10000494: 38 63 07 30 addi    r3,r3,1840
10000498: 2f 89 00 00 cmpwi   cr7,r9,0
1000049c: 41 9e 00 38 beq-    cr7,100004d4 <frame_dummy+0x48>
100004a0: 3d 20 00 00 lis     r9,0
100004a4: 39 29 00 00 addi    r9,r9,0
100004a8: 2f 89 00 00 cmpwi   cr7,r9,0
100004ac: 41 9e 00 28 beq-    cr7,100004d4 <frame_dummy+0x48>
100004b0: 94 21 ff f0 stwu    r1,-16(r1)
100004b4: 7c 08 02 a6 mflr    r0
100004b8: 7d 29 03 a6 mtctr   r9
100004bc: 90 01 00 14 stw     r0,20(r1)
100004c0: 4e 80 04 21 bctrl
100004c4: 80 01 00 14 lwz     r0,20(r1)
100004c8: 38 21 00 10 addi    r1,r1,16
100004cc: 7c 08 03 a6 mtlr    r0
100004d0: 4b ff fe b8 b       10000388 <register_tm_clones>
100004d4: 4b ff fe b4 b       10000388 <register_tm_clones>

100004d8 <call_frame_dummy>:
100004d8: 94 21 ff f0 stwu    r1,-16(r1)
100004dc: 7c 08 02 a6 mflr    r0
100004e0: 90 01 00 14 stw     r0,20(r1)
100004e4: 80 01 00 14 lwz     r0,20(r1)
100004e8: 38 21 00 10 addi    r1,r1,16
100004ec: 7c 08 03 a6 mtlr    r0
100004f0: 4e 80 00 20 blr

100004f4 <main>:
100004f4: 94 21 ff f0 stwu    r1,-16(r1)
100004f8: 7c 08 02 a6 mflr    r0
100004fc: 90 01 00 14 stw     r0,20(r1)
10000500: 93 e1 00 0c stw     r31,12(r1)
10000504: 7c 3f 0b 78 mr      r31,r1
10000508: 38 60 00 0a li      r3,10
1000050c: 48 01 03 7d bl      10010888 <putchar@plt>
10000510: 3d 20 10 00 lis     r9,4096
10000514: 38 69 06 b8 addi    r3,r9,1720
10000518: 3d 20 10 00 lis     r9,4096
1000051c: 38 89 06 d0 addi    r4,r9,1744
10000520: 48 01 03 49 bl      10010868 <printf@plt>
10000524: 3d 20 3b 9a lis     r9,15258
10000528: 61 23 c9 ff ori     r3,r9,51711
1000052c: 48 01 03 45 bl      10010870 <sleep@plt>
10000530: 39 20 00 00 li      r9,0
10000534: 7d 23 4b 78 mr      r3,r9
10000538: 39 7f 00 10 addi    r11,r31,16
1000053c: 80 0b 00 04 lwz     r0,4(r11)
10000540: 7c 08 03 a6 mtlr    r0
10000544: 83 eb ff fc lwz     r31,-4(r11)
10000548: 7d 61 5b 78 mr      r1,r11
1000054c: 4e 80 00 20 blr
10000550: 00 01 81 d4 .long 0x181d4

10000554 <__libc_csu_init>:
10000554: 94 21 ff d0 stwu    r1,-48(r1)
10000558: 7c 08 02 a6 mflr    r0
1000055c: 42 9f 00 05 bcl-    20,4*cr7+so,10000560 <__libc_csu_init+0xc>
10000560: 93 c1 00 28 stw     r30,40(r1)
10000564: 7f c8 02 a6 mflr    r30
10000568: 90 01 00 34 stw     r0,52(r1)
1000056c: 80 1e ff f0 lwz     r0,-16(r30)
10000570: 93 21 00 14 stw     r25,20(r1)
10000574: 7c 79 1b 78 mr      r25,r3
10000578: 93 41 00 18 stw     r26,24(r1)
1000057c: 7c 9a 23 78 mr      r26,r4
10000580: 7f c0 f2 14 add     r30,r0,r30
10000584: 93 61 00 1c stw     r27,28(r1)
10000588: 93 81 00 20 stw     r28,32(r1)
1000058c: 7c bb 2b 78 mr      r27,r5
10000590: 93 a1 00 24 stw     r29,36(r1)
10000594: 93 e1 00 2c stw     r31,44(r1)
10000598: 4b ff fd 49 bl      100002e0 <_init>
1000059c: 81 3e 80 04 lwz     r9,-32764(r30)
100005a0: 3b e0 00 00 li      r31,0
100005a4: 83 9e 80 00 lwz     r28,-32768(r30)
100005a8: 3b a9 ff fc addi    r29,r9,-4
100005ac: 7f 89 e0 50 subf    r28,r9,r28
100005b0: 7f 9c 16 71 srawi.  r28,r28,2
100005b4: 41 82 00 28 beq-    100005dc <__libc_csu_init+0x88>
100005b8: 85 3d 00 04 lwzu    r9,4(r29)
100005bc: 7f 23 cb 78 mr      r3,r25
100005c0: 7f 44 d3 78 mr      r4,r26
100005c4: 7f 65 db 78 mr      r5,r27
100005c8: 3b ff 00 01 addi    r31,r31,1
100005cc: 7d 29 03 a6 mtctr   r9
100005d0: 4e 80 04 21 bctrl
100005d4: 7f 9f e0 00 cmpw    cr7,r31,r28
100005d8: 40 9e ff e0 bne+    cr7,100005b8 <__libc_csu_init+0x64>
100005dc: 80 01 00 34 lwz     r0,52(r1)
100005e0: 83 21 00 14 lwz     r25,20(r1)
100005e4: 83 41 00 18 lwz     r26,24(r1)
100005e8: 7c 08 03 a6 mtlr    r0
100005ec: 83 61 00 1c lwz     r27,28(r1)
100005f0: 83 81 00 20 lwz     r28,32(r1)
100005f4: 83 a1 00 24 lwz     r29,36(r1)
100005f8: 83 c1 00 28 lwz     r30,40(r1)
100005fc: 83 e1 00 2c lwz     r31,44(r1)
10000600: 38 21 00 30 addi    r1,r1,48
10000604: 4e 80 00 20 blr

10000608 <__libc_csu_fini>:
10000608: 4e 80 00 20 blr

1000060c <__do_global_ctors_aux>:
1000060c: 94 21 ff f0 stwu    r1,-16(r1)
10000610: 7c 08 02 a6 mflr    r0
10000614: 90 01 00 14 stw     r0,20(r1)
10000618: 93 e1 00 0c stw     r31,12(r1)
1000061c: 3f e0 10 01 lis     r31,4097
10000620: 3b ff 07 24 addi    r31,r31,1828
10000624: 85 3f ff fc lwzu    r9,-4(r31)
10000628: 2f 89 ff ff cmpwi   cr7,r9,-1
1000062c: 41 9e 00 18 beq-    cr7,10000644 <__do_global_ctors_aux+0x38>
10000630: 7d 29 03 a6 mtctr   r9
10000634: 4e 80 04 21 bctrl
10000638: 85 3f ff fc lwzu    r9,-4(r31)
1000063c: 2f 89 ff ff cmpwi   cr7,r9,-1
10000640: 40 9e ff f0 bne+    cr7,10000630 <__do_global_ctors_aux+0x24>
10000644: 80 01 00 14 lwz     r0,20(r1)
10000648: 83 e1 00 0c lwz     r31,12(r1)
1000064c: 38 21 00 10 addi    r1,r1,16
10000650: 7c 08 03 a6 mtlr    r0
10000654: 4e 80 00 20 blr

10000658 <call___do_global_ctors_aux>:
10000658: 94 21 ff f0 stwu    r1,-16(r1)
1000065c: 7c 08 02 a6 mflr    r0
10000660: 90 01 00 14 stw     r0,20(r1)
10000664: 80 01 00 14 lwz     r0,20(r1)
10000668: 38 21 00 10 addi    r1,r1,16
1000066c: 7c 08 03 a6 mtlr    r0
10000670: 4e 80 00 20 blr


${CROSS_COMPILE}objdump -d -j .data helloworlddynamic

helloworlddynamic:     file format elf32-powerpc


Disassembly of section .data:

10010804 <__data_start>:
10010804: 00 00 00 00 .long 0x0

10010808 <__dso_handle>:
10010808: 00 00 00 00                                         ....


I'm not sure what to infer with all this data, what should I be looking at or checking, to try to find out what's going wrong with dynamic linked programs built with gcc-4.7.2 for PowerPC440 ?

Best regards,

Elvis Dowson


Elvis Dowson
 

Hi,

On Aug 4, 2012, at 5:56 PM, Elvis Dowson wrote:

On Aug 4, 2012, at 6:24 AM, Khem Raj wrote:

OK couple of things.  You could boot into static bash thats good, keep it that way and bundle some dynamically linked programs into the root file system
may be just a hello world which is dynamically linked. I would also compile a static version of gdb and strace but that could be next steps.

then boot into this static shell and try to run the dynamically linked hello world. Does that work ?
if not we have a dynamic linking issue. 

Then you can go a step deeper and see whats going on. Many  a times interpreter is specified wrongly in the elf file.
and there could be dynamic linker issues too. But step at a time.

I created a new 16GB ramdisk file, and put the core-image-minimal root filesystem into it. I then created a static version and a dynamic version of the helloworld program.

I find that the static version of the helloworld loads okay, but the dynamic version of the helloworld program doesn't give any output.

I guess this means we have a dynamic linking issue. 


In the objdump I see two version references for glibc, is that normal?

Version References:
  required from libc.so.6:
    0x0d696910 0x00 03 GLIBC_2.0
    0x0d696914 0x00 02 GLIBC_2.4


Here is the full output of the readelf -a helloworlddynamic executable:

${CROSS_COMPILE}readelf -a helloworlddynamic
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           PowerPC
  Version:                           0x1
  Entry point address:               0x1000032c
  Start of program headers:          52 (bytes into file)
  Start of section headers:          4216 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         36
  Section header string table index: 33

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        10000134 000134 00000d 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            10000144 000144 000020 00   A  0   0  4
  [ 3] .gnu.hash         GNU_HASH        10000164 000164 000020 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          10000184 000184 000070 10   A  5   1  4
  [ 5] .dynstr           STRTAB          100001f4 0001f4 000064 00   A  0   0  1
  [ 6] .gnu.version      VERSYM          10000258 000258 00000e 02   A  4   0  2
  [ 7] .gnu.version_r    VERNEED         10000268 000268 000030 00   A  5   1  4
  [ 8] .rela.dyn         RELA            10000298 000298 00000c 0c   A  4   0  4
  [ 9] .rela.plt         RELA            100002a4 0002a4 00003c 0c   A  4  23  4
  [10] .init             PROGBITS        100002e0 0002e0 00004c 00  AX  0   0  4
  [11] .text             PROGBITS        1000032c 00032c 000348 00  AX  0   0  4
  [12] .fini             PROGBITS        10000674 000674 000030 00  AX  0   0  4
  [13] .rodata           PROGBITS        100006a4 0006a4 000039 00   A  0   0  4
  [14] .eh_frame_hdr     PROGBITS        100006e0 0006e0 000014 00   A  0   0  4
  [15] .eh_frame         PROGBITS        100006f4 0006f4 00002c 00   A  0   0  4
  [16] .ctors            PROGBITS        10010720 000720 000008 00  WA  0   0  4
  [17] .dtors            PROGBITS        10010728 000728 000008 00  WA  0   0  4
  [18] .jcr              PROGBITS        10010730 000730 000004 00  WA  0   0  4
  [19] .got2             PROGBITS        10010734 000734 000008 00  WA  0   0  1
  [20] .dynamic          DYNAMIC         1001073c 00073c 0000c8 08  WA  5   0  4
  [21] .data             PROGBITS        10010804 000804 000008 00  WA  0   0  4
  [22] .got              PROGBITS        1001080c 00080c 000014 04 WAX  0   0  4
  [23] .plt              NOBITS          10010820 000820 000084 00 WAX  0   0  4
  [24] .bss              NOBITS          100108a4 000820 000008 00  WA  0   0  4
  [25] .comment          PROGBITS        00000000 000820 000027 01  MS  0   0  1
  [26] .debug_aranges    PROGBITS        00000000 000847 000038 00      0   0  1
  [27] .debug_info       PROGBITS        00000000 00087f 0001d6 00      0   0  1
  [28] .debug_abbrev     PROGBITS        00000000 000a55 00014d 00      0   0  1
  [29] .debug_line       PROGBITS        00000000 000ba2 000113 00      0   0  1
  [30] .debug_frame      PROGBITS        00000000 000cb8 00005c 00      0   0  4
  [31] .debug_str        PROGBITS        00000000 000d14 000154 01  MS  0   0  1
  [32] .debug_loc        PROGBITS        00000000 000e68 0000cf 00      0   0  1
  [33] .shstrtab         STRTAB          00000000 000f37 000140 00      0   0  1
  [34] .symtab           SYMTAB          00000000 001618 000520 10     35  58  4
  [35] .strtab           STRTAB          00000000 001b38 0002d6 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x10000134 0x10000134 0x0000d 0x0000d R   0x1
      [Requesting program interpreter: /lib/ld.so.1]
  LOAD           0x000000 0x10000000 0x10000000 0x00720 0x00720 R E 0x10000
  LOAD           0x000720 0x10010720 0x10010720 0x00100 0x0018c RWE 0x10000
  DYNAMIC        0x00073c 0x1001073c 0x1001073c 0x000c8 0x000c8 RW  0x4
  NOTE           0x000144 0x10000144 0x10000144 0x00020 0x00020 R   0x4
  GNU_EH_FRAME   0x0006e0 0x100006e0 0x100006e0 0x00014 0x00014 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata .eh_frame_hdr .eh_frame 
   03     .ctors .dtors .jcr .got2 .dynamic .data .got .plt .bss 
   04     .dynamic 
   05     .note.ABI-tag 
   06     .eh_frame_hdr 
   07     

Dynamic section at offset 0x73c contains 20 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x100002e0
 0x0000000d (FINI)                       0x10000674
 0x6ffffef5 (GNU_HASH)                   0x10000164
 0x00000005 (STRTAB)                     0x100001f4
 0x00000006 (SYMTAB)                     0x10000184
 0x0000000a (STRSZ)                      100 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x10010820
 0x00000002 (PLTRELSZ)                   60 (bytes)
 0x00000014 (PLTREL)                     RELA
 0x00000017 (JMPREL)                     0x100002a4
 0x00000007 (RELA)                       0x10000298
 0x00000008 (RELASZ)                     72 (bytes)
 0x00000009 (RELAENT)                    12 (bytes)
 0x6ffffffe (VERNEED)                    0x10000268
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x10000258
 0x00000000 (NULL)                       0x0

Relocation section '.rela.dyn' at offset 0x298 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
1001080c  00000314 R_PPC_GLOB_DAT    00000000   __gmon_start__ + 0

Relocation section '.rela.plt' at offset 0x2a4 contains 5 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
10010868  00000115 R_PPC_JMP_SLOT    00000000   printf + 0
10010870  00000215 R_PPC_JMP_SLOT    00000000   sleep + 0
10010878  00000315 R_PPC_JMP_SLOT    00000000   __gmon_start__ + 0
10010880  00000415 R_PPC_JMP_SLOT    00000000   __libc_start_main + 0
10010888  00000515 R_PPC_JMP_SLOT    00000000   putchar + 0

There are no unwind sections in this file.

Symbol table '.dynsym' contains 7 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 FUNC    GLOBAL DEFAULT  UND printf@... (2)
     2: 00000000     0 FUNC    GLOBAL DEFAULT  UND sleep@... (3)
     3: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
     4: 00000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@... (3)
     5: 00000000     0 FUNC    GLOBAL DEFAULT  UND putchar@... (3)
     6: 100006b4     4 OBJECT  GLOBAL DEFAULT   13 _IO_stdin_used

Symbol table '.symtab' contains 82 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 10000134     0 SECTION LOCAL  DEFAULT    1 
     2: 10000144     0 SECTION LOCAL  DEFAULT    2 
     3: 10000164     0 SECTION LOCAL  DEFAULT    3 
     4: 10000184     0 SECTION LOCAL  DEFAULT    4 
     5: 100001f4     0 SECTION LOCAL  DEFAULT    5 
     6: 10000258     0 SECTION LOCAL  DEFAULT    6 
     7: 10000268     0 SECTION LOCAL  DEFAULT    7 
     8: 10000298     0 SECTION LOCAL  DEFAULT    8 
     9: 100002a4     0 SECTION LOCAL  DEFAULT    9 
    10: 100002e0     0 SECTION LOCAL  DEFAULT   10 
    11: 1000032c     0 SECTION LOCAL  DEFAULT   11 
    12: 10000674     0 SECTION LOCAL  DEFAULT   12 
    13: 100006a4     0 SECTION LOCAL  DEFAULT   13 
    14: 100006e0     0 SECTION LOCAL  DEFAULT   14 
    15: 100006f4     0 SECTION LOCAL  DEFAULT   15 
    16: 10010720     0 SECTION LOCAL  DEFAULT   16 
    17: 10010728     0 SECTION LOCAL  DEFAULT   17 
    18: 10010730     0 SECTION LOCAL  DEFAULT   18 
    19: 10010734     0 SECTION LOCAL  DEFAULT   19 
    20: 1001073c     0 SECTION LOCAL  DEFAULT   20 
    21: 10010804     0 SECTION LOCAL  DEFAULT   21 
    22: 1001080c     0 SECTION LOCAL  DEFAULT   22 
    23: 10010820     0 SECTION LOCAL  DEFAULT   23 
    24: 100108a4     0 SECTION LOCAL  DEFAULT   24 
    25: 00000000     0 SECTION LOCAL  DEFAULT   25 
    26: 00000000     0 SECTION LOCAL  DEFAULT   26 
    27: 00000000     0 SECTION LOCAL  DEFAULT   27 
    28: 00000000     0 SECTION LOCAL  DEFAULT   28 
    29: 00000000     0 SECTION LOCAL  DEFAULT   29 
    30: 00000000     0 SECTION LOCAL  DEFAULT   30 
    31: 00000000     0 SECTION LOCAL  DEFAULT   31 
    32: 00000000     0 SECTION LOCAL  DEFAULT   32 
    33: 00000000     0 FILE    LOCAL  DEFAULT  ABS init.c
    34: 00000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    35: 10010720     0 OBJECT  LOCAL  DEFAULT   16 __CTOR_LIST__
    36: 10010728     0 OBJECT  LOCAL  DEFAULT   17 __DTOR_LIST__
    37: 10010730     0 OBJECT  LOCAL  DEFAULT   18 __JCR_LIST__
    38: 10000350     0 FUNC    LOCAL  DEFAULT   11 deregister_tm_clones
    39: 10000388     0 FUNC    LOCAL  DEFAULT   11 register_tm_clones
    40: 100003c4     0 FUNC    LOCAL  DEFAULT   11 __do_global_dtors_aux
    41: 100108a4     1 OBJECT  LOCAL  DEFAULT   24 completed.6650
    42: 100108a8     4 OBJECT  LOCAL  DEFAULT   24 dtor_idx.6652
    43: 10000470     0 FUNC    LOCAL  DEFAULT   11 call___do_global_dtors_au
    44: 1000048c     0 FUNC    LOCAL  DEFAULT   11 frame_dummy
    45: 100004d8     0 FUNC    LOCAL  DEFAULT   11 call_frame_dummy
    46: 00000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    47: 10010724     0 OBJECT  LOCAL  DEFAULT   16 __CTOR_END__
    48: 1000071c     0 OBJECT  LOCAL  DEFAULT   15 __FRAME_END__
    49: 10010730     0 OBJECT  LOCAL  DEFAULT   18 __JCR_END__
    50: 1000060c     0 FUNC    LOCAL  DEFAULT   11 __do_global_ctors_aux
    51: 10000658     0 FUNC    LOCAL  DEFAULT   11 call___do_global_ctors_au
    52: 00000000     0 FILE    LOCAL  DEFAULT  ABS helloworld.c
    53: 00000000     0 FILE    LOCAL  DEFAULT  ABS elf-init.c
    54: 10010720     0 NOTYPE  LOCAL  DEFAULT   16 __init_array_end
    55: 1001073c     0 OBJECT  LOCAL  DEFAULT   20 _DYNAMIC
    56: 10010720     0 NOTYPE  LOCAL  DEFAULT   16 __init_array_start
    57: 10010814     0 OBJECT  LOCAL  DEFAULT   22 _GLOBAL_OFFSET_TABLE_
    58: 10000608     4 FUNC    GLOBAL DEFAULT   11 __libc_csu_fini
    59: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTab
    60: 10010804     0 NOTYPE  WEAK   DEFAULT   21 data_start
    61: 00000000     0 FUNC    GLOBAL DEFAULT  UND printf@@GLIBC_2.4
    62: 10010820     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
    63: 00000000     0 FUNC    GLOBAL DEFAULT  UND sleep@@GLIBC_2.0
    64: 10000674     0 FUNC    GLOBAL DEFAULT   12 _fini
    65: 1001072c     0 OBJECT  GLOBAL HIDDEN    17 __DTOR_END__
    66: 10010804     0 NOTYPE  GLOBAL DEFAULT   21 __data_start
    67: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    68: 10010808     0 OBJECT  GLOBAL HIDDEN    21 __dso_handle
    69: 100006b4     4 OBJECT  GLOBAL DEFAULT   13 _IO_stdin_used
    70: 00000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@@GLIBC_
    71: 10000554   180 FUNC    GLOBAL DEFAULT   11 __libc_csu_init
    72: 10018820     0 NOTYPE  GLOBAL DEFAULT   22 _SDA_BASE_
    73: 00000000     0 FUNC    GLOBAL DEFAULT  UND putchar@@GLIBC_2.0
    74: 100108ac     0 NOTYPE  GLOBAL DEFAULT  ABS _end
    75: 1000032c    36 FUNC    GLOBAL DEFAULT   11 _start
    76: 10010820     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
    77: 100004f4    92 FUNC    GLOBAL DEFAULT   11 main
    78: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    79: 1001080c     0 OBJECT  GLOBAL HIDDEN    21 __TMC_END__
    80: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
    81: 100002e0     0 FUNC    GLOBAL DEFAULT   10 _init

Histogram for `.gnu.hash' bucket list length (total of 2 buckets):
 Length  Number     % of total  Coverage
      0  1          ( 50.0%)
      1  1          ( 50.0%)    100.0%

Version symbols section '.gnu.version' contains 7 entries:
 Addr: 0000000010000258  Offset: 0x000258  Link: 4 (.dynsym)
  000:   0 (*local*)       2 (GLIBC_2.4)     3 (GLIBC_2.0)     0 (*local*)    
  004:   3 (GLIBC_2.0)     3 (GLIBC_2.0)     1 (*global*)   

Version needs section '.gnu.version_r' contains 1 entries:
 Addr: 0x0000000010000268  Offset: 0x000268  Link: 5 (.dynstr)
  000000: Version: 1  File: libc.so.6  Cnt: 2
  0x0010:   Name: GLIBC_2.0  Flags: none  Version: 3
  0x0020:   Name: GLIBC_2.4  Flags: none  Version: 2

Notes at offset 0x00000144 with length 0x00000020:
  Owner                 Data size Description
  GNU                  0x00000010 NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 2.6.16


Here is the output of the objdump -x command:

${CROSS_COMPILE}objdump -x helloworlddynamic

helloworlddynamic:     file format elf32-powerpc
helloworlddynamic
architecture: powerpc:common, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x1000032c

Program Header:
    PHDR off    0x00000034 vaddr 0x10000034 paddr 0x10000034 align 2**2
         filesz 0x00000100 memsz 0x00000100 flags r-x
  INTERP off    0x00000134 vaddr 0x10000134 paddr 0x10000134 align 2**0
         filesz 0x0000000d memsz 0x0000000d flags r--
    LOAD off    0x00000000 vaddr 0x10000000 paddr 0x10000000 align 2**16
         filesz 0x00000720 memsz 0x00000720 flags r-x
    LOAD off    0x00000720 vaddr 0x10010720 paddr 0x10010720 align 2**16
         filesz 0x00000100 memsz 0x0000018c flags rwx
 DYNAMIC off    0x0000073c vaddr 0x1001073c paddr 0x1001073c align 2**2
         filesz 0x000000c8 memsz 0x000000c8 flags rw-
    NOTE off    0x00000144 vaddr 0x10000144 paddr 0x10000144 align 2**2
         filesz 0x00000020 memsz 0x00000020 flags r--
EH_FRAME off    0x000006e0 vaddr 0x100006e0 paddr 0x100006e0 align 2**2
         filesz 0x00000014 memsz 0x00000014 flags r--
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-

Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x100002e0
  FINI                 0x10000674
  GNU_HASH             0x10000164
  STRTAB               0x100001f4
  SYMTAB               0x10000184
  STRSZ                0x00000064
  SYMENT               0x00000010
  DEBUG                0x00000000
  PLTGOT               0x10010820
  PLTRELSZ             0x0000003c
  PLTREL               0x00000007
  JMPREL               0x100002a4
  RELA                 0x10000298
  RELASZ               0x00000048
  RELAENT              0x0000000c
  VERNEED              0x10000268
  VERNEEDNUM           0x00000001
  VERSYM               0x10000258

Version References:
  required from libc.so.6:
    0x0d696910 0x00 03 GLIBC_2.0
    0x0d696914 0x00 02 GLIBC_2.4

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       0000000d  10000134  10000134  00000134  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  10000144  10000144  00000144  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .gnu.hash     00000020  10000164  10000164  00000164  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000070  10000184  10000184  00000184  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       00000064  100001f4  100001f4  000001f4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  0000000e  10000258  10000258  00000258  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000030  10000268  10000268  00000268  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rela.dyn     0000000c  10000298  10000298  00000298  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.plt     0000003c  100002a4  100002a4  000002a4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         0000004c  100002e0  100002e0  000002e0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .text         00000348  1000032c  1000032c  0000032c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .fini         00000030  10000674  10000674  00000674  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .rodata       00000039  100006a4  100006a4  000006a4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 .eh_frame_hdr 00000014  100006e0  100006e0  000006e0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 .eh_frame     0000002c  100006f4  100006f4  000006f4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .ctors        00000008  10010720  10010720  00000720  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 16 .dtors        00000008  10010728  10010728  00000728  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .jcr          00000004  10010730  10010730  00000730  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .got2         00000008  10010734  10010734  00000734  2**0
                  CONTENTS, ALLOC, LOAD, DATA
 19 .dynamic      000000c8  1001073c  1001073c  0000073c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .data         00000008  10010804  10010804  00000804  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 21 .got          00000014  1001080c  1001080c  0000080c  2**2
                  CONTENTS, ALLOC, LOAD, CODE
 22 .plt          00000084  10010820  10010820  00000820  2**2
                  ALLOC, CODE
 23 .bss          00000008  100108a4  100108a4  00000820  2**2
                  ALLOC
 24 .comment      00000027  00000000  00000000  00000820  2**0
                  CONTENTS, READONLY
 25 .debug_aranges 00000038  00000000  00000000  00000847  2**0
                  CONTENTS, READONLY, DEBUGGING
 26 .debug_info   000001d6  00000000  00000000  0000087f  2**0
                  CONTENTS, READONLY, DEBUGGING
 27 .debug_abbrev 0000014d  00000000  00000000  00000a55  2**0
                  CONTENTS, READONLY, DEBUGGING
 28 .debug_line   00000113  00000000  00000000  00000ba2  2**0
                  CONTENTS, READONLY, DEBUGGING
 29 .debug_frame  0000005c  00000000  00000000  00000cb8  2**2
                  CONTENTS, READONLY, DEBUGGING
 30 .debug_str    00000154  00000000  00000000  00000d14  2**0
                  CONTENTS, READONLY, DEBUGGING
 31 .debug_loc    000000cf  00000000  00000000  00000e68  2**0
                  CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
10000134 l    d  .interp 00000000              .interp
10000144 l    d  .note.ABI-tag 00000000              .note.ABI-tag
10000164 l    d  .gnu.hash 00000000              .gnu.hash
10000184 l    d  .dynsym 00000000              .dynsym
100001f4 l    d  .dynstr 00000000              .dynstr
10000258 l    d  .gnu.version 00000000              .gnu.version
10000268 l    d  .gnu.version_r 00000000              .gnu.version_r
10000298 l    d  .rela.dyn 00000000              .rela.dyn
100002a4 l    d  .rela.plt 00000000              .rela.plt
100002e0 l    d  .init 00000000              .init
1000032c l    d  .text 00000000              .text
10000674 l    d  .fini 00000000              .fini
100006a4 l    d  .rodata 00000000              .rodata
100006e0 l    d  .eh_frame_hdr 00000000              .eh_frame_hdr
100006f4 l    d  .eh_frame 00000000              .eh_frame
10010720 l    d  .ctors 00000000              .ctors
10010728 l    d  .dtors 00000000              .dtors
10010730 l    d  .jcr 00000000              .jcr
10010734 l    d  .got2 00000000              .got2
1001073c l    d  .dynamic 00000000              .dynamic
10010804 l    d  .data 00000000              .data
1001080c l    d  .got 00000000              .got
10010820 l    d  .plt 00000000              .plt
100108a4 l    d  .bss 00000000              .bss
00000000 l    d  .comment 00000000              .comment
00000000 l    d  .debug_aranges 00000000              .debug_aranges
00000000 l    d  .debug_info 00000000              .debug_info
00000000 l    d  .debug_abbrev 00000000              .debug_abbrev
00000000 l    d  .debug_line 00000000              .debug_line
00000000 l    d  .debug_frame 00000000              .debug_frame
00000000 l    d  .debug_str 00000000              .debug_str
00000000 l    d  .debug_loc 00000000              .debug_loc
00000000 l    df *ABS* 00000000              init.c
00000000 l    df *ABS* 00000000              crtstuff.c
10010720 l     O .ctors 00000000              __CTOR_LIST__
10010728 l     O .dtors 00000000              __DTOR_LIST__
10010730 l     O .jcr 00000000              __JCR_LIST__
10000350 l     F .text 00000000              deregister_tm_clones
10000388 l     F .text 00000000              register_tm_clones
100003c4 l     F .text 00000000              __do_global_dtors_aux
100108a4 l     O .bss 00000001              completed.6650
100108a8 l     O .bss 00000004              dtor_idx.6652
10000470 l     F .text 00000000              call___do_global_dtors_aux
1000048c l     F .text 00000000              frame_dummy
100004d8 l     F .text 00000000              call_frame_dummy
00000000 l    df *ABS* 00000000              crtstuff.c
10010724 l     O .ctors 00000000              __CTOR_END__
1000071c l     O .eh_frame 00000000              __FRAME_END__
10010730 l     O .jcr 00000000              __JCR_END__
1000060c l     F .text 00000000              __do_global_ctors_aux
10000658 l     F .text 00000000              call___do_global_ctors_aux
00000000 l    df *ABS* 00000000              helloworld.c
00000000 l    df *ABS* 00000000              elf-init.c
10010720 l       .ctors 00000000              __init_array_end
1001073c l     O .dynamic 00000000              _DYNAMIC
10010720 l       .ctors 00000000              __init_array_start
10010814 l     O .got 00000000              _GLOBAL_OFFSET_TABLE_
10000608 g     F .text 00000004              __libc_csu_fini
00000000  w      *UND* 00000000              _ITM_deregisterTMCloneTable
10010804  w      .data 00000000              data_start
00000000       F *UND* 00000000              printf@@GLIBC_2.4
10010820 g       *ABS* 00000000              _edata
00000000       F *UND* 00000000              sleep@@GLIBC_2.0
10000674 g     F .fini 00000000              _fini
1001072c g     O .dtors 00000000              .hidden __DTOR_END__
10010804 g       .data 00000000              __data_start
00000000  w      *UND* 00000000              __gmon_start__
10010808 g     O .data 00000000              .hidden __dso_handle
100006b4 g     O .rodata 00000004              _IO_stdin_used
00000000       F *UND* 00000000              __libc_start_main@@GLIBC_2.0
10000554 g     F .text 000000b4              __libc_csu_init
10018820 g       .got 00000000              _SDA_BASE_
00000000       F *UND* 00000000              putchar@@GLIBC_2.0
100108ac g       *ABS* 00000000              _end
1000032c g     F .text 00000024              _start
10010820 g       *ABS* 00000000              __bss_start
100004f4 g     F .text 0000005c              main
00000000  w      *UND* 00000000              _Jv_RegisterClasses
1001080c g     O .data 00000000              .hidden __TMC_END__
00000000  w      *UND* 00000000              _ITM_registerTMCloneTable
100002e0 g     F .init 00000000              _init


Elvis Dowson


Khem Raj
 

On Sat, Aug 4, 2012 at 8:12 AM, Elvis Dowson <elvis.dowson@...> wrote:
/lib/ld.so.1
does this file exist on target ?


Elvis Dowson
 

Hi,

On Aug 4, 2012, at 8:31 PM, Khem Raj wrote:

On Sat, Aug 4, 2012 at 8:12 AM, Elvis Dowson <elvis.dowson@...> wrote:
/lib/ld.so.1
does this file exist on target ?
Yes, it does. It is a soft link to /lib/ld-2.16.so (136.4kb)

Both files exist on the target.

What should I do next?

Elvis Dowson


Khem Raj
 

On Sat, Aug 4, 2012 at 9:53 AM, Elvis Dowson <elvis.dowson@...> wrote:
Hi,

On Aug 4, 2012, at 8:31 PM, Khem Raj wrote:

On Sat, Aug 4, 2012 at 8:12 AM, Elvis Dowson <elvis.dowson@...> wrote:
/lib/ld.so.1
does this file exist on target ?
Yes, it does. It is a soft link to /lib/ld-2.16.so (136.4kb)

Both files exist on the target.

What should I do next?
Try to see if /lib/ld.so.1 runs ok ?

Then try

LD_DEBUG=all /lib/ld.so.1 ./helloworlddynamic
and see how far it goes.

Elvis Dowson


Elvis Dowson
 

Hi Khem,

On Aug 4, 2012, at 9:12 PM, Khem Raj wrote:

Try to see if /lib/ld.so.1 runs ok ?
How can I run /lib/ld.so.1?

Elvis Dowson


Khem Raj
 

On Sat, Aug 4, 2012 at 12:16 PM, Elvis Dowson <elvis.dowson@...> wrote:
Hi Khem,

On Aug 4, 2012, at 9:12 PM, Khem Raj wrote:

Try to see if /lib/ld.so.1 runs ok ?
How can I run /lib/ld.so.1?
/lib/ld.so.1

Elvis Dowson


Elvis Dowson
 

Hi,
        I decided to modify the bash and busybox recipes to build statically, and try to create a core-image-minimal root filesystem, so that I can get a sensible prompt with paths set, etc, to debug the dynamic linking issue.

Just copying a static bash binary to the root of the ramdisk image and specifying init=/bash didn't work for a static bash+core-image-minimal root filesystem, it aborts with a panic. If I have only the bash executable in the ramdisk and nothing else, it displays the bash prompt.

Now, I've noticed something weird during core-image-minimal image generation. 

When I build the static versions of bash, the size of the binary is 8MB, but when I explore the binary in the tar.gz image or extract it to my ramdisk, it shows as being only 1.6MB.

How can there be a difference between the statically built bash file 

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/bash-4.2-r4/image/bin/bash (8MB)

and in the file contained in the core-image-minimal-virtex-5.tar.gz 

/bin/bash (1.6MB)

I'm seeing the same discrepancy for busybox

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/busybox-1.19.4-r18/image/bin/busybox (8.2 MB)

and in the generate rootfs image

/bin/busybox (1.4MB)

This shouldn't happen, right? 

Best regards,

Elvis Dowson


Khem Raj
 

On Tue, Aug 7, 2012 at 1:10 PM, Elvis Dowson <elvis.dowson@...> wrote:
Hi,
I decided to modify the bash and busybox recipes to build
statically, and try to create a core-image-minimal root filesystem, so that
I can get a sensible prompt with paths set, etc, to debug the dynamic
linking issue.

Just copying a static bash binary to the root of the ramdisk image and
specifying init=/bash didn't work for a static bash+core-image-minimal root
filesystem, it aborts with a panic. If I have only the bash executable in
the ramdisk and nothing else, it displays the bash prompt.

Now, I've noticed something weird during core-image-minimal image
generation.

When I build the static versions of bash, the size of the binary is 8MB, but
when I explore the binary in the tar.gz image or extract it to my ramdisk,
it shows as being only 1.6MB.

How can there be a difference between the statically built bash file

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/bash-4.2-r4/image/bin/bash
(8MB)

and in the file contained in the core-image-minimal-virtex-5.tar.gz

/bin/bash (1.6MB)

I'm seeing the same discrepancy for busybox

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/busybox-1.19.4-r18/image/bin/busybox
(8.2 MB)

and in the generate rootfs image

/bin/busybox (1.4MB)

This shouldn't happen, right?
I assume they are stripped in case where they are smaller.


Best regards,

Elvis Dowson

_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Elvis Dowson
 

Hi,

On Aug 8, 2012, at 12:13 AM, Khem Raj wrote:

On Tue, Aug 7, 2012 at 1:10 PM, Elvis Dowson <elvis.dowson@...> wrote:
Hi,
       I decided to modify the bash and busybox recipes to build
statically, and try to create a core-image-minimal root filesystem, so that
I can get a sensible prompt with paths set, etc, to debug the dynamic
linking issue.

Just copying a static bash binary to the root of the ramdisk image and
specifying init=/bash didn't work for a static bash+core-image-minimal root
filesystem, it aborts with a panic. If I have only the bash executable in
the ramdisk and nothing else, it displays the bash prompt.

Now, I've noticed something weird during core-image-minimal image
generation.

When I build the static versions of bash, the size of the binary is 8MB, but
when I explore the binary in the tar.gz image or extract it to my ramdisk,
it shows as being only 1.6MB.

How can there be a difference between the statically built bash file

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/bash-4.2-r4/image/bin/bash
(8MB)

and in the file contained in the core-image-minimal-virtex-5.tar.gz

/bin/bash (1.6MB)

I'm seeing the same discrepancy for busybox

/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/busybox-1.19.4-r18/image/bin/busybox
(8.2 MB)

and in the generate rootfs image

/bin/busybox (1.4MB)

This shouldn't happen, right?

I assume they are stripped in case where they are smaller.

I tried running the newly created root filesystem, and passed init=/bin/bash to the kernel boot args, and get the kernel panic, as shown below. It doesn't happen when I just have only a static bash binary alone, in the ramdisk.

zImage starting: loaded at 0x00800000 (sp: 0x015cffb0)
Allocating 0x540e0c bytes for kernel ...
gunzipping (0x00000000 <- 0x0080f000:0x00a17de0)...done 0x4235c0 bytes
Attached initrd image at 0x00a18000-0x015cec21
initrd head: 0x1f8b0808

Linux/PowerPC load: console=ttyS0,9600n8 ip=off root=/dev/ram rw rootwait init=/bin/bash
Finalizing device tree... flat tree at 0x15dc0e0
 PM: Adding info for No Bus:ttyv9
[    0.555146] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.560456] 83e00000.serial: ttyS0 at MMIO 0x83e01003 (irq = 20) is a 16550
[    0.755976] console [ttyS0] enabled
[    0.820014] brd: module loaded
[    0.866758] loop: module loaded
[    0.903967] xsysace 83600000.sysace: Xilinx SystemACE revision 1.0.12
[    0.980712] xsysace 83600000.sysace: No CF in slot
[    1.039777] Xilinx SystemACE device driver, major=254
[    1.100658] xilinx_emaclite 81000000.ethernet: Device Tree Probing
[    1.174186] xilinx_emaclite 81000000.ethernet: error registering MDIO bus
[    1.255272] xilinx_emaclite 81000000.ethernet: MAC address is now 00:0a:35:b7:78:00
[    1.348888] xilinx_emaclite 81000000.ethernet: Xilinx EmacLite at 0x81000000 mapped to 0xD10A0000, irq=17
[    1.463802] xilinx_ps2 81480000.ps2: Device Tree Probing 'ps2'                                                           
[    1.533064] xilinx_ps2 81480000.ps2: Xilinx PS2 at 0x81480000 mapped to 0xd1036000, irq=22                               
[    1.632441] xilinx_ps2 81481000.ps2: Device Tree Probing 'ps2'                                                           
[    1.702118] xilinx_ps2 81481000.ps2: Xilinx PS2 at 0x81481000 mapped to 0xd1038000, irq=23                               
[    1.802689] mousedev: PS/2 mouse device common for all mice                                                              
[    1.870186] i2c /dev entries driver                                                                                      
[    1.911796] Device Tree Probing 'i2c'                                                                                    
[    1.956057] xilinx-iic #0 at 0x81600000 mapped to 0xD10C0000, irq=18                                                     
[    2.033628] TCP cubic registered                                                                                         
[    2.071533] NET: Registered protocol family 17                                                                           
[    2.866390] atkbd serio0: keyboard reset failed on xilinxps2/serio at 81480000                                           
[    3.350664] RAMDISK: gzip image found at block 0                                                                         
<7>[    3.870893] device: 'input0': device_add                                                                              
[    3.971153] input: AT Raw Set 2 keyboard as /devices/plb.0/xps-ps2.1/81481000.ps2/serio1/input/input0                    
[    6.262826] VFS: Mounted root (ext2 filesystem) on device 1:0.                                                           
[    6.332844] Freeing unused kernel memory: 152k freed                                                                     
[    6.439032] Kernel panic - not syncing: Attempted to kill init!                                                          
[    6.509122] Rebooting in 180 seconds..


I need bash to run, with a representative rootfilesystem, with all the libraries, so that I can run the commands that you asked me to earlier:

/lib/ld.so.1

and then

LD_DEBUG=all /lib/ld.so.1 ./helloworlddynamic

Is there something that I can disable to get static bash to run to the prompt, with the core-image-minimal image?

Elvis Dowson


Khem Raj
 

On Tue, Aug 7, 2012 at 1:24 PM, Elvis Dowson <elvis.dowson@...> wrote:

Is there something that I can disable to get static bash to run to the
prompt, with the core-image-minimal image?
well compile bash or dash as static and copy it manually into the
rootfile system
nfs root works well for such experiments. Do you have that option ?


Elvis Dowson
 

Hi,

On Aug 8, 2012, at 0:30, Khem Raj <raj.khem@...> wrote:

On Tue, Aug 7, 2012 at 1:24 PM, Elvis Dowson <elvis.dowson@...> wrote:

Is there something that I can disable to get static bash to run to the
prompt, with the core-image-minimal image?
well compile bash or dash as static and copy it manually into the
rootfile system
nfs root works well for such experiments. Do you have that option ?
I tired manually copying the static bash binary 8mb, over to the ramdisk root folder. The problem still manifests, if there is no other file other than the static bash file, it displays the prompt. If the core-minimal-console image exists, along with the static bash binary in the root location, it gives the kernel panic, as shown above.

Best regards,

Elvis


Elvis Dowson
 

Hi,
      I was just going through the recipes-devtools/gcc/gcc-common.inc file, and noticed the following snippet:

def get_gcc_multiarch_setting(bb, d):
    target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
    multiarch_options = {
        "i586":    "--enable-targets=all",
        "powerpc": "--enable-targets=powerpc64",
        "sparc":   "--enable-targets=all",
    }

My target is a 32-bit ppc440 cpu. What is the impact of an incorrectly set multiarch_options for powerpc to  powerpc64 on the final build? 

Elvis Dowson


Khem Raj
 

On Tue, Aug 7, 2012 at 7:36 PM, Elvis Dowson <elvis.dowson@...> wrote:
Hi,
I was just going through the recipes-devtools/gcc/gcc-common.inc file,
and noticed the following snippet:

def get_gcc_multiarch_setting(bb, d):
target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
multiarch_options = {
"i586": "--enable-targets=all",
"powerpc": "--enable-targets=powerpc64",
"sparc": "--enable-targets=all",
}

My target is a 32-bit ppc440 cpu. What is the impact of an incorrectly set
multiarch_options for powerpc to powerpc64 on the final build?

thats not a issue.

Elvis Dowson

_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto