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