From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7000822935908777984 X-Received: by 2002:a05:6000:188d:: with SMTP id a13mr9341225wri.99.1630059936938; Fri, 27 Aug 2021 03:25:36 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:ef0d:: with SMTP id e13ls602378wro.3.gmail; Fri, 27 Aug 2021 03:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPUsKGo8eO1MnAtgAUPOLGftJyd9iEOaLPbkU9q00TDHY/XMWNTmAOb24FIMGk0u/H8in1 X-Received: by 2002:a5d:678f:: with SMTP id v15mr9580652wru.196.1630059935878; Fri, 27 Aug 2021 03:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630059935; cv=none; d=google.com; s=arc-20160816; b=kGTxHVb/ljc9ZHSddFUEqP8vCDFQfirJVQ9ap0id2j2RObBAx93LvWWsk+0bA1eUI1 fiSrjv8pJD/UUrahaE8QDjLwjS21aNfKIdbA01T9tLtoeDeUReTtwi1uuvekgQLGBkpU iCE12+6mlJpLzKoKsZprbx6nLuaS40ZjBBvkeuoQcEm2WyxTvhEjQWZxy+1gPiIwterD xLsXkpqn8mAxk54RnJ4g8h2rSbTayF55fto7MyCLhP0UMb6iliqN+LHMoUwuUu8CqHEa bPFMdZ/X99T54YcGJ2FmjZKmxcJw6J5dAxsMN69v6D9uNorvexAl0PkvzUh83MpGCds0 eY+w== 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=MdFBrKsareqeKS3K7XrgQDGVLuUI8WmCsnY8k++offz1j4LUlJazB8N3LTMlIfeTop fxDA4x7iNdpi1v6X0Ue/uTZMlBRoXdOvAF401KWDnmnjRLTlXXBSqUy3yjuD9RQccg5a 5EU6wZCuphS9cYotMXlMLLrW3NuRU4vgdwMaKOXzhN6xtGIm6PMXzFHWNbblllz/jW4c MHFtk/uoDvoCQKpQRkItgxD91InNqmKdOXiAPaSHh2x2hLUh9zJTBee0NwwjXyEloLV8 LFYQLulWu2rtPIn+/rpxUCFpAUY5747eo6Zy+0L+NrqSNrKpTzQGNmWSbRDB3yMgHirG Vm1w== 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 u2si467834wro.0.2021.08.27.03.25.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Aug 2021 03:25:35 -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 mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id 17RAPZrx018956 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Aug 2021 12:25:35 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.0.59]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 17RAPZZ7031573; Fri, 27 Aug 2021 12:25:35 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Henning Schild Subject: [PATCH v2 2/3] wic: apply the actual fork changes to our pcbios plugin fork Date: Fri, 27 Aug 2021 12:25:32 +0200 Message-Id: <20210827102533.11100-3-henning.schild@siemens.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827102533.11100-1-henning.schild@siemens.com> References: <20210827102533.11100-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: FQUSGsMJbmNm 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