From: Henning Schild <henning.schild@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v3] meta: image: detect broken symlinks
Date: Fri, 9 Mar 2018 16:26:01 +0100 [thread overview]
Message-ID: <20180309152601.9357-1-henning.schild@siemens.com> (raw)
In-Reply-To: <20180227172336.19786-1-henning.schild@siemens.com>
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 | 5 ++++-
scripts/start_vm | 11 +++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2c255f4..6a705fc 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -8,8 +8,11 @@ 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 get_image_name(d, os.path.relpath(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 prev parent reply other threads:[~2018-03-09 15:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 17:23 [PATCH] " Henning Schild
2018-03-02 12:20 ` Jan Kiszka
2018-03-02 16:30 ` Alexander Smirnov
2018-03-04 19:28 ` Alexander Smirnov
2018-03-04 19:49 ` Jan Kiszka
2018-03-05 18:49 ` Henning Schild
2018-03-09 15:26 ` Henning Schild [this message]
2018-03-20 13:42 ` [PATCH v3] " Henning Schild
2018-03-27 13:50 ` Alexander Smirnov
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=20180309152601.9357-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