From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7000822935908777984 X-Received: by 2002:a2e:8109:: with SMTP id d9mr4410154ljg.495.1630006111698; Thu, 26 Aug 2021 12:28:31 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:15a3:: with SMTP id bp35ls952685lfb.1.gmail; Thu, 26 Aug 2021 12:28:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8HVNUfluNwt3SfUOxhlXMkgPfJ2WMTDQYwjUj9HJYr2vrspj6Gm5TtRlxcYtR/4ZXb+sy X-Received: by 2002:a05:6512:202e:: with SMTP id s14mr3923958lfs.257.1630006110672; Thu, 26 Aug 2021 12:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630006110; cv=none; d=google.com; s=arc-20160816; b=GHB4n1fqsKpSPolE5VszsBJNhHnBOzVJ7CWs608ErgizGQN0xLFa+1ndUCIqtgVyFk yPUuQm2LFj/AmRoH3ktGoZgxIheegkHTXPaHhRc4Q1dXaTO7MrB2d0LNtClpzWhAVGRQ i7VEbZrSMX4kUW1Th6/5scR5oXKfyO08mYTaV5noTFLi1E3cTQvRAOFFXELjzvxUdewE FTeKY4F2T3WIc1QPGa+G/pDJw1t1uJSFR2FqGwHzXUcEbgN6ROV4/upcyoCTFHZpJNhD KGUDpL30B74gV7GjlqgD3HWCTowHeGIpMM+GLpbQHhZWh356xOY/hf6yoGaAJvwhfoTF jnsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JCYH4D0391VFbgSWGFppdE3Gg9syemic+NLHugl2MTE=; b=cy/5Aov/cKWujnYlpfc104zxoNgCGazWDqI4/qMPB6ld8d1BJo4dTsx1Qx3xEzZo5P dCV3Njc6mNWqduHkPKNW1doPlpdtglVlNBjxOitcywDSrqx9xzZCt46YtxLFEJeYvRl1 YLBkTEY2XrbOOvWOe6ZYYcxaiVTKNXfFwhvyTMzSwQQbfrZGHQyDlxGb6O/5x7amTioz 9s58A3716/JDA3eJ7hyQGWxKUMvPZSLa/4y4BlPxYoCzOt4Fot+tMW1rbzPn+j7CoHd1 TBpGAKCyRTWDmpfB+EizBmTCvH6O1VyMsoEcKnNneiJlx0JPAPDkCrPIeXmGuDWaSndZ pWTg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id t9si229619lfk.1.2021.08.26.12.28.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Aug 2021 12:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id 17QJSTJb002523 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 26 Aug 2021 21:28:29 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.0.59]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 17QJSTiX026014; Thu, 26 Aug 2021 21:28:29 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Henning Schild Subject: [PATCH 2/3] wic: apply the actual fork changes to our pcbios plugin fork Date: Thu, 26 Aug 2021 21:28:26 +0200 Message-Id: <20210826192827.2653-3-henning.schild@siemens.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826192827.2653-1-henning.schild@siemens.com> References: <20210826192827.2653-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: 8L0jMMQ6jrZ8 This aims to be a rather minimal one-commit fork to do isar specific changes to the forked class. It does things in a way that results in somehow strange code but pretty clean patching that aims to be easy to read and mostly about adding lines to get things done. The hope is that it will make maintaining the fork easier than before. Signed-off-by: Henning Schild --- .../wic/plugins/source/bootimg-pcbios-isar.py | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) 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 f2639e700493..3a3a6f09392f 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-2.0-only # # DESCRIPTION -# This implements the 'bootimg-pcbios' source plugin class for 'wic' +# This implements the 'bootimg-pcbios-isar' source plugin class for 'wic' # # AUTHORS # Tom Zanussi @@ -22,12 +22,12 @@ from wic.misc import (exec_cmd, exec_native_cmd, logger = logging.getLogger('wic') -class BootimgPcbiosPlugin(SourcePlugin): +class BootimgPcbiosIsarPlugin(SourcePlugin): """ Create MBR boot partition and install syslinux on it. """ - name = 'bootimg-pcbios' + name = 'bootimg-pcbios-isar' @classmethod def _get_bootimg_dir(cls, bootimg_dir, dirname): @@ -56,6 +56,10 @@ class BootimgPcbiosPlugin(SourcePlugin): """ bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') mbrfile = "%s/syslinux/" % bootimg_dir + + # files have different prefix in debian + mbrfile += "mbr/" + if creator.ptable_format == 'msdos': mbrfile += "mbr.bin" elif creator.ptable_format == 'gpt': @@ -123,11 +127,27 @@ class BootimgPcbiosPlugin(SourcePlugin): syslinux_conf += "LABEL boot\n" kernel = "/vmlinuz" + + # figure out the real filename in /boot/ by following debian symlinks + kernel_file = get_bitbake_var("KERNEL_FILE") + rootfs_dir = get_bitbake_var("IMAGE_ROOTFS") + kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file))) + syslinux_conf += "KERNEL " + kernel + "\n" syslinux_conf += "APPEND label=boot root=%s %s\n" % \ (creator.rootdev, bootloader.append) + # we are using an initrd, smuggle it in + initrd = "initrd.img" + kernel_parts = kernel.split("-") + kernel_suffix = "-".join(kernel_parts[1:]) + if kernel_suffix: + initrd += "-%s" % kernel_suffix + + syslinux_conf = syslinux_conf.replace(" root=%s " % (creator.rootdev), + " root=%s initrd=%s " % (creator.rootdev, initrd)) + logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg", cr_workdir) cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") @@ -166,7 +186,17 @@ class BootimgPcbiosPlugin(SourcePlugin): "install -m 444 %s/syslinux/libutil.c32 %s/libutil.c32" % (bootimg_dir, hdddir)) + # install /boot from our debian rootfs completely + cmds = cmds + ("cp -a %s/%s %s/.." % (rootfs_dir['ROOTFS_DIR'], "boot", hdddir),) + for install_cmd in cmds: + # skip the kernel install from OE parts, "cp -a" will bring our kernel + if install_cmd == cmds[0]: + continue + # one file has a different suffix in debian + install_cmd = install_cmd.replace("ldlinux.sys", "ldlinux.c32") + # files have different prefix in debian + install_cmd = install_cmd.replace("/syslinux/", "/syslinux/modules/bios/") exec_cmd(install_cmd) du_cmd = "du -bks %s" % hdddir -- 2.31.1