From patchwork Sun Jan 13 21:49:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1024164 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=o2.pl Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CN0vJr6M"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43d9GJ6ZqSz9s9h for ; Mon, 14 Jan 2019 08:48:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=c0e+LyqMo2e3i/IMvYDz/y5JzlgiKx0vljs8kYXf1tU=; b=CN0vJr6MRl6pjsVIt+Kr9vqvgN DoEnR9s8FqpkGLMmtzUWnpBorLo/ayKy2dIpTI3sg4NL9CEfKg8ofluR9yS932qkizNWMoLZpsNkJ 7nIHBiCTf8K2tGQSN8cp/VBZvfRHxBgzKXrSXTCtBwixcUtlhIRlzeC7xqvTPWJdJxohg7DUZtz/y swqgU1AgkkkiKbBtVYXPYqMr1oa7zY/PqzNs/nRnaHgzW6Mje+ofFEk5BDBxbliwtnHJPaAMvAwRf 9EtPFSgaPIwjHDMRfSUquAjGLA4S3baC0poaRPZsaNa2ZyBJNQeKGHEJ0XvkqwcfUeBJJduxVv6ZC NDrKTgLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gincS-0001AF-PV; Sun, 13 Jan 2019 21:48:36 +0000 Received: from mx-out.tlen.pl ([193.222.135.140]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gincO-00018g-7a for openwrt-devel@lists.openwrt.org; Sun, 13 Jan 2019 21:48:34 +0000 Received: (wp-smtpd smtp.tlen.pl 30544 invoked from network); 13 Jan 2019 22:48:29 +0100 Received: from 131.ip-164-132-48.eu (HELO localhost.localdomain) (tomek_n@o2.pl@[164.132.48.131]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 13 Jan 2019 22:48:29 +0100 From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Date: Sun, 13 Jan 2019 22:49:10 +0100 Message-Id: <20190113214915.14059-2-tomek_n@o2.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190113214915.14059-1-tomek_n@o2.pl> References: <20190113214915.14059-1-tomek_n@o2.pl> MIME-Version: 1.0 X-WP-MailID: ac8386bacfb114ddf96c9459d0588a7d X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 000000A [MXNE] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190113_134832_433569_DE9979F2 X-CRM114-Status: UNSURE ( 6.27 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomek_n[at]o2.pl) Subject: [OpenWrt-Devel] [RFC 1/6] x86/grub2: move grub2 image creation to grub2 package X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Let the grub2 package take care of creating installable grub2 images, this will allow creating grub2 images without first calling x86 image generation recipe. Also as side effect, since those images are now shared, it'll reduce the number of calling grub-mkimage. Signed-off-by: Tomasz Maciej Nowak --- package/boot/grub2/Makefile | 31 +++++++++++++++++++ .../boot/grub2/files}/grub-early.cfg | 0 target/linux/x86/image/Makefile | 28 +++++------------ 3 files changed, 39 insertions(+), 20 deletions(-) rename {target/linux/x86/image => package/boot/grub2/files}/grub-early.cfg (100%) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index d6af65128e..cefc4ed92e 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -83,6 +83,37 @@ define Host/Configure $(Host/Configure/Default) endef +define Host/Install + $(call Host/Install/Default) + + $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-generic + $(STAGING_DIR_HOST)/bin/grub-mkimage \ + -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ + -p /boot/grub \ + -O i386-pc \ + -c ./files/grub-early.cfg \ + -o $(STAGING_DIR_HOST)/lib/grub/grub2-generic/core.img \ + at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga + + $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-iso + $(STAGING_DIR_HOST)/bin/grub-mkimage \ + -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ + -p /boot/grub \ + -O i386-pc \ + -c ./files/grub-early.cfg \ + -o $(STAGING_DIR_HOST)/lib/grub/grub2-iso/eltorito.img \ + at_keyboard biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga + + $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-legacy + $(STAGING_DIR_HOST)/bin/grub-mkimage \ + -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ + -p /boot/grub \ + -O i386-pc \ + -c ./files/grub-early.cfg \ + -o $(STAGING_DIR_HOST)/lib/grub/grub2-legacy/core.img \ + biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga +endef + define Package/grub2-editenv/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/ diff --git a/target/linux/x86/image/grub-early.cfg b/package/boot/grub2/files/grub-early.cfg similarity index 100% rename from target/linux/x86/image/grub-early.cfg rename to package/boot/grub2/files/grub-early.cfg diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index d799a0ba03..91cd2f9a04 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -9,8 +9,7 @@ include $(INCLUDE_DIR)/image.mk export PATH=$(TARGET_PATH):/sbin -GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga -GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga +GRUB2_VARIANT = GRUB_TERMINALS = GRUB_SERIAL_CONFIG = GRUB_TERMINAL_CONFIG = @@ -19,8 +18,9 @@ GRUB_CONSOLE_CMDLINE = USE_ATKBD = generic 64 ifneq ($(strip $(foreach subtarget,$(USE_ATKBD),$(CONFIG_TARGET_x86_$(subtarget)))),) - GRUB2_MODULES += at_keyboard - GRUB2_MODULES_ISO += at_keyboard + GRUB2_VARIANT := generic +else + GRUB2_VARIANT := legacy endif ifneq ($(CONFIG_GRUB_CONSOLE),) @@ -63,14 +63,9 @@ ifneq ($(CONFIG_GRUB_IMAGES),) # left here because the image builder doesnt need these $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz - grub-mkimage \ - -p /boot/grub \ - -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ - -o $(KDIR)/grub2/core.img \ - -O i386-pc \ - -c ./grub-early.cfg \ - $(GRUB2_MODULES) - $(CP) $(STAGING_DIR_HOST)/lib/grub/i386-pc/*.img $(KDIR)/grub2/ + $(CP) $(STAGING_DIR_HOST)/lib/grub/i386-pc/*.img \ + $(STAGING_DIR_HOST)/lib/grub/grub2-$(strip $(GRUB2_VARIANT))/core.img \ + $(KDIR)/grub2/ echo '(hd0) $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img' > $(KDIR)/grub2/device.map sed \ -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \ @@ -100,16 +95,9 @@ endef define Image/Build/iso $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2 $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz - grub-mkimage \ - -p /boot/grub \ - -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \ - -o $(KDIR)/grub2/eltorito.img \ - -O i386-pc \ - -c ./grub-early.cfg \ - $(GRUB2_MODULES_ISO) cat \ $(STAGING_DIR_HOST)/lib/grub/i386-pc/cdboot.img \ - $(KDIR)/grub2/eltorito.img \ + $(STAGING_DIR_HOST)/lib/grub/grub2-iso/eltorito.img \ > $(KDIR)/root.grub/boot/grub/eltorito.img sed \ -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \