Hi,
Adam Purkrt wrote:
> Hi, I'm having some difficulties compiling grub from git (my own
> deficiencies)
Let's say we are too dumb by 50 percent and the GRUB git configuration
and testing constraints are too complicated by 50 percent. Especially
if one wants to be independent of the system's installation of GRUB.
I did not expect that you'd try git, given you use Gentoo.
Maybe i should have stated explicitely that given the low change rate
in grub-mkrescue and related grub-install functions, i expected that
the patch would apply to 2.12, too.
> I do not see any .mo files on iso with it, the locale
> dir is empty, somehow the localization is off.
I solved that problem by grub-mkrescue option
--locale-directory=/usr/share/locale
The .mo files then come from my system's
/usr/share/locale/*/LC_MESSAGES/grub.mo
where * iterates over the various installed locales.
The grub-install functions rename the "*/LC_MESSAGES/grub.mo" files
to "/boot/grub/locale/*.mo".
Next problem with GRUB git (without "make install, i have to stress)
was that i had to use option
-d /usr/lib/grub/x86_64-efi
in order to get the platform specific GRUB equipment.
Originally the system only had
/usr/lib/grub/x86_64-efi
After i found out that "apt-get install grub-pc-bin" installs
/usr/lib/grub/i386-pc
without changing my systems boot loader to legacy BIOS, i had to learn
that only one directory can be set with option -d. (Last -d argument
wins.)
Messages of the build system indicated that it was configured for
/usr/local/lib rather than /usr/lib. Instead of trying to change the
configuration i created a symbolic link from /usr/local/lib/grub
to /usr/lib/grub and did not use option -d any more.
So my recent tests were made with:
valgrind ./grub-mkrescue \
--locale-directory=/usr/share/locale -o output.iso
in order to get an ISO for two GRUB platforms.
> I was able to apply your patches to grub-2.12 in gentoo through
> the use of user patches and your patch works - there are no more
> *.mo~ files in the iso made by grub-mkrescue, and all the .mo
> files are there.
Feel free to propose it to Gentoo for wider testing.
(IIRC there was an ISO generator tool involved that uses
grub-mkrescue.)
Signed-off-by: Thomas Schmitt <[email protected]>
> But looking at the patch let me say: it would be better if the
> *.mo~ weren't (temporarily) made during the process of creating
> the iso at all, so it would be better to prevent their creation,
> rather than fix their deletion. Just a personal opinion,
Looking from the standpoint of grub-mkrescue i agree to your view.
But the grub-util functions in question are also used for installation
of GRUB on the system disk to serve as first custom operating system
in the boot chain of the machine.
I decided that a new grub-install call, which the grub-install tool
does not yet use, and cautious changes at the atexit-function would
be easier to justify on the grub-devel mailing list.
> I don't know how to do that.
The playfield is again mostly util/grub-install-common.c .
The goal would be to keep grub_install_copy_files() from making
backups files. Call chain is
grub_install_copy_files() ->
grub_install_copy_nls() ->
clean_grub_dir()
which does
clean_grub_dir_real (di, CLEAN_BACKUP);
clean_grub_dir_real (di, CREATE_BACKUP);
append_to_backup_dirs (di);
clean_grub_dir_real() is in charge of creation, use, and deletion of
backup files. It has four modes:
CLEAN_NEW ...... deletes the .mo files without touching .mo~
CLEAN_BACKUP ... deletes the .mo~ files without touching .mo
CREATE_BACKUP .. renames .mo to .mo~
RESTORE_BACKUP . renames .mo~ to .mo
(".mo file" actually means {".mod", ".lst", ".img", ".efi", ".mo"}
with extra rules for four file names. See middle of function code.)
append_to_backup_dirs() records the directory for later handling
in call restore_backup_atexit(), which is split in my patch into
restore_backup_atexit(void) and restore_backup(int by_any_pid).
So we would want clean_grub_dir() to do instead of above three lines
just this one:
clean_grub_dir_real (di, CLEAN_NEW);
The mechanism to instruct clean_grub_dir() could be a static variable
and a call, quite like grub_install_backup_ponr (see below):
static int grub_install_no_backup = 0;
void
grub_set_install_no_backup (void)
{
grub_install_no_backup = 1;
}
Then clean_grub_dir() would be changed to:
static void
clean_grub_dir (const char *di)
{
if (grub_install_no_backup)
{
clean_grub_dir_real (di, CLEAN_NEW);
}
else
{
clean_grub_dir_real (di, CLEAN_BACKUP);
clean_grub_dir_real (di, CREATE_BACKUP);
append_to_backup_dirs (di);
}
}
include/grub/util/install.h would publish the new call:
void
grub_set_install_no_backup (void);
grub-mkrescue.c would do:
grub_set_install_no_backup ();
between
grub_install_mkdir_p (boot_grub);
romdir = grub_util_path_concat (2, boot_grub, "roms");
grub_util_mkdir (romdir);
and
if (!grub_install_source_directory)
{
const char *pkglibdir = grub_util_get_pkglibdir ();
The gesture with the static variable immitates the way how the tools
can tell grub-util function restore_backup_atexit() whether to restore
the backup (default value 0) or to delete the backup (value 1).
Value 1 is set by call grub_set_install_backup_ponr() .
Just in case anything of above appears useful, it is
Signed-off-by: Thomas Schmitt <[email protected]>
Have a nice day :)
Thomas