From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VvIB6-0008Vn-LM for mharc-grub-devel@gnu.org; Mon, 23 Dec 2013 21:57:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvIAx-0008VF-78 for grub-devel@gnu.org; Mon, 23 Dec 2013 21:57:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvIAo-0004au-PP for grub-devel@gnu.org; Mon, 23 Dec 2013 21:56:55 -0500 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:58776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvIAo-0004aV-Go for grub-devel@gnu.org; Mon, 23 Dec 2013 21:56:46 -0500 Received: by mail-la0-f48.google.com with SMTP id n7so2584430lam.21 for ; Mon, 23 Dec 2013 18:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:in-reply-to:references:content-type :mime-version:content-transfer-encoding; bh=+XMjYsiy6cu4trLhzBh+psKFysPUH7TbilwQYjsS+oE=; b=1GE0s0qt3IwdrW/Dol5LE4g4w1367RO5eaTIyaUkwsj6UG9jUX2yT71wy5N0Pkb4g8 JJ0abpveZQqieFkzNBev8zVg531WVfd0n+nwywtmuHkvy3+PNyCswDjFT9uEmHB1fe9t Z/0wlUSGQJY6U/e35i2leHBENEhfHdbQt+v6D7dmbVh5OaVO9+NTc6He1X+pXdaHwRm/ rDEhYnyxb5Bbl7r9oVBLMDIv+usD+hcluPbpPi2lFcp+SiH/LixIGL6j+2FLz9SxG/lZ 9V7lSqgKwK1GVb91jzxDsHLAf3T5zBiZ1a/j6Mz100T86SK3pZHIA/YsDfT6F6SWhS9P +KVA== X-Received: by 10.152.29.202 with SMTP id m10mr12284338lah.23.1387853805355; Mon, 23 Dec 2013 18:56:45 -0800 (PST) Received: from [192.168.1.44] (ppp91-76-134-134.pppoe.mtu-net.ru. [91.76.134.134]) by mx.google.com with ESMTPSA id di11sm16581905lac.0.2013.12.23.18.56.44 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 18:56:44 -0800 (PST) Message-ID: <1387853803.918.46.camel@opensuse.site> Subject: Re: Breakage from grub-mkconfig changes for grub-file From: Andrey Borzenkov To: grub-devel@gnu.org Date: Tue, 24 Dec 2013 06:56:43 +0400 In-Reply-To: <20131224003444.GA28338@riva.ucam.org> References: <20131223220141.GA25169@riva.ucam.org> <52B8B772.9040007@gmail.com> <20131224003444.GA28338@riva.ucam.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::230 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2013 02:57:03 -0000 В Вт, 24/12/2013 в 00:34 +0000, Colin Watson пишет: > On Mon, Dec 23, 2013 at 11:21:38PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > > On 23.12.2013 23:01, Colin Watson wrote: > > > This should be redesigned so that there is some way to declare in a > > > grub.d script that it requires multi-platform support and should be > > > run multiple times. (It *must* be this way round so that upgrades > > > work properly.) > > > > The idea was that platform-independent scripts were still runnable, > > they'll just produce the same output N times and this list is just an > > optimisations, specially to avoid running os-prober N times. > > Granted, but in some cases those scripts might not be idempotent: > consider a user-written "42_custom" (or whatever) script that adds a > menu entry, for instance. > > > The alternative will be to have something along the lines of different > > hashbang or implementing this functionality as sh functions. > > How about this simpler option: any script that needs to be run for each > platform could have a magic comment that we grep for in grub-mkconfig. > I have a feeling that we are doing it backwards. What we actually want is to know file type. So what about making grub-file print it instead of having ever growing list of conditions? I.e. grub-file --print {cpu|os|bits|...} and simply using it in every script to generate run-time condition like in (simplified) cpu=$(grub-file --print cpu) cat << EOF if [ \$grub_platform = $cpu ] ; then menuentry ... EOF And this could be wrapped in grub_mkconfig_platform_condition function. > > > The platform names used in grub-mkconfig (x86 i386-xen-pae x86_64-xen > > > mips mipsel sparc64 powerpc ia64 arm arm64) are not the same as the > > > platform names used in the GRUB build system, but yet they're exported > > > across the interface to /etc/grub.d/ as GRUB_PLATFORM. This is messy > > > and confusing, and it's not clear what promises we make about future > > > changes here. > > > > > > We should rationalise this before issuing anything as part of a stable > > > release, perhaps by adopting the same target_cpu/platform terminology > > > used in the build system. Furthermore, if we made the namespaces > > > match up then it would be fairly straightforward to only run grub.d > > > scripts for platforms for which we have installed GRUB modules, which > > > seems as though it would be sensible. > > > > GRUB platform names don't match with the OS compatibility. On x86 other > > than xen you can use the same kernel on all the platforms. On ARM, for > > what is arm-uboot platform for us may require different kernels for > > different hardware. > > OK, but if it is a different concept then it should have a different > name, not "platform" - otherwise it just seems confusing. >