Report on sourced config files
[genkernel.git] / gen_cmdline.sh
1 #!/bin/bash
2 # $Id$
3
4 longusage() {
5   echo "Gentoo Linux Genkernel ${GK_V}"
6   echo
7   echo "Usage: "
8   echo "  genkernel [options] action"
9   echo
10   echo "Available Actions: "
11   echo "  all                           Build all steps"
12   echo "  bzImage                       Build only the kernel"
13   echo "  initramfs                     Build only the ramdisk/initramfs"
14   echo "  kernel                        Build only the kernel and modules"
15   echo "  ramdisk                       Build only the ramdisk/initramfs"
16   echo
17   echo "Available Options: "
18   echo "  Configuration settings"
19   echo "        --config=<file> genkernel configuration file to use"
20   echo "  Debug settings"
21   echo "        --loglevel=<0-5>        Debug Verbosity Level"
22   echo "        --logfile=<outfile>     Output file for debug info"
23   echo "        --color                 Output debug in color"
24   echo "        --no-color              Do not output debug in color"
25   echo "  Kernel Configuration settings"
26   echo "        --menuconfig            Run menuconfig after oldconfig"
27   echo "        --no-menuconfig         Do not run menuconfig after oldconfig"
28   echo "        --gconfig                       Run gconfig after oldconfig"
29   echo "        --no-gconfig            Don't run gconfig after oldconfig"
30   echo "        --xconfig                       Run xconfig after oldconfig"
31   echo "        --no-xconfig            Don't run xconfig after oldconfig"
32   echo "        --save-config           Save the configuration to /etc/kernels"
33   echo "        --no-save-config        Don't save the configuration to /etc/kernels"
34   echo "  Kernel Compile settings"
35   echo "        --oldconfig             Implies --no-clean and runs a 'make oldconfig'"
36   echo "        --clean                 Run make clean before compilation"
37   echo "        --no-clean              Do not run make clean before compilation"
38   echo "        --mrproper              Run make mrproper before compilation"
39   echo "        --no-mrproper   Do not run make mrproper before compilation"
40   echo "        --splash                Install framebuffer splash support into initramfs"
41   echo "        --no-splash             Do not install framebuffer splash"
42   echo "        --install               Install the kernel after building"
43   echo "        --no-install            Do not install the kernel after building"
44   echo "        --symlink               Manage symlinks in /boot for installed images"
45   echo "        --no-symlink            Do not manage symlinks"
46   echo "        --ramdisk-modules       Copy required modules to the ramdisk"
47   echo "        --no-ramdisk-modules    Don't copy any modules to the ramdisk"
48   echo "        --all-ramdisk-modules   Copy all kernel modules to the ramdisk"
49   echo "        --callback=<...>        Run the specified arguments after the"
50   echo "                                kernel and modules have been compiled"
51   echo "        --static                Build a static (monolithic kernel)."
52   echo "        --no-static             Do not build a static (monolithic kernel)."
53   echo "  Kernel settings"
54   echo "        --kerneldir=<dir>       Location of the kernel sources"
55   echo "        --kernel-config=<file>  Kernel configuration file to use for compilation"
56   echo "        --module-prefix=<dir>   Prefix to kernel module destination, modules"
57   echo "                                will be installed in <prefix>/lib/modules"
58   echo "  Low-Level Compile settings"
59   echo "        --kernel-cc=<compiler>  Compiler to use for kernel (e.g. distcc)"
60   echo "        --kernel-as=<assembler> Assembler to use for kernel"
61   echo "        --kernel-ld=<linker>    Linker to use for kernel"
62   echo "        --kernel-cross-compile=<cross var> CROSS_COMPILE kernel variable"
63   echo "        --kernel-make=<makeprg> GNU Make to use for kernel"
64   echo "        --kernel-target=<t>     Override default make target (bzImage)"
65   echo "        --kernel-binary=<path>  Override default kernel binary path (arch/foo/boot/bar)"
66
67   echo "        --utils-cc=<compiler>   Compiler to use for utilities"
68   echo "        --utils-as=<assembler>  Assembler to use for utils"
69   echo "        --utils-ld=<linker>     Linker to use for utils"
70   echo "        --utils-make=<makeprog> GNU Make to use for utils"
71   echo "        --utils-cross-compile=<cross var> CROSS_COMPILE utils variable"
72   echo "        --utils-arch=<arch>     Force to arch for utils only instead of"
73   echo "                                autodetect."
74   echo "        --makeopts=<makeopts>   Make options such as -j2, etc..."
75   echo "        --mountboot             Mount BOOTDIR automatically if mountable"
76   echo "        --no-mountboot          Don't mount BOOTDIR automatically"  
77   echo "        --bootdir=<dir>         Set the location of the boot-directory, default is /boot"
78   echo "        --modprobedir=<dir>     Set the location of the modprobe.d-directory, default is /etc/modprobe.d"
79   echo "  Initialization"
80   echo "        --splash=<theme>        Enable framebuffer splash using <theme>"
81   echo "        --splash-res=<res>      Select splash theme resolutions to install"
82   echo "        --splash=<theme>        Enable framebuffer splash using <theme>"
83   echo "        --splash-res=<res>      Select splash theme resolutions to install"
84   echo "        --do-keymap-auto        Forces keymap selection at boot"
85   echo "        --keymap                Enables keymap selection support"
86   echo "        --no-keymap             Disables keymap selection support"
87   echo "        --lvm                   Include LVM support"
88   echo "        --no-lvm                Exclude LVM support"
89   echo "        --mdadm                 Include MDADM/MDMON support"
90   echo "        --no-mdadm              Exclude MDADM/MDMON support"
91   echo "        --mdadm-config=<file>   Use file as mdadm.conf in initramfs"
92   echo "        --dmraid                Include DMRAID support"
93   echo "        --no-dmraid             Exclude DMRAID support"
94   echo "        --zfs                   Include ZFS support"
95   echo "        --no-zfs                Exclude ZFS support"
96   echo "        --multipath             Include Multipath support"
97   echo "        --no-multipath  Exclude Multipath support"
98   echo "        --iscsi                 Include iSCSI support"
99   echo "        --no-iscsi              Exclude iSCSI support"
100   echo "        --bootloader=grub       Add new kernel to GRUB configuration"
101   echo "        --linuxrc=<file>        Specifies a user created linuxrc"
102   echo "        --busybox-config=<file> Specifies a user created busybox config"
103   echo "        --genzimage             Make and install kernelz image (PowerPC)"
104   echo "        --disklabel             Include disk label and uuid support in your ramdisk"
105   echo "        --no-disklabel  Exclude disk label and uuid support in your ramdisk"
106   echo "        --luks                  Include LUKS support"
107   echo "                                --> 'emerge cryptsetup-luks' with USE=-dynamic"
108   echo "        --no-luks               Exclude LUKS support"
109   echo "        --gpg                   Include GPG-armored LUKS key support"
110   echo "        --no-gpg                Exclude GPG-armored LUKS key support"
111   echo "        --busybox               Include busybox"
112   echo "        --no-busybox    Exclude busybox"
113   echo "        --unionfs               Include support for unionfs"
114   echo "        --no-unionfs    Exclude support for unionfs"
115   echo "        --netboot               Create a self-contained env in the initramfs"
116   echo "        --no-netboot    Exclude --netboot env"
117   echo "        --real-root=<foo>       Specify a default for real_root="
118   echo "  Internals"
119   echo "        --arch-override=<arch>  Force to arch instead of autodetect"
120   echo "        --cachedir=<dir>        Override the default cache location"
121   echo "        --tempdir=<dir>         Location of Genkernel's temporary directory"
122   echo "        --postclear                     Clear all tmp files and caches after genkernel has run"
123   echo "        --no-postclear          Do not clean up after genkernel has run"
124   echo "  Output Settings"
125   echo "        --kernname=<...>        Tag the kernel and ramdisk with a name:"
126   echo "                                If not defined the option defaults to"
127   echo "                                'genkernel'"
128   echo "        --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and ramdisk:"
129   echo "                                No modules outside of the ramdisk will be"
130   echo "                                included..."
131   echo "        --modulespackage=<tbz2> File to output a .tar.bz2'd modules after the"
132   echo "                                callbacks have run"
133   echo "        --kerncache=<tbz2>      File to output a .tar.bz2'd kernel contents"
134   echo "                                of /lib/modules/ and the kernel config"
135   echo "                                NOTE: This is created before the callbacks"
136   echo "                                are run!"
137   echo "        --no-kernel-sources     This option is only valid if kerncache is"
138   echo "                                defined. If there is a valid kerncache no checks"
139   echo "                                will be made against a kernel source tree"
140   echo "        --initramfs-overlay=<dir>"
141   echo "                                Directory structure to include in the initramfs,"
142   echo "                                only available on 2.6 kernels"
143   echo "        --firmware"
144   echo "                                Enable copying of firmware into initramfs"
145   echo "        --firmware-dir=<dir>"
146   echo "                                Specify directory to copy firmware from (defaults"
147   echo "                                to /lib/firmware)"
148   echo "        --firmware-files=<files>"
149   echo "                                Specifies specific firmware files to copy. This"
150   echo "                                overrides --firmware-dir. For multiple files,"
151   echo "                                separate the filenames with a comma"
152   echo "        --integrated-initramfs, --no-integrated-initramfs"
153   echo "                                Include/exclude the generated initramfs in the kernel"
154   echo "                                instead of keeping it as a separate file"
155   echo "        --compress-initramfs, --no-compress-initramfs,"
156   echo "        --compress-initrd, --no-compress-initrd"
157   echo "                                Compress or do not compress the generated initramfs"
158   echo "        --compress-initramfs-type=<arg>"
159   echo "                                Compression type for initramfs (best, xz, lzma, bzip2, gzip, lzop)"
160 }
161
162 usage() {
163   echo "Gentoo Linux Genkernel ${GK_V}"
164   echo
165   echo "Usage: "
166   echo "        genkernel [options] all"
167   echo
168   echo 'Some useful options:'
169   echo '        --menuconfig            Run menuconfig after oldconfig'
170   echo '        --no-clean              Do not run make clean before compilation'
171   echo '        --no-mrproper           Do not run make mrproper before compilation,'
172   echo '                                this is implied by --no-clean.'
173   echo
174   echo 'For a detailed list of supported options and flags; issue:'
175   echo '        genkernel --help'
176 }
177
178 parse_optbool() {
179         local opt=${1/--no-*/0} # false
180         opt=${opt/--*/1} # true
181         echo $opt
182 }
183
184 parse_cmdline() {
185         case "$*" in
186                 --kernel-cc=*)
187                         CMD_KERNEL_CC=`parse_opt "$*"`
188                         print_info 2 "CMD_KERNEL_CC: ${CMD_KERNEL_CC}"
189                         ;;
190                 --kernel-ld=*)
191                         CMD_KERNEL_LD=`parse_opt "$*"`
192                         print_info 2 "CMD_KERNEL_LD: ${CMD_KERNEL_LD}"
193                         ;;
194                 --kernel-as=*)
195                         CMD_KERNEL_AS=`parse_opt "$*"`
196                         print_info 2 "CMD_KERNEL_AS: ${CMD_KERNEL_AS}"
197                         ;;
198                 --kernel-make=*)
199                         CMD_KERNEL_MAKE=`parse_opt "$*"`
200                         print_info 2 "CMD_KERNEL_MAKE: ${CMD_KERNEL_MAKE}"
201                         ;;
202                 --kernel-target=*)
203                         KERNEL_MAKE_DIRECTIVE_OVERRIDE=`parse_opt "$*"`
204                         print_info 2 "KERNEL_MAKE_DIRECTIVE_OVERRIDE: ${KERNEL_MAKE_DIRECTIVE_OVERRIDE}"
205                         ;;
206                 --kernel-binary=*)
207                         KERNEL_BINARY_OVERRIDE=`parse_opt "$*"`
208                         print_info 2 "KERNEL_BINARY_OVERRIDE: ${KERNEL_BINARY_OVERRIDE}"
209                         ;;
210                 --kernel-cross-compile=*)
211                         CMD_KERNEL_CROSS_COMPILE=`parse_opt "$*"`
212                         CMD_KERNEL_CROSS_COMPILE=$(echo ${CMD_KERNEL_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
213                         print_info 2 "CMD_KERNEL_CROSS_COMPILE: ${CMD_KERNEL_CROSS_COMPILE}"
214                         ;;
215                 --utils-cc=*)
216                         CMD_UTILS_CC=`parse_opt "$*"`
217                         print_info 2 "CMD_UTILS_CC: ${CMD_UTILS_CC}"
218                         ;;
219                 --utils-ld=*)
220                         CMD_UTILS_LD=`parse_opt "$*"`
221                         print_info 2 "CMD_UTILS_LD: ${CMD_UTILS_LD}"
222                         ;;
223                 --utils-as=*)
224                         CMD_UTILS_AS=`parse_opt "$*"`
225                         print_info 2 "CMD_UTILS_AS: ${CMD_UTILS_AS}"
226                         ;;
227                 --utils-make=*)
228                         CMD_UTILS_MAKE=`parse_opt "$*"`
229                         print_info 2 "CMD_UTILS_MAKE: ${CMD_UTILS_MAKE}"
230                         ;;
231                 --utils-cross-compile=*)
232                         CMD_UTILS_CROSS_COMPILE=`parse_opt "$*"`
233                         CMD_UTILS_CROSS_COMPILE=$(echo ${CMD_UTILS_CROSS_COMPILE}|sed -e 's/.*[^-]$/&-/g')
234                         print_info 2 "CMD_UTILS_CROSS_COMPILE: ${CMD_UTILS_CROSS_COMPILE}"
235                         ;;
236                 --utils-arch=*)
237                         CMD_UTILS_ARCH=`parse_opt "$*"`
238                         print_info 2 "CMD_UTILS_ARCH: ${CMD_ARCHOVERRIDE}"
239                         ;;
240                 --makeopts=*)
241                         CMD_MAKEOPTS=`parse_opt "$*"`
242                         print_info 2 "CMD_MAKEOPTS: ${CMD_MAKEOPTS}"
243                         ;;
244                 --mountboot|--no-mountboot)
245                         CMD_MOUNTBOOT=`parse_optbool "$*"`
246                         print_info 2 "CMD_MOUNTBOOT: ${CMD_MOUNTBOOT}"
247                         ;;
248                 --bootdir=*)
249                         CMD_BOOTDIR=`parse_opt "$*"`
250                         print_info 2 "CMD_BOOTDIR: ${CMD_BOOTDIR}"
251                         ;;
252                 --modprobedir=*)
253                         CMD_MODPROBEDIR=`parse_opt "$*"`
254                         print_info 2 "CMD_MODPROBEDIR: ${CMD_MODPROBEDIR}"
255                         ;;
256                 --do-keymap-auto)
257                         CMD_DOKEYMAPAUTO=1
258                         CMD_KEYMAP=1
259                         print_info 2 "CMD_DOKEYMAPAUTO: ${CMD_DOKEYMAPAUTO}"
260                         ;;
261                 --keymap|--no-keymap)
262                         CMD_KEYMAP=`parse_optbool "$*"`
263                         print_info 2 "CMD_KEYMAP: ${CMD_KEYMAP}"
264                         ;;
265                 --lvm|--no-lvm)
266                         CMD_LVM=`parse_optbool "$*"`
267                         print_info 2 "CMD_LVM: ${CMD_LVM}"
268                         ;;
269                 --lvm2|--no-lvm2)
270                         CMD_LVM=`parse_optbool "$*"`
271                         print_info 2 "CMD_LVM: ${CMD_LVM}"
272                         echo
273                         print_warning 1 "Please use --lvm, as --lvm2 is deprecated."
274                         ;;
275                 --mdadm|--no-mdadm)
276                         CMD_MDADM=`parse_optbool "$*"`
277                         print_info 2 "CMD_MDADM: $CMD_MDADM"
278                         ;;
279                 --mdadm-config=*)
280                         CMD_MDADM_CONFIG=`parse_opt "$*"`
281                         print_info 2 "CMD_MDADM_CONFIG: $CMD_MDADM_CONFIG"
282                         ;;
283                 --busybox|--no-busybox)
284                         CMD_BUSYBOX=`parse_optbool "$*"`
285                         print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}"
286                         ;;
287                 --unionfs|--no-unionfs)
288                         CMD_UNIONFS=`parse_optbool "$*"`
289                         print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"
290                         ;;
291                 --netboot|--no-netboot)
292                         CMD_NETBOOT=`parse_optbool "$*"`
293                         print_info 2 "CMD_NETBOOT: ${CMD_NETBOOT}"
294                         ;;
295                 --real-root=*)
296                         CMD_REAL_ROOT=`parse_opt "$*"`
297                         print_info 2 "CMD_REAL_ROOT: ${CMD_REAL_ROOT}"
298                         ;;
299                 --dmraid|--no-dmraid)
300                         CMD_DMRAID=`parse_optbool "$*"`
301                         if [ "$CMD_DMRAID" = "1" -a ! -e /usr/include/libdevmapper.h ]
302                         then
303                                 echo 'Error: --dmraid requires LVM2 to be installed'
304                                 echo '           on the host system; try "emerge lvm2".'
305                                 exit 1
306                         fi
307                         print_info 2 "CMD_DMRAID: ${CMD_DMRAID}"
308                         ;;
309                 --zfs|--no-zfs)
310                         CMD_ZFS=`parse_optbool "$*"`
311                         print_info 2 "CMD_ZFS: ${CMD_ZFS}"
312                         ;;
313                 --multipath|--no-multipath)
314                         CMD_MULTIPATH=`parse_optbool "$*"`
315                         if [ "$CMD_MULTIPATH" = "1" -a ! -e /usr/include/libdevmapper.h ]
316                         then
317                                 echo 'Error: --multipath requires LVM2 to be installed'
318                                 echo '           on the host;system; try "emerge lvm2".'
319                                 exit 1
320                         fi
321                         print_info 2 "CMD_MULTIPATH: ${CMD_MULTIPATH}"
322                         ;;
323                 --bootloader=*)
324                         CMD_BOOTLOADER=`parse_opt "$*"`
325                         print_info 2 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}"
326                         ;;
327                 --iscsi|--no-iscsi)
328                         CMD_ISCSI=`parse_optbool "$*"`
329                         print_info 2 "CMD_ISCSI: ${CMD_ISCSI}"
330                         ;;
331                 --loglevel=*)
332                         CMD_LOGLEVEL=`parse_opt "$*"`
333                         LOGLEVEL="${CMD_LOGLEVEL}"
334                         print_info 2 "CMD_LOGLEVEL: ${CMD_LOGLEVEL}"
335                         ;;
336                 --menuconfig)
337                         TERM_LINES=`stty -a | head -n 1 | cut -d\  -f5 | cut -d\; -f1`
338                         TERM_COLUMNS=`stty -a | head -n 1 | cut -d\  -f7 | cut -d\; -f1`
339                         if [[ TERM_LINES -lt 19 || TERM_COLUMNS -lt 80 ]]
340                         then
341                                 echo "Error: You need a terminal with at least 80 columns"
342                                 echo "           and 19 lines for --menuconfig; try --no-menuconfig..."
343                                 exit 1
344                         fi
345                         CMD_MENUCONFIG=1
346                         print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
347                         ;;
348                 --no-menuconfig)
349                         CMD_MENUCONFIG=0
350                         print_info 2 "CMD_MENUCONFIG: ${CMD_MENUCONFIG}"
351                         ;;
352                 --gconfig|--no-gconfig)
353                         CMD_GCONFIG=`parse_optbool "$*"`
354                         print_info 2 "CMD_GCONFIG: ${CMD_GCONFIG}"
355                         ;;
356                 --xconfig|--no-xconfig)
357                         CMD_XCONFIG=`parse_optbool "$*"`
358                         print_info 2 "CMD_XCONFIG: ${CMD_XCONFIG}"
359                         ;;
360                 --save-config|--no-save-config)
361                         CMD_SAVE_CONFIG=`parse_optbool "$*"`
362                         print_info 2 "CMD_SAVE_CONFIG: ${CMD_SAVE_CONFIG}"
363                         ;;
364                 --mrproper|--no-mrproper)
365                         CMD_MRPROPER=`parse_optbool "$*"`
366                         print_info 2 "CMD_MRPROPER: ${CMD_MRPROPER}"
367                         ;;
368                 --clean|--no-clean)
369                         CMD_CLEAN=`parse_optbool "$*"`
370                         print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
371                         ;;
372                 --oldconfig|--no-oldconfig)
373                         CMD_OLDCONFIG=`parse_optbool "$*"`
374                         [ "$CMD_OLDCONFIG" = "1" ] && CMD_CLEAN=0
375                         print_info 2 "CMD_CLEAN: ${CMD_CLEAN}"
376                         print_info 2 "CMD_OLDCONFIG: ${CMD_OLDCONFIG}"
377                         ;;
378                 --gensplash=*)
379                         CMD_SPLASH=1
380                         SPLASH_THEME=`parse_opt "$*"`
381                         print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
382                         print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
383                         echo
384                         print_warning 1 "Please use --splash, as --gensplash is deprecated."
385                         ;;
386                 --gensplash|--no-gensplash)
387                         CMD_SPLASH=`parse_optbool "$*"`
388                         SPLASH_THEME='default'
389                         print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
390                         echo
391                         print_warning 1 "Please use --splash, as --gensplash is deprecated."
392                         ;;
393                 --splash=*)
394                         CMD_SPLASH=1
395                         SPLASH_THEME=`parse_opt "$*"`
396                         print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
397                         print_info 2 "SPLASH_THEME: ${SPLASH_THEME}"
398                         ;;
399                 --splash|--no-splash)
400                         CMD_SPLASH=`parse_optbool "$*"`
401                         SPLASH_THEME='default'
402                         print_info 2 "CMD_SPLASH: ${CMD_SPLASH}"
403                         ;;
404                 --gensplash-res=*)
405                         SPLASH_RES=`parse_opt "$*"`
406                         print_info 2 "SPLASH_RES: ${SPLASH_RES}"
407                         echo
408                         print_warning 1 "Please use --splash-res, as --gensplash-res is deprecated."
409                         ;;
410                 --splash-res=*)
411                         SPLASH_RES=`parse_opt "$*"`
412                         print_info 2 "SPLASH_RES: ${SPLASH_RES}"
413                         ;;
414                 --install|--no-install)
415                         CMD_INSTALL=`parse_optbool "$*"`
416                         print_info 2 "CMD_INSTALL: ${CMD_INSTALL}"
417                         ;;
418                 --ramdisk-modules|--no-ramdisk-modules)
419                         CMD_RAMDISKMODULES=`parse_optbool "$*"`
420                         print_info 2 "CMD_RAMDISKMODULES: ${CMD_RAMDISKMODULES}"
421                         ;;
422                 --all-ramdisk-modules|--no-all-ramdisk-modules)
423                         CMD_ALLRAMDISKMODULES=`parse_optbool "$*"`
424                         print_info 2 "CMD_ALLRAMDISKMODULES: ${CMD_ALLRAMDISKMODULES}"
425                         ;;
426                 --callback=*)
427                         CMD_CALLBACK=`parse_opt "$*"`
428                         print_info 2 "CMD_CALLBACK: ${CMD_CALLBACK}/$*"
429                         ;;
430                 --static|--no-static)
431                         CMD_STATIC=`parse_optbool "$*"`
432                         print_info 2 "CMD_STATIC: ${CMD_STATIC}"
433                         ;;
434                 --tempdir=*)
435                         TMPDIR=`parse_opt "$*"`
436                         TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
437                         print_info 2 "TMPDIR: ${TMPDIR}"
438                         print_info 2 "TEMP: ${TEMP}"
439                         ;;
440                 --postclear|--no-postclear)
441                         CMD_POSTCLEAR=`parse_optbool "$*"`
442                         print_info 2 "CMD_POSTCLEAR: ${CMD_POSTCLEAR}"
443                         ;;
444                 --arch-override=*)
445                         CMD_ARCHOVERRIDE=`parse_opt "$*"`
446                         print_info 2 "CMD_ARCHOVERRIDE: ${CMD_ARCHOVERRIDE}"
447                         ;;
448                 --color|--no-color)
449                         USECOLOR=`parse_optbool "$*"`
450                         print_info 2 "USECOLOR: ${USECOLOR}"
451                         setColorVars
452                         ;;
453                 --logfile=*)
454                         CMD_LOGFILE=`parse_opt "$*"`
455                         LOGFILE=`parse_opt "$*"`
456                         print_info 2 "CMD_LOGFILE: ${CMD_LOGFILE}"
457                         print_info 2 "LOGFILE: ${CMD_LOGFILE}"
458                         ;;
459                 --kerneldir=*)
460                         CMD_KERNEL_DIR=`parse_opt "$*"`
461                         print_info 2 "CMD_KERNEL_DIR: ${CMD_KERNEL_DIR}"
462                         ;;
463                 --kernel-config=*)
464                         CMD_KERNEL_CONFIG=`parse_opt "$*"`
465                         print_info 2 "CMD_KERNEL_CONFIG: ${CMD_KERNEL_CONFIG}"
466                         ;;
467                 --module-prefix=*)
468                         CMD_INSTALL_MOD_PATH=`parse_opt "$*"`
469                         print_info 2 "CMD_INSTALL_MOD_PATH: ${CMD_INSTALL_MOD_PATH}"
470                         ;;
471                 --cachedir=*)
472                         CACHE_DIR=`parse_opt "$*"`
473                         print_info 2 "CACHE_DIR: ${CACHE_DIR}"
474                         ;;
475                 --minkernpackage=*)
476                         CMD_MINKERNPACKAGE=`parse_opt "$*"`
477                         print_info 2 "MINKERNPACKAGE: ${CMD_MINKERNPACKAGE}"
478                         ;;
479                 --modulespackage=*)
480                         CMD_MODULESPACKAGE=`parse_opt "$*"`
481                         print_info 2 "MODULESPACKAGE: ${CMD_MODULESPACKAGE}"
482                         ;;
483                 --kerncache=*)
484                         CMD_KERNCACHE=`parse_opt "$*"`
485                         print_info 2 "KERNCACHE: ${CMD_KERNCACHE}"
486                         ;;
487                 --kernname=*)
488                         CMD_KERNNAME=`parse_opt "$*"`
489                         print_info 2 "KERNNAME: ${CMD_KERNNAME}"
490                         ;;
491                 --symlink|--no-symlink)
492                         CMD_SYMLINK=`parse_optbool "$*"`
493                         print_info 2 "CMD_SYMLINK: ${CMD_SYMLINK}"
494                         ;;
495                 --kernel-sources|--no-kernel-sources)
496                         CMD_KERNEL_SOURCES=`parse_optbool "$*"`
497                         print_info 2 "CMD_KERNEL_SOURCES: ${CMD_KERNEL_SOURCES}"
498                         ;;
499                 --initramfs-overlay=*)
500                         CMD_INITRAMFS_OVERLAY=`parse_opt "$*"`
501                         print_info 2 "CMD_INITRAMFS_OVERLAY: ${CMD_INITRAMFS_OVERLAY}"
502                         ;;
503                 --linuxrc=*)
504                         CMD_LINUXRC=`parse_opt "$*"`
505                         print_info 2 "CMD_LINUXRC: ${CMD_LINUXRC}"
506                         ;;
507                 --busybox-config=*)
508                         CMD_BUSYBOX_CONFIG=`parse_opt "$*"`
509                         print_info 2 "CMD_BUSYBOX_CONFIG: ${CMD_BUSYBOX_CONFIG}"
510                         ;;
511                 --genzimage)
512                         KERNEL_MAKE_DIRECTIVE_2='zImage.initrd'
513                         KERNEL_BINARY_2='arch/powerpc/boot/zImage.initrd'
514                         CMD_GENZIMAGE="yes"
515 #                       ENABLE_PEGASOS_HACKS="yes"
516 #                       print_info 2 "ENABLE_PEGASOS_HACKS: ${ENABLE_PEGASOS_HACKS}"
517                         ;;
518                 --disklabel|--no-disklabel)
519                         CMD_DISKLABEL=`parse_optbool "$*"`
520                         print_info 2 "CMD_DISKLABEL: ${CMD_DISKLABEL}"
521                         ;;
522                 --luks|--no-luks)
523                         CMD_LUKS=`parse_optbool "$*"`
524                         print_info 2 "CMD_LUKS: ${CMD_LUKS}"
525                         ;;
526                 --gpg|--no-gpg)
527                         CMD_GPG=`parse_optbool "$*"`
528                         print_info 2 "CMD_GPG: ${CMD_GPG}"
529                         ;;
530                 --firmware|--no-firmware)
531                         CMD_FIRMWARE=`parse_optbool "$*"`
532                         print_info 2 "CMD_FIRMWARE: ${CMD_FIRMWARE}"
533                         ;;
534                 --firmware-dir=*)
535                         CMD_FIRMWARE_DIR=`parse_opt "$*"`
536                         CMD_FIRMWARE=1
537                         print_info 2 "CMD_FIRMWARE_DIR: ${CMD_FIRMWARE_DIR}"
538                         ;;
539                 --firmware-files=*)
540                         CMD_FIRMWARE_FILES=`parse_opt "$*"`
541                         CMD_FIRMWARE=1
542                         print_info 2 "CMD_FIRMWARE_FILES: ${CMD_FIRMWARE_FILES}"
543                         ;;
544                 --integrated-initramfs|--no-integrated-initramfs)
545                         CMD_INTEGRATED_INITRAMFS=`parse_optbool "$*"`
546                         print_info 2 "CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"
547                         ;;
548                 --compress-initramfs|--no-compress-initramfs|--compress-initrd|--no-compress-initrd)
549                         CMD_COMPRESS_INITRD=`parse_optbool "$*"`
550                         print_info 2 "CMD_COMPRESS_INITRD=${CMD_COMPRESS_INITRD}"
551                         ;;
552                 --compress-initramfs-type=*|--compress-initrd-type=*)
553                         COMPRESS_INITRD_TYPE=`parse_opt "$*"`
554                         print_info 2 "CMD_COMPRESS_INITRD_TYPE: ${CMD_LINUXRC}"
555                         ;;
556                 --config=*)
557                         print_info 2 "CMD_GK_CONFIG: `parse_opt "$*"`"
558                         ;;
559                 all)
560                         BUILD_KERNEL=1
561                         BUILD_MODULES=1
562                         BUILD_RAMDISK=1
563                         ;;
564                 ramdisk|initramfs)
565                         BUILD_RAMDISK=1
566                         ;;
567                 kernel)
568                         BUILD_KERNEL=1
569                         BUILD_MODULES=1
570                         BUILD_RAMDISK=0
571                         ;;
572                 bzImage)
573                         BUILD_KERNEL=1
574                         BUILD_MODULES=0
575                         BUILD_RAMDISK=1
576                         CMD_RAMDISKMODULES=0
577                         print_info 2 "CMD_RAMDISKMODULES: ${CMD_RAMDISKMODULES}"
578                         ;;
579                 --help)
580                         longusage
581                         exit 1
582                         ;;
583                 --version)
584                         echo "${GK_V}"
585                         exit 0
586                         ;;
587                 *)
588                         echo "Error: Unknown option '$*'!"
589                         exit 1
590                         ;;
591         esac
592 }