Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2785217pxb; Mon, 19 Apr 2021 14:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpyB8DjTJZpcwGcWT0dPtqjlT67SOm9I0XaZmY5PZ9BJ+TMCTm2WgL4q5acKzW9KcAzTIz X-Received: by 2002:a05:6402:785:: with SMTP id d5mr6392483edy.134.1618866037317; Mon, 19 Apr 2021 14:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618866037; cv=none; d=google.com; s=arc-20160816; b=h9hoDQ0TF4L9PZhN0fZYjrU36uR4Ry8eP7VYN67ZFylUiaITFbjqprPYQiRFdykojv E7Z61bnl1q30elX2wprodb6raFFAeuCsW5+XuhSZ8QbLoM1yt3g3+9Qq31HqCxdEr2Px Pzyspyr40lqD6FokMXk3yDY07HkCRASGoIokRhfl7eiRPlY/T2ceLxP4xCx6TzSDj+k6 2Gdb1RWCf5Zcv97DZlL7aBxXbO4dk28ZLSLpgihf2W6sl8m4P3v5Rkw4jDmkTDxxittE NRRotaVUOOVSI3JMlGViijOxUARlCUbSOyPtQSK5gPkY2tMPqGbXbwNCgnx6MnnY1wBj mrFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=PSRN5v6fXZoEYzmBfnsY6QxsYgPsedMVL9WdxgLS2qU=; b=NK+P1IuqSKmaBPGgEl61vv3mcs+t/IaYRKVlqkPaN9LBgmL4Ehi4/4UyN+G8bHR+Ob Hp6og8x4QWn8HQ86K8jnhyFU7KWrT27KYettjjPigErJum6yvYT1BBg0ncJ4o4rKko/G s84T6VYMjDi8FbjTvgf6GUicufaaVvKrJqdDIYPrxecTg4sQzaF0MTQqkvGBDuLvEQEC kOdSxG16KWkU6fg/DdyOswNeBfc+1HP/32ybpaJ5BYQqoHn90uJ0cv+KSuE0sLWT3J2Y +mlAb85qELTi1spL2ASpxmAOrTsx7gIpZyE2sHr0j3J5MCUAwMc9NW44TyUJMNOXrNJ5 Z6Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021032801 header.b=f5zFIsPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn24si5473207ejc.244.2021.04.19.14.00.13; Mon, 19 Apr 2021 14:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2021032801 header.b=f5zFIsPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240311AbhDSU43 (ORCPT + 99 others); Mon, 19 Apr 2021 16:56:29 -0400 Received: from terminus.zytor.com ([198.137.202.136]:47521 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241688AbhDSU4S (ORCPT ); Mon, 19 Apr 2021 16:56:18 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 13JKslbT2399793 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 19 Apr 2021 13:54:55 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 13JKslbT2399793 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021032801; t=1618865697; bh=PSRN5v6fXZoEYzmBfnsY6QxsYgPsedMVL9WdxgLS2qU=; h=From:To:Cc:Subject:Date:From; b=f5zFIsPcOREApY+mB0ii8gwVUTUMKktoUkJE6+w/n/DXJQ4+WojjMKyEXIsI6vWXJ 9/D5d7IQ5NxZ/wLrEOJWFcaSRqYkZEP/Dx9wW0ZRA+tfI5eZl3/VEiIZuH16AHmf3T 3modexQEAcvHCkTuayE4S15qxDN/gMiglxnJ4KQ1F3i5cQdeDDuMY67/Sa23WHO9BX NrwHQCSsAHMQ3JboGCWFTWzMa6sMtT9utZx87H8fq0R1FD7lOEw5snCrgaafOvNW7R j1CBkBW3e5FKM+x34T/3KMEKfKgugl8DzLdBE5rWHjC+oP1+58/cAVAiLR7RvxPTY7 4J6DE7FqmTe+g== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Alexander Viro , Masahiro Yamada , Michal Marek Cc: Linux Kernel Mailing List , Kbuild Mailing List , "H. Peter Anvin" Subject: [PATCH 0/3] x86 disk image and modules initramfs generation Date: Mon, 19 Apr 2021 13:54:35 -0700 Message-Id: <20210419205438.1531413-1-hpa@zytor.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin" (Intel) When compiling on a different machine than the runtime target, including but not limited to simulators, it is rather handy to be able to produce a bootable image. The scripts for that in x86 are relatively old, and assume a BIOS system. This adds a build target to generate a hdimage which can be booted either from BIOS or EFI, and modernizes the genimage.sh script including adding the ability to add an arbitrary number of initramfs files (limited only by the length of the command line.) Possibly more controversial, at least from a Kbuild design perspective (as usual I'm the guy who wants to do something with Kbuild which it seems it was never really designed to do), is add the ability to create an initramfs image which includes all the built modules. Some distributions cannot be easily booted without modules in initramfs, and this creates an image which can be added to initramfs to provide the kernel modules, as finalized by "make modules_install". The final patch put these two together, and allows the modules initramfs to be included in the x86 boot image. Makefile | 17 ++- arch/x86/Makefile | 8 +- arch/x86/boot/.gitignore | 1 + arch/x86/boot/Makefile | 55 +++++---- arch/x86/boot/genimage.sh | 284 +++++++++++++++++++++++++++++++------------ arch/x86/boot/mtools.conf.in | 3 + usr/.gitignore | 3 + usr/Kconfig | 31 ++--- usr/Makefile | 39 +++++- 9 files changed, 318 insertions(+), 123 deletions(-)