Re: [PATCH] Compressed ia32 ELF file generation for loading by Gujin 1/3

H. Peter Anvin
2007-02-06T00:37:52Z

First of all, if sending attached patches, *MAKE SURE* they're text/plain.

> diff -uprN -X linux-2.6.20/Documentation/dontdiff linux-2.6.20/arch/i386/kernel/setup.c linux-2.6.20-gujin/arch/i386/kernel/setup.c
> --- linux-2.6.20/arch/i386/kernel/setup.c 2007-02-04 18:44:54.000000000 +0000
> +++ linux-2.6.20-gujin/arch/i386/kernel/setup.c 2007-02-05 21:27:01.000000000 +0000
> @@ -579,6 +579,19 @@ void __init setup_arch(char **cmdline_p)
> strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
> *cmdline_p = command_line;
>
> + /*
> + * If the command line begin with '/', it is the filename of the
> + * kernel file - like a shell command line. That can be used to
> + * deduce where root was located when the kernel was compiled,
> + * inside a directory of root named /boot, inside a small partition
> + * mounted on a directory of root named /boot or in the root
> + * directory itself.
> + */
> + if (**cmdline_p == '/')
> + while (**cmdline_p != ' ' && **cmdline_p != '\t'
> + && **cmdline_p != '\n' && **cmdline_p != '\0')
> + ++*cmdline_p;
> +
> max_low_pfn = setup_memory();
>
> /*

The standard way to do this is to have a command line argument named
BOOT_IMAGE (as in BOOT_IMAGE=/foo/bar/baz). There is no reason to do
this differently from every other bootloader.

Why build the real-mode code as part of the kernel binary? If you have
to reference kernel symbols, you can do that with the -R option to ld.
Bundling it into the kernel binary just to then extract it later is
silly at best.

> @@ -1106,6 +1179,9 @@ help:
> @echo 'Other generic targets:'
> @echo ' all - Build all targets marked with [*]'
> @echo '* vmlinux - Build the bare kernel'
> + @echo " /boot/linux-$(KERNELRELEASE).kgz - create a boot kernel for the Gujin bootloader"
> + @echo ' /boot/linux.kgz ROOT=/dev/hda1 - do not autodetect root filesystem at boot time'
> + @echo ' /boot/linux.kgz ROOT=auto - root filesystem from current /proc/cmdline'
> @echo '* modules - Build all modules'
> @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
> @echo ' dir/ - Build all files in dir and below'

This doesn't exactly fit very well the standard pattern. Something like
make gujin TARGET=... would be more like it.

Given how many of your files are highly Gujin-specific, and have generic
names, please put them in a subdirectory (e.g. arch/i386/boot/gujin/).

-hpa