From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
To: <isar-users@googlegroups.com>,
<Vijaikumar_Kanagarajan@mentor.com>, <henning.schild@siemens.com>
Subject: [PATCH v4 7/8] Fix legacy bios boot partition
Date: Wed, 16 Sep 2020 20:20:20 +0530 [thread overview]
Message-ID: <20200916145021.5856-8-Vijaikumar_Kanagarajan@mentor.com> (raw)
In-Reply-To: <20200916145021.5856-1-Vijaikumar_Kanagarajan@mentor.com>
In case of legacy bios, the kernel is required to be present
in a seperate partition with necessary syslinux files. This was
never mounted onto the target and standard kernel update via
apt-get was impossible.
Rename the existing kernel and initrd files in the syslinux
partition to the standard debian naming format. Copy over
System.map and config files to the partition and exclude the
/boot in root partition. The latest wic automatically adds the
necessary entry for /boot partition in fstab which automounts
it during boot.
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
.../lib/wic/canned-wks/common-isar.wks.inc | 2 +-
meta/classes/wic-img.bbclass | 3 +-
.../wic/plugins/source/bootimg-pcbios-isar.py | 31 ++++++++++++++-----
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/meta-isar/scripts/lib/wic/canned-wks/common-isar.wks.inc b/meta-isar/scripts/lib/wic/canned-wks/common-isar.wks.inc
index c8ea4c2..cc38a01 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/common-isar.wks.inc
+++ b/meta-isar/scripts/lib/wic/canned-wks/common-isar.wks.inc
@@ -1,3 +1,3 @@
# This file is included into 3 canned wks files from this directory
part /boot --source bootimg-pcbios-isar --ondisk sda --label boot --active --align 1024
-part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024
+part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --exclude-path=boot
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index b1a7259..0752d8f 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -95,7 +95,8 @@ WIC_CREATE_EXTRA_ARGS ?= ""
WICVARS += "\
BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \
IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
- ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH"
+ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH \
+ KERNEL_NAME KERNEL_FILE"
# Isar specific vars used in our plugins
WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO_ARCH"
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
index 4d916d6..493615b 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -131,8 +131,13 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
syslinux_conf += "DEFAULT boot\n"
syslinux_conf += "LABEL boot\n"
- kernel = get_bitbake_var("KERNEL_IMAGE")
- initrd = get_bitbake_var("INITRD_IMAGE")
+ kernel_file = get_bitbake_var("KERNEL_FILE")
+ kernel_name = get_bitbake_var("KERNEL_NAME")
+ rootfs_dir = get_bitbake_var("IMAGE_ROOTFS")
+ kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file)))
+ kernel_version = kernel.strip('-' + kernel_name).strip(kernel_file + '-')
+ initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
+
syslinux_conf += "KERNEL " + kernel + "\n"
syslinux_conf += "APPEND label=boot root=%s initrd=%s %s\n" % \
@@ -156,15 +161,25 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
syslinux_dir = cls._get_syslinux_dir(bootimg_dir)
staging_kernel_dir = kernel_dir
- kernel = get_bitbake_var("KERNEL_IMAGE")
- initrd = get_bitbake_var("INITRD_IMAGE")
+ kernel_file = get_bitbake_var("KERNEL_FILE")
+ kernel_name = get_bitbake_var("KERNEL_NAME")
+ rootfs_dir = rootfs_dir['ROOTFS_DIR']
+ kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file)))
+ kernel_version = kernel.strip('-' + kernel_name).strip(kernel_file + '-')
+ initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
+ config = "config-%s-%s" % (kernel_version, kernel_name)
+ mapfile = "System.map-%s-%s" % (kernel_version, kernel_name)
hdddir = "%s/hdd/boot" % cr_workdir
- cmds = ("install -m 0644 %s/%s %s/%s" %
- (staging_kernel_dir, kernel, hdddir, kernel),
- "install -m 0644 %s/%s %s/%s" %
- (staging_kernel_dir, initrd, hdddir, initrd),
+ cmds = ("install -m 0644 %s/%s/%s %s/%s" %
+ (rootfs_dir, "boot", kernel, hdddir, kernel),
+ "install -m 0644 %s/%s/%s %s/%s" %
+ (rootfs_dir, "boot", initrd, hdddir, initrd),
+ "install -m 0644 %s/%s/%s %s/%s" %
+ (rootfs_dir, "boot", config, hdddir, config),
+ "install -m 0644 %s/%s/%s %s/%s" %
+ (rootfs_dir, "boot", mapfile, hdddir, mapfile),
"install -m 444 %s/modules/bios/ldlinux.c32 %s/ldlinux.c32" %
(syslinux_dir, hdddir),
"install -m 0644 %s/modules/bios/vesamenu.c32 %s/vesamenu.c32" %
--
2.17.1
next prev parent reply other threads:[~2020-09-16 14:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 14:50 [PATCH v4 0/8] WIC update Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 1/8] wic: Update to the latest wic from openembedded core Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 2/8] wic/plugins: Fix wic plugins to work with the latest wic Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 3/8] wic-img: Satisfy the quirks of " Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 4/8] wic_fakeroot: Handle standalone pseudo invocations Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 5/8] meta-isar/conf: Add provision to debug WIC Vijai Kumar K
2020-09-16 14:50 ` [PATCH v4 6/8] debian-common: Add tar as a dependency for wic Vijai Kumar K
2020-09-16 14:50 ` Vijai Kumar K [this message]
2020-09-16 14:50 ` [PATCH v4 8/8] meta-isar/canned-wks: Remove unwanted /boot mountpoint Vijai Kumar K
2020-10-05 15:13 ` vijaikumar....@gmail.com
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=20200916145021.5856-8-Vijaikumar_Kanagarajan@mentor.com \
--to=vijaikumar_kanagarajan@mentor.com \
--cc=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