Skip to contentSkip to conversation

lib/oe/image.py: fix working directory

PATCH In review Jonathan Liu 2 participants 5 messages Feb 17, 2014 – Feb 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/oe/image.py: fix working directory

The working directory needs to be changed before the image creation commands instead of afterwards.

---
 meta/lib/oe/image.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/image.py +1 -1
index c15296f..31193f2 100644
@@ -176,8 +176,8 @@ class Image(object):
             bb.data.update_data(localdata)
             localdata.setVar('type', type)
 
-            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
             cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
+            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
 
             if type in cimages:
                 for ctype in cimages[type]:
Signature · 1 line
1.8.5.4
#1 lore raw
Quoted 13 lines · Jonathan Liu

The working directory needs to be changed before the image creation commands instead of afterwards.

---
 meta/lib/oe/image.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/image.py +0 -0
index c15296f..31193f2 100644

meta/lib/oe/image.py class Image(object): · line 183

Quoted 9 lines
meta/lib/oe/image.py +1 -1
@@ -176,8 +176,8 @@ class Image(object):
             bb.data.update_data(localdata)
             localdata.setVar('type', type)
 
-            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
             cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
+            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
 
             if type in cimages:
                 for ctype in cimages[type]:

I applied this but ended up reverting it since its clear the image commands assume a different working directory and this causes failures.

I'd like to see more explanation about the problem this is trying to solve.

Cheers,

Richard

#2 lore raw
Quoted 26 lines · Richard Purdie
Quoted 13 lines · Jonathan Liu

The working directory needs to be changed before the image creation commands instead of afterwards.

---
  meta/lib/oe/image.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/image.py +0 -0
index c15296f..31193f2 100644

meta/lib/oe/image.py class Image(object): · line 183

Quoted 9 lines
meta/lib/oe/image.py +1 -1
@@ -176,8 +176,8 @@ class Image(object):
              bb.data.update_data(localdata)
              localdata.setVar('type', type)
 
-            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
              cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
+            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
 
              if type in cimages:
                  for ctype in cimages[type]:

I applied this but ended up reverting it since its clear the image commands assume a different working directory and this causes failures.

Quoted 7 lines

I'd like to see more explanation about the problem this is trying to solve.

Cheers,

Richard

The sdimg image classes in meta-raspberrypi and meta-sunxi broke when I switched from dora to master branch.
See: https://github.com/djwillis/meta-raspberrypi/blob/master/classes/sdcard_image-rpi.bbclass#L43
It is using relative path to rootfs which assumes the working directory is DEPLOY_DIR_IMAGE. I was able to build the SD card images fine after the fix.

Regards,
Jonathan

#3 lore raw
Quoted 28 lines · Jonathan Liu
Quoted 27 lines · Richard Purdie
Quoted 13 lines · Jonathan Liu

The working directory needs to be changed before the image creation commands instead of afterwards.

---
  meta/lib/oe/image.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/image.py +0 -0
index c15296f..31193f2 100644

meta/lib/oe/image.py class Image(object): · line 182

Quoted 7 lines
meta/lib/oe/image.py +1 -0
@@ -176,8 +176,8 @@ class Image(object):
              bb.data.update_data(localdata)
              localdata.setVar('type', type)
  -            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
              cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
+            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
                if type in cimages:
                  for ctype in cimages[type]:

I applied this but ended up reverting it since its clear the image commands assume a different working directory and this causes failures.

I'd like to see more explanation about the problem this is trying to solve.

Quoted 8 lines
Quoted 4 lines

Cheers,

Richard

The sdimg image classes in meta-raspberrypi and meta-sunxi broke when I switched from dora to master branch.
See: https://github.com/djwillis/meta-raspberrypi/blob/master/classes/sdcard_image-rpi.bbclass#L43
It is using relative path to rootfs which assumes the working directory is DEPLOY_DIR_IMAGE. I was able to build the SD card images fine after the fix.

Also, it makes absolutely no sense whatsoever to change working directory at the end of the function:

img_creation_func() {
    oe_mkext234fs ext4 -i 8192
    cd /home/build/poky/build/tmp/deploy/images/qemux86
}

...

img_creation_func

This would mean the last command executed in create_image.ext4 (see temp folder for image recipe) would be changing the directory.

Quoted 3 lines

Regards,
Jonathan

#4 lore raw
Quoted 47 lines · Jonathan Liu
Quoted 32 lines · Jonathan Liu
Quoted 24 lines · Richard Purdie
Quoted 13 lines · Jonathan Liu

The working directory needs to be changed before the image creation commands instead of afterwards.

---
  meta/lib/oe/image.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/image.py +0 -0
index c15296f..31193f2 100644

meta/lib/oe/image.py class Image(object): · line 182

Quoted 7 lines
meta/lib/oe/image.py +1 -0
@@ -176,8 +176,8 @@ class Image(object):
              bb.data.update_data(localdata)
              localdata.setVar('type', type)
  -            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
              cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
+            cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
                if type in cimages:
                  for ctype in cimages[type]:

I applied this but ended up reverting it since its clear the image commands assume a different working directory and this causes failures.

Quoted 7 lines

I'd like to see more explanation about the problem this is trying to solve.

Cheers,

Richard

Quoted 7 lines

The sdimg image classes in meta-raspberrypi and meta-sunxi broke when I switched from dora to master branch.
See:
https://github.com/djwillis/meta-raspberrypi/blob/master/classes/sdcard_image-rpi.bbclass#L43
It is using relative path to rootfs which assumes the working directory is DEPLOY_DIR_IMAGE.
I was able to build the SD card images fine after the fix.

Also, it makes absolutely no sense whatsoever to change working directory at the end of the function:

img_creation_func() {
     oe_mkext234fs ext4 -i 8192
     cd /home/build/poky/build/tmp/deploy/images/qemux86
}
Quoted 6 lines

...

img_creation_func

This would mean the last command executed in create_image.ext4 (see temp folder for image recipe) would be changing the directory.

Its being done for the compression code that immediately follows it. So it does make sense and its why changing it broke things.

Cheers,

Richard