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