All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [RFC] grub-install C rewrite
Date: Sun, 06 Oct 2013 20:05:12 +0200	[thread overview]
Message-ID: <5251A658.3050005@gmail.com> (raw)
In-Reply-To: <20131006195610.523c90b0@opensuse.site>

[-- Attachment #1: Type: text/plain, Size: 3182 bytes --]

On 06.10.2013 17:56, Andrey Borzenkov wrote:
> В Sun, 06 Oct 2013 16:54:08 +0200
> Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:
> 
>> On 26.09.2013 15:08, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>>> Hello, all. Recently I made some order in hostdisk.c and getroot.c
>>> involving splitting in OS-specific parts.
>>> In the same time I added WinAPI version of getroot/hostdisk allowing
>>> grub-probe to work on windows natively
>>> Also on-going is AROS-specific parts.
>>> Windows and AROS are not friendly with bash.
>>> The attempt to make both multiple files of same type work and handling
>>> whitespaces/newlines/... in filenames would result in very ugly code
>>> with loads of evals.
>>> Current code may have subtle assumptions on behaviour of common tools
>>> like sed and on locale (E.g. "[a-z]" doesn't cover u if locale is Estonian).
>>> So to check viability I rewrote grub-install in C. This is mostly proof
>>> of concept with loads of FIXMEs but I could boot i386-pc install made
>>> with it. In many aspects (static variables, some tests, general
>>> structure) it's reminiscent of sh version of grub-install it's based on.
>>> Some functionality is likely to stay OS-specific, e.g. executing
>>> compressors or determining firmware.
>> Attached is the second iteration of this patch.
> 
>> @@ -308,6 +310,7 @@
>>    installdir = sbin;
>>    mansection = 8;
>>    common = util/grub-setup.c;
>> +  common = util/setup_bios.c;
> +  extra_dist = util/setup.c;
> 
>> @@ -324,6 +327,7 @@
>>    installdir = sbin;
>>    mansection = 8;
>>    common = util/grub-setup.c;
>> +  common = util/setup_sparc.c;
> +  extra_dist = util/setup.c;
> 
>> +program = {
>>    mansection = 8;
>>    installdir = sbin;
>>    name = grub-install;
>>  
>> -  common = util/grub-install_header;
>> -  common = util/grub-install.in;
>> +  common = util/mkimage.c;
>> +  common = util/grub-install.c;
>> +  common = util/grub-install-common.c;
>> +  common = util/setup_bios.c;
>> +  common = util/setup_sparc.c;
> +  extra_dist = util/setup.c;
> 
> 
>>                                                 Now the biggest problem
>> is in reading /etc/default/grub and getting GRUB_DISTRIBUTOR and
>> GRUB_ENABLE_CRYPTODISK. Trouble is that now this file is simply included
>> in bash script and e.g. Debian uses it to determine GRUB_DISTRIBUTOR
>> based on lsb_release output. Does anyone have an elegant solution for this?
>>
> 
> If declaring this as unsupported is not an option, the only solution is
> wrapper, something like
> 
> sh -c '/etc/default/grub; printf
> GRUB_DISTRIBUTOR=%s\\nGRUB_ENABLE_CRYPTODISK=%s\\n "$GRUB_DISTRIBUTOR" "$GRUB_ENABLE_CRYPTODISK"'
> 
Rather
sh -c '. /etc/default/grub; printf GRUB_DISTRIBUTOR=%s\\nGRUB_ENABLE_CRYPTODISK=%s\\n "$GRUB_DISTRIBUTOR" "$GRUB_ENABLE_CRYPTODISK"'
This is probably the best way to do it on Unix-like systems with fallback for simple parser for other systems.
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

  reply	other threads:[~2013-10-06 18:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 13:08 [RFC] grub-install C rewrite Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-26 13:35 ` Lennart Sorensen
2013-09-26 13:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-26 14:44     ` Lennart Sorensen
2013-09-26 18:49       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-26 20:22         ` Lennart Sorensen
2013-09-26 20:29           ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-26 20:51           ` Chris Murphy
2013-09-26 22:15             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-27  3:10         ` Andrey Borzenkov
2013-09-26 17:10   ` Seth Goldberg
2013-09-26 18:51     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-09-26 18:56       ` Darren J Moffat
2013-09-26 18:57       ` Seth Goldberg
2013-09-26 14:49 ` Andrey Borzenkov
2013-09-26 15:01   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-10-06 14:54 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-10-06 15:56   ` Andrey Borzenkov
2013-10-06 18:05     ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-26 17:52 Kalamatee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5251A658.3050005@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.