From: Henning Schild <henning.schild@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 1/2] meta: image: detect broken symlinks
Date: Fri, 9 Mar 2018 09:21:27 +0100 [thread overview]
Message-ID: <20180309082128.11093-1-henning.schild@siemens.com> (raw)
Switch get_image_name from os.path.lexists to os.path.exists because the
latter detects broken symlinks correctly. Also support older debian
versions where the symlinks in the rootfs are absolute
Also change scripts/start_vm to handle the case where no initrd is
present.
Issue:
If you build a kernel without CONFIG_BLK_DEV_INITRD the postinst hook will
still call "linux-update-symlinks" and create a broken symlink. After
that os.path.lexists will return True and "sudo cp" in do_copy_boot_files
will fail.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/image.bbclass | 4 +++-
scripts/start_vm | 11 +++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2c255f4..6753aed 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -8,8 +8,10 @@ IMAGE_ROOTFS = "${WORKDIR}/rootfs"
def get_image_name(d, name_link):
S = d.getVar("IMAGE_ROOTFS", True)
path_link = os.path.join(S, name_link)
- if os.path.lexists(path_link):
+ if os.path.exists(path_link):
return os.path.basename(os.path.realpath(path_link))
+ if os.path.islink(path_link):
+ return os.path.basename(os.path.join(S, os.path.realpath(path_link)))
return ""
# These variables are used by wic and start_vm
diff --git a/scripts/start_vm b/scripts/start_vm
index b7b5e17..0d1d554 100755
--- a/scripts/start_vm
+++ b/scripts/start_vm
@@ -25,8 +25,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
-M $QEMU_MACHINE \\\\\n\
$QCPU\\\\\n\
-nographic \\\\\n\
- -kernel \$IMAGE_DIR/$KERNEL_IMAGE \\\\\n\
- -initrd \$IMAGE_DIR/$INITRD_IMAGE \\\\\n\
+ -kernel \$QKERNEL \\\\\n\
+ -initrd \$QINITRD \\\\\n\
-append \"console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw\" \\\\\n\
$EXTRA_ARGS \\\\\n\
$root1"
@@ -38,8 +38,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
-M $QEMU_MACHINE \
$QCPU \
-nographic \
- -kernel $IMAGE_DIR/$KERNEL_IMAGE \
- -initrd $IMAGE_DIR/$INITRD_IMAGE \
+ -kernel $QKERNEL \
+ -initrd $QINITRD \
-append "console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw" \
$EXTRA_ARGS \
$root2
@@ -118,6 +118,9 @@ readonly ROOTFS_IMAGE=isar-image-base-debian-$DISTRO-qemu$ARCH.ext4.img
eval $(bitbake -e multiconfig:qemu$ARCH-$DISTRO:isar-image-base | grep "^KERNEL_IMAGE=")
eval $(bitbake -e multiconfig:qemu$ARCH-$DISTRO:isar-image-base | grep "^INITRD_IMAGE=")
+QKERNEL=$IMAGE_DIR/$KERNEL_IMAGE
+QINITRD=/dev/null
+[ -n "$INITRD_IMAGE" ] && QINITRD=$IMAGE_DIR/$INITRD_IMAGE
readonly ISARROOT="$(dirname "$0")"/..
--
2.16.1
next reply other threads:[~2018-03-09 8:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 8:21 Henning Schild [this message]
2018-03-09 8:21 ` [PATCH 2/2] scripts: return errors for CI Henning Schild
2018-03-09 8:30 ` Henning Schild
2018-03-09 8:30 ` [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309082128.11093-1-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox