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