Skip to contentSkip to conversation

image_types.bbclass: fix btrfs, ubifs and elf

PATCH NAK Robert Yang 3 participants 9 messages Apr 8, 2016

lore
Share & tools
lore
#0 lore raw

cover image_types.bbclass: fix btrfs, ubifs and elf

The following changes since commit 5ebea1114d54120d5ff5d8a6cd148110d0fda23f:

build-appliance-image: Update to master head revision (2016-04-06 23:54:57 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/img
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/img

Robert Yang (4):
image_types.bbclass: set nodesize for btrfs image_types.bbclass: fix ubi ubifs and multiubi image_types.bbclass: fix elf image-vm.bbclass/image_types.bbclass: IMAGE_NAME -> IMAGE_LINK_NAME

 meta/classes/image-vm.bbclass    |  2 +-
 meta/classes/image_types.bbclass | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 image_types.bbclass: set nodesize for btrfs

The default value is 16K which is too big to create image for core-image-minimal:
rootfs.btrfs is too small to make a usable filesystem Minimum size for each btrfs device is 41943040.

Use 4K as ext2/3/4 to fix the problem.

---
 meta/classes/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index 3e98024..3f97ddd 100644
@@ -218,7 +218,7 @@ EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLO
 EXTRA_IMAGECMD_ext2 ?= "-i 4096"
 EXTRA_IMAGECMD_ext3 ?= "-i 4096"
 EXTRA_IMAGECMD_ext4 ?= "-i 4096"
-EXTRA_IMAGECMD_btrfs ?= ""
+EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
 IMAGE_DEPENDS = ""
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 image_types.bbclass: fix ubi ubifs and multiubi

In reply to Robert Yang

Fixed when do_image_ubi:

| DEBUG: Executing shell function do_image_ubifs
| Error: min. I/O unit was not specified (use -h for help)
| WARNING: exit code 255 from a shell command.
---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +3 -0
index 3f97ddd..caa4dbb 100644
@@ -120,6 +120,9 @@ IMAGE_CMD_elf () {
 }
 IMAGE_TYPEDEP_elf = "cpio.gz"
 
+MKUBIFS_ARGS ?= "-m 1KiB -e 128KiB -c $ROOTFS_SIZE"
+UBINIZE_ARGS ?= "-m 1KiB -p 128KiB"
+
 UBI_VOLNAME ?= "${MACHINE}-rootfs"
 
 multiubi_mkfs() {
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/4] image_types.bbclass: fix ubi ubifs and multiubi

Hi Robert,

Quoted 15 lines · Robert Yang

Fixed when do_image_ubi:

| DEBUG: Executing shell function do_image_ubifs
| Error: min. I/O unit was not specified (use -h for help)
| WARNING: exit code 255 from a shell command.
---
 meta/classes/image_types.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/image_types.bbclass +0 -0
index 3f97ddd..caa4dbb 100644

meta/classes/image_types.bbclass IMAGE_CMD_elf () { · line 125

Quoted 6 lines
meta/classes/image_types.bbclass +3 -0
@@ -120,6 +120,9 @@ IMAGE_CMD_elf () {
 }
 IMAGE_TYPEDEP_elf = "cpio.gz"
 
+MKUBIFS_ARGS ?= "-m 1KiB -e 128KiB -c $ROOTFS_SIZE"
+UBINIZE_ARGS ?= "-m 1KiB -p 128KiB"
+

These are machine specific and are generally set in the machine configuration file. Default values you set here could be wrong in most cases, depending on the NAND chip.

Is it not better to get the error ? Then I know that I forget to set the two variables and I can easy fix it. If no error is raised, we get a ubifs that never run on the machine and as rootfs is not mounted - and finding the reason is much more difficult.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#4 lore raw

Re: [PATCH 2/4] image_types.bbclass: fix ubi ubifs and multiubi

Quoted 5 lines · Stefano Babic
Quoted 4 lines · Robert Yang

Fixed when do_image_ubi:

| DEBUG: Executing shell function do_image_ubifs
| Error: min. I/O unit was not specified (use -h for help)
| WARNING: exit code 255 from a shell command.

NAK

Quoted 8 lines

meta/classes/image_types.bbclass IMAGE_CMD_elf () { · line 125

Quoted 3 lines
meta/classes/image_types.bbclass +3 -0
+MKUBIFS_ARGS ?= "-m 1KiB -e 128KiB -c $ROOTFS_SIZE"
+UBINIZE_ARGS ?= "-m 1KiB -p 128KiB"
+

These are machine specific and are generally set in the machine configuration file. Default values you set here could be wrong in most cases, depending on the NAND chip.

Quoted 4 lines

Is it not better to get the error ? Then I know that I forget to set the two variables and I can easy fix it. If no error is raised, we get a ubifs that never run on the machine and as rootfs is not mounted - and finding the reason is much more difficult.

I agree with Stefano here; I'd also prefer a build failure instead of a non-working image.

Cheers,
Anders

Signature · 2 lines
Anders Darander, Senior System Architect
ChargeStorm AB / eStorm AB
#5 lore raw

Re: [PATCH 2/4] image_types.bbclass: fix ubi ubifs and multiubi

Quoted 17 lines · Anders Darander
Quoted 5 lines · Stefano Babic
Quoted 4 lines · Robert Yang

Fixed when do_image_ubi:

| DEBUG: Executing shell function do_image_ubifs
| Error: min. I/O unit was not specified (use -h for help)
| WARNING: exit code 255 from a shell command.

NAK

Quoted 7 lines

meta/classes/image_types.bbclass IMAGE_CMD_elf () { · line 125

Quoted 3 lines
meta/classes/image_types.bbclass +3 -0
+MKUBIFS_ARGS ?= "-m 1KiB -e 128KiB -c $ROOTFS_SIZE"
+UBINIZE_ARGS ?= "-m 1KiB -p 128KiB"
+

These are machine specific and are generally set in the machine configuration file. Default values you set here could be wrong in most cases, depending on the NAND chip.

Quoted 7 lines
Quoted 4 lines

Is it not better to get the error ? Then I know that I forget to set the two variables and I can easy fix it. If no error is raised, we get a ubifs that never run on the machine and as rootfs is not mounted - and finding the reason is much more difficult.

I agree with Stefano here; I'd also prefer a build failure instead of a non-working image.

My concerns was that if they can't be built out by default, then we have no idea about whether they work or not. But as you said ubifs is a little special, so I removed the patch from the repo. In YP 2.2, maybe we can make it work a with a qemu machine ?

// Robert

Quoted 4 lines

Cheers,
Anders

#6 lore raw

PATCH 3/4 image_types.bbclass: fix elf

In reply to Robert Yang

Fixed:

| DEBUG: Executing shell function do_image_elf
| Cannot open `/path/to/tmp/sysroots/qemux86-64/usr/src/kernel/bzImage': (null)
| WARNING: exit code 1 from a shell command.

The bzImage is in DEPLOY_DIR_IMAGE

---
 meta/classes/image_types.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +2 -1
index caa4dbb..0683c47 100644
@@ -111,13 +111,14 @@ IMAGE_CMD_cpio () {
 	fi
 }
 
-ELF_KERNEL ?= "${STAGING_DIR_HOST}/usr/src/kernel/${KERNEL_IMAGETYPE}"
+ELF_KERNEL ?= "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}"
 ELF_APPEND ?= "ramdisk_size=32768 root=/dev/ram0 rw console="
 
 IMAGE_CMD_elf () {
 	test -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf && rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf
 	mkelfImage --kernel=${ELF_KERNEL} --initrd=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio.gz --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf --append='${ELF_APPEND}' ${EXTRA_IMAGECMD}
 }
+
 IMAGE_TYPEDEP_elf = "cpio.gz"
 
 MKUBIFS_ARGS ?= "-m 1KiB -e 128KiB -c $ROOTFS_SIZE"
Signature · 1 line
2.7.4
#7 lore raw

PATCH 4/4 image-vm.bbclass/image_types.bbclass: IMAGE_NAME -> IMAGE_LINK_NAME

In reply to Robert Yang

If we create hdddirect in the first time, and run bitbake to create vmimg in the second time, then the previouse created ${IMAGE_LINK_NAME}.hdddirect may can not be found since it contains the data string which are different. Use IMAGE_LINK_NAME to fix the problem.

---
 meta/classes/image-vm.bbclass    | 2 +-
 meta/classes/image_types.bbclass | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/classes/image-vm.bbclass +1 -1
index 2cd2640..47f7326 100644
@@ -146,7 +146,7 @@ DISK_SIGNATURE_GENERATED := "${@generate_disk_signature()}"
 
 run_qemu_img (){
     type="$1"
-    qemu-img convert -O $type ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.$type
+    qemu-img convert -O $type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.$type
     ln -sf ${IMAGE_NAME}.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
 }
 create_vmdk_image () {
meta/classes/image_types.bbclass +1 -1
index 0683c47..b702bc1 100644
@@ -116,7 +116,7 @@ ELF_APPEND ?= "ramdisk_size=32768 root=/dev/ram0 rw console="
 
 IMAGE_CMD_elf () {
 	test -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf && rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf
-	mkelfImage --kernel=${ELF_KERNEL} --initrd=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cpio.gz --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf --append='${ELF_APPEND}' ${EXTRA_IMAGECMD}
+	mkelfImage --kernel=${ELF_KERNEL} --initrd=${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.cpio.gz --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.elf --append='${ELF_APPEND}' ${EXTRA_IMAGECMD}
 }
 
 IMAGE_TYPEDEP_elf = "cpio.gz"
Signature · 1 line
2.7.4
#8 lore raw
In reply to Robert Yang

Removed patch 2/4 and updated in the repo:

git://git.openembedded.org/openembedded-core-contrib rbt/img

Robert Yang (3):
image_types.bbclass: set nodesize for btrfs image_types.bbclass: fix elf image-vm.bbclass/image_types.bbclass: IMAGE_NAME -> IMAGE_LINK_NAME

So there are only 3 patches in the repo.

// Robert

Quoted 19 lines · Robert Yang

The following changes since commit 5ebea1114d54120d5ff5d8a6cd148110d0fda23f:

   build-appliance-image: Update to master head revision (2016-04-06 23:54:57 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/img
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/img

Robert Yang (4):
image_types.bbclass: set nodesize for btrfs image_types.bbclass: fix ubi ubifs and multiubi image_types.bbclass: fix elf image-vm.bbclass/image_types.bbclass: IMAGE_NAME -> IMAGE_LINK_NAME

  meta/classes/image-vm.bbclass    |  2 +-
  meta/classes/image_types.bbclass | 10 +++++++---
  2 files changed, 8 insertions(+), 4 deletions(-)