Bug 427

Summary: poky-qemu fails when full path to rootfs image is given with -image- in its name
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Scott Garman <scott.a.garman>
Component: meta-yoctoAssignee: Scott Garman <scott.a.garman>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: dexuan.cui, jessica.zhang, kevin.tian, poky.bs.watcher, poky.watcher, richard.purdie, sgw
Version: 0.9   
Target Milestone: 0.9 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Program Management Documentation change: ---

Description Scott Garman 2010-10-11 13:16:07 UTC
This is one of the most common use scenarios, and needs an immediate fix.
Comment 2 Scott Garman 2010-10-11 15:42:13 UTC
Fixed with commit 364aaa6dfa706a6fe4afc85b5688a02daab75b26
Comment 3 Dexuan Cui 2010-10-14 02:06:04 UTC
I can still see the issue based on today's poky.git's master (commit a2337a34358b017a3e4311a2647165da2d8b54d3) and poky-contrib.git's builds/milestone (commit 5783e717ee9f503d8e03992306a6b9ddfda6f73e).

How to reproduce it:
1) git clone git://git.pokylinux.org/poky.git poky.git
2) cd poky.gi, bitbake qemu-native, bitbake qemu qemu-helper-native;
3) try to boot the images downloaded from nightly build like this:

$ poky-qemu qemux86 /distro/dcui/rc1/images/qemux86/bzImage-2.6.34+git0+bfef596973ae436db9132065eaab2228c98f938b_0+0431115c9d720fee5bb105f6a7411efb4f851d26-r7-qemux86-20101011175855.bin /distro/dcui/rc1/images/qemux86//poky-image-sdk-qemux86-20101011192127.rootfs.ext3

Continuing with the following parameters:
KERNEL: [/distro/dcui/rc1/images/qemux86/bzImage-2.6.34+git0+bfef596973ae436db9132065eaab2228c98f938b_0+0431115c9d720fee5bb105f6a7411efb4f851d26-r7-qemux86-20101011175855.bin]
ROOTFS: [/distro/dcui/rc1/images/qemux86//poky-image-sdk-qemux86-20101011192127.rootfs.ext3]
FSTYPE: [ext3]
Acquiring lockfile for tap0...
Setting up tap interface under sudo
[sudo] password for dcui:
sudo /distro/dcui/rc1/p/scripts/..//scripts/poky-qemu-ifup <gid> <native-sysroot-basedir>

The issue is caued by: POKY_NATIVE_SYSROOT is not set at all in scripts/poky-qemu-internal. 364aaa6dfa706a6fe4afc85b5688a02daab75b26(poky-qemu: fix for handling full path to rootfs) added:

+if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
+    # Extract the filename extension
+    EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
+    if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
+          "x$EXT" == "xjffs2" ]]; then
+        FSTYPE=$EXT
+    else
+        echo "Note: Unable to determine filesystem extension for $ROOTFS"
+        echo "We will use the default FSTYPE for $MACHINE"
+        # ...which is done further below...
+    fi
+fi

In my case, FSTYPE is set by this. As a result, setup_tmpdir() is not invoked at all and hence POKY_NATIVE_SYSROOT is not set. 
Currently I just commented the paragraph to work around the issue. I haven't had time to further debug and give a fix yet as I'm busy with rc1 testing.

Hi Scott, could you please have a look?

BTW: looks only I met with the issue? Not sure why the others in the team didn't complain. :-)
Comment 4 Scott Garman 2010-10-14 12:18:51 UTC
Thanks for the good analysis, Dexuan. I have now fixed this in commit 	7d7d35f369c271a7b7cf517601d472ab2104297b.
Comment 5 Saul Wold 2010-10-14 16:48:06 UTC
Tested with complete *-image-* on command line and it booted the correct image