def print_examples(): print print white('Examples')+':' print ' '+os.path.basename(sys.argv[0])+' kernel' print ' '+os.path.basename(sys.argv[0])+' --clean --menuconfig k' print ' '+os.path.basename(sys.argv[0])+' k --initramfs=/myinitramfsfile' print ' '+os.path.basename(sys.argv[0])+' i --splash=sabayon' print ' '+os.path.basename(sys.argv[0])+' --disklabel --lvm2 --splash=sabayon --luks -d -n initramfs' print ' '+os.path.basename(sys.argv[0])+' i --luks --lvm2 --disklabel --splash=sabayon --glibc --hostbin' print ' '+os.path.basename(sys.argv[0])+' i --splash=sabayon --disklabel --luks --lvm2 --dropbear --debugflag --rootpasswd=mypasswd --keymaps --ttyecho --strace --screen --glibc --zlib --libncurses --defconfig --nocache' print ' '+os.path.basename(sys.argv[0])+' --extract=/file i --to=/dir' print ' '+os.path.basename(sys.argv[0])+' initramfs --compress=/dir --into=/file'
def build(self): """ Append the LUKS static binary to the initramfs @return: bool """ logging.debug('>>> entering initramfs.append.bin_luks') cryptsetup_sbin = '/sbin/cryptsetup' process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-luks-temp/lib/luks', self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-luks-temp/sbin', self.verbose) # use from host logging.debug('initramfs.append.bin_luks from %s' % white('host')) process('cp %s %s/initramfs-bin-luks-temp/sbin' % (cryptsetup_sbin, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-luks-temp/sbin/cryptsetup' % self.temp['work'], self.verbose) if not isstatic(cryptsetup_sbin, self.verbose) and self.cli['dynlibs'] is True: luks_libs = listdynamiclibs(cryptsetup_sbin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-luks-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+cryptsetup_sbin+' is dynamically linked, copying detected libraries') for i in luks_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-luks-temp/lib'), self.verbose) else: logging.debug(cryptsetup_sbin+' is statically linked nothing to do') os.chdir(self.temp['work']+'/initramfs-bin-luks-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append screen binary from host to the initramfs @return: bool """ logging.debug('>>> entering initramfs.append.bin_screen') screen_bin = '/usr/bin/screen' process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-screen-temp/bin', self.verbose) # use from host logging.debug('initramfs.append.bin_screen from %s' % white('host')) process('cp %s %s/initramfs-bin-screen-temp/bin' % (screen_bin, self.temp['work']), self.verbose) process('chmod +rx %s/initramfs-bin-screen-temp/bin/screen' % self.temp['work'], self.verbose) if not isstatic(screen_bin, self.verbose) and self.cli['dynlibs'] is True: screen_libs = listdynamiclibs(screen_bin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-screen-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+screen_bin+' is dynamically linked, copying detected libraries') for i in screen_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-screen-temp/lib'), self.verbose) # add required /usr/share/terminfo/l/linux for screen # FIXME: to support other arch copy accordingly os.makedirs(self.temp['work']+'/initramfs-bin-screen-temp/usr/share/terminfo/l') process('cp /usr/share/terminfo/l/linux %s' % self.temp['work']+'/initramfs-bin-screen-temp/usr/share/terminfo/l', self.verbose) os.chdir(self.temp['work']+'/initramfs-bin-screen-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append blkid binary from the host @return: bool """ logging.debug('>>> entering initramfs.append.bin_disklabel') blkid_sbin = '/sbin/blkid' process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-disklabel-temp/bin', self.verbose) # use from host logging.debug('initramfs.append.bin_disklabelfrom %s' % white('host')) process('cp %s %s/initramfs-bin-disklabel-temp/bin' % (blkid_sbin, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-disklabel-temp/bin/blkid' % self.temp['work'], self.verbose) if not isstatic(blkid_sbin, self.verbose) and self.cli['dynlibs'] is True: blkid_libs = listdynamiclibs(blkid_sbin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-blkid-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+blkid_sbin+' is dynamically linked, copying detected libraries') for i in blkid_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-blkid-temp/lib'), self.verbose) else: logging.debug(blkid_sbin+' is statically linked nothing to do') os.chdir(self.temp['work']+'/initramfs-bin-disklabel-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append dmraid to initramfs from the host @return: bool """ logging.debug('>>> entering initramfs.append.bin.dmraid') dmraid_bin = '/usr/sbin/dmraid' process('mkdir -p ' + self.temp['work']+'/initramfs-bin-dmraid-temp/bin', self.verbose) # use from host logging.debug('initramfs.append.bin_dmraid from %s' % white('host')) process('cp %s %s/initramfs-bin-dmraid-temp/bin' % (dmraid_bin, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-dmraid-temp/bin/dmraid' % self.temp['work'], self.verbose) if not isstatic(dmraid_bin, self.verbose) and self.cli['dynlibs'] is True: dmraid_libs = listdynamiclibs(dmraid_bin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-dmraid-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+dmraid_bin+' is dynamically linked, copying detected libraries') for i in dmraid_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-dmraid-temp/lib'), self.verbose) else: logging.debug(dmraid_bin+' is statically linked nothing to do') # FIXME ln -sf raid456.ko raid45.ko ? # FIXME is it ok to have no raid456.ko? if so shouldn't we check .config for inkernel feat? # or should we raise an error and make the user enabling the module manually? warning? os.chdir(self.temp['work']+'/initramfs-bin-dmraid-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append strace host binary to the initramfs for debugging purposes @return: bool """ logging.debug('>>> entering initramfs.append.bin.strace') strace_bin = '/usr/bin/strace' process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-strace-temp/bin', self.verbose) # use from host logging.debug('initramfs.append.bin_strace from ' + white('host')) process('cp %s %s/initramfs-bin-strace-temp/bin' % (strace_bin, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-strace-temp/bin/strace' % self.temp['work'], self.verbose) if not isstatic(strace_bin, self.verbose) and self.cli['dynlibs'] is True: strace_libs = listdynamiclibs(strace_bin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-strace-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+strace_bin+' is dynamically linked, copying detected libraries') for i in strace_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-strace-temp/lib'), self.verbose) else: logging.debug(strace_bin+' is statically linked nothing to do') os.chdir(self.temp['work']+'/initramfs-bin-strace-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append blkid binary from the host @return: bool """ logging.debug(">>> entering initramfs.append.bin_disklabel") blkid_sbin = "/sbin/blkid" process("mkdir -p %s" % self.temp["work"] + "/initramfs-bin-disklabel-temp/bin", self.verbose) # use from host logging.debug("initramfs.append.bin_disklabelfrom %s" % white("host")) process("cp %s %s/initramfs-bin-disklabel-temp/bin" % (blkid_sbin, self.temp["work"]), self.verbose) process("chmod +x %s/initramfs-bin-disklabel-temp/bin/blkid" % self.temp["work"], self.verbose) if not isstatic(blkid_sbin, self.verbose) and self.cli["dynlibs"] is True: blkid_libs = listdynamiclibs(blkid_sbin, self.verbose) process("mkdir -p %s" % self.temp["work"] + "/initramfs-bin-blkid-temp/lib", self.verbose) print( yellow(" * ") + "... " + yellow("warning") + ": " + blkid_sbin + " is dynamically linked, copying detected libraries" ) for i in blkid_libs: print(green(" * ") + "... " + i) process("cp %s %s" % (i, self.temp["work"] + "/initramfs-bin-blkid-temp/lib"), self.verbose) else: logging.debug(blkid_sbin + " is statically linked nothing to do") os.chdir(self.temp["work"] + "/initramfs-bin-disklabel-temp") return os.system("find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio" % self.temp["cache"])
def build(self): """ Append evms libraries to the initramfs @return: bool """ logging.debug('>>> entering initramfs.append.bin.evms') print(green(' * ')+'...'+' feeding' + ' from '+white('host')) process('mkdir -p ' + self.temp['work']+'/initramfs-bin-evms-temp/lib/evms', self.verbose) process('mkdir -p ' + self.temp['work']+'/initramfs-bin-evms-temp/etc', self.verbose) process('mkdir -p ' + self.temp['work']+'/initramfs-bin-evms-temp/bin', self.verbose) process('mkdir -p ' + self.temp['work']+'/initramfs-bin-evms-temp/sbin', self.verbose) # FIXME compare this list to the one from 'ldd /sbin/evms' process_star('cp -a /lib/ld-* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libgcc_s* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libc.* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libc-* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libdl.* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libdl-* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libpthread* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/libuuid*so* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /usr/lib/libevms*so* %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process('cp -a /usr/lib/evms %s/initramfs-bin-evms-temp/lib' % self.temp['work'], self.verbose) process_star('cp -a /lib/evms/* %s/initramfs-bin-evms-temp/lib/evms' % self.temp['work'], self.verbose) process('cp -a /etc/evms.conf %s/initramfs-bin-evms-temp/etc' % self.temp['work'], self.verbose) # FIXME isstatic('/sbin/evms_activate')? process('cp /usr/sbin/evms_activate %s/initramfs-bin-evms-temp/sbin' % self.temp['work'], self.verbose) process_star('rm %s/initramfs-bin-evms-temp/lib/evms/*/swap*.so' % self.temp['work'], self.verbose) os.chdir(self.temp['work']+'/initramfs-bin-evms-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def print_usage(): print print ' a '+white('Portage')+' kernel|initramfs generator' print print 'Usage'+':' print ' '+white(sys.argv[0])+' <'+green('options')+'|'+turquoise('target')+'>'+' ['+turquoise('parameters')+']' print print green('Options') + ':' print ' --help, -h This and examples' print ' --nocolor, -n Do not colorize output' print ' --version Version' print ' --credits Credits and license' print print turquoise('Targets')+':' print ' kernel, k Build kernel/modules' print ' initramfs, i Build initramfs' print print turquoise('Parameters')+':' print ' '+os.path.basename(sys.argv[0])+' kernel'+' --help, -h' print ' '+os.path.basename(sys.argv[0])+' initramfs'+' --help, -h'
def print_examples(): print() print(stdout.white('Examples')+':') # print(' '+os.path.basename(sys.argv[0])+' kernel --fixdotconfig=splash') print(' '+os.path.basename(sys.argv[0])+' --clean --menuconfig k') print(' '+os.path.basename(sys.argv[0])+' k --initramfs=/myinitramfsfile -x') # print(' '+os.path.basename(sys.argv[0])+' i --splash=sabayon --execute') # print(' '+os.path.basename(sys.argv[0])+' --source-disklabel --source-lvm2 --splash=sabayon --host-luks -d -n initramfs -x') # print(' '+os.path.basename(sys.argv[0])+' i --host-luks --host-lvm2 --host-disklabel --splash=sabayon --host-glibc --dynlibs -x') # print(' '+os.path.basename(sys.argv[0])+' i --splash=emergence --source-disklabel --source-luks --source-lvm2 --source-dropbear --debugflag --rootpasswd=mypasswd --hostsshkeys --keymaps=all --source-ttyecho --source-strace --source-screen --host-glibc --host-zlib --host-libncurses --defconfig --nocache -x') print(' '+os.path.basename(sys.argv[0])+' --extract=/file t --to=/dir') print(' '+os.path.basename(sys.argv[0])+' tool --compress=/dir --into=/file')
def print_usage(): print() print(' a '+stdout.white('Portage')+' kernel|initramfs generator') print() print('Usage'+':') print(' '+stdout.white(sys.argv[0])+' <'+stdout.green('options')+'|'+stdout.turquoise('target')+'>'+' ['+stdout.turquoise('parameters')+']') print() print(stdout.green('Options') + ':') print(' --help, -h This and examples') print(' --nocolor, -n Do not colorize output') print(' --version Version') print(' --credits Credits and license') print() print(stdout.turquoise('Targets')+':') print(' kernel, k Build kernel/modules') print(' initramfs, i Build initramfs') print(' tool, t Handy tools') print() print(stdout.turquoise('Parameters')+':') print(' '+os.path.basename(sys.argv[0])+' kernel'+' --help, -h') print(' '+os.path.basename(sys.argv[0])+' initramfs'+' --help, -h') print(' '+os.path.basename(sys.argv[0])+' tool'+' --help, -h')
def build(self): """ Append busybox binary from the host @return: bool """ logging.debug('>>> entering initramfs.append.bin.busybox') bb_bin = '/bin/busybox' process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-busybox-temp/bin', self.verbose) # use from host logging.debug('initramfs.append.bin.busybox from %s' % white('host')) process('cp %s %s/initramfs-bin-busybox-temp/bin' % (bb_bin, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-busybox-temp/bin/busybox' % self.temp['work'], self.verbose) if not isstatic(bb_bin, self.verbose) and self.cli['dynlibs'] is True: bb_libs = listdynamiclibs(bb_bin, self.verbose) process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-busybox-temp/lib', self.verbose) print(yellow(' * ') + '... ' + yellow('warning')+': '+bb_bin+' is dynamically linked, copying detected libraries') for i in bb_libs: print(green(' * ') + '... ' + i) process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-busybox-temp/lib'), self.verbose) else: logging.debug(bb_bin+' is statically linked nothing to do') os.chdir(self.temp['work']+'/initramfs-bin-busybox-temp') process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-busybox-temp/usr/share/udhcpc/', self.verbose) process('cp %s/defaults/udhcpc.scripts %s/initramfs-bin-busybox-temp/usr/share/udhcpc/default.script' % (self.libdir, self.temp['work']), self.verbose) process('chmod +x %s/initramfs-bin-busybox-temp/usr/share/udhcpc/default.script' % self.temp['work'], self.verbose) # TO BE REMOVED : linuxrc's bb --install -s takes care of it # FIXME if busybox not exist then ln the default set -> [ ash sh mount uname echo cut cat for i in self.busyboxprogs.split(): process('ln -s busybox %s/initramfs-bin-busybox-temp/bin/%s' % (self.temp['work'], i), self.verbose) os.chdir(self.temp['work']+'/initramfs-bin-busybox-temp') return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
def build(self): """ Append strace host binary to the initramfs for debugging purposes @return: bool """ logging.debug(">>> entering initramfs.append.bin.strace") strace_bin = "/usr/bin/strace" process("mkdir -p %s" % self.temp["work"] + "/initramfs-bin-strace-temp/bin", self.verbose) # use from host logging.debug("initramfs.append.bin_strace from " + white("host")) process("cp %s %s/initramfs-bin-strace-temp/bin" % (strace_bin, self.temp["work"]), self.verbose) process("chmod +x %s/initramfs-bin-strace-temp/bin/strace" % self.temp["work"], self.verbose) if not isstatic(strace_bin, self.verbose) and self.cli["dynlibs"] is True: strace_libs = listdynamiclibs(strace_bin, self.verbose) process("mkdir -p %s" % self.temp["work"] + "/initramfs-bin-strace-temp/lib", self.verbose) print( yellow(" * ") + "... " + yellow("warning") + ": " + strace_bin + " is dynamically linked, copying detected libraries" ) for i in strace_libs: print(green(" * ") + "... " + i) process("cp %s %s" % (i, self.temp["work"] + "/initramfs-bin-strace-temp/lib"), self.verbose) else: logging.debug(strace_bin + " is statically linked nothing to do") os.chdir(self.temp["work"] + "/initramfs-bin-strace-temp") return os.system("find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio" % self.temp["cache"])
def build(self): """ Append evms libraries to the initramfs @return: bool """ logging.debug(">>> entering initramfs.append.bin.evms") print(green(" * ") + "..." + " feeding" + " from " + white("host")) process("mkdir -p " + self.temp["work"] + "/initramfs-bin-evms-temp/lib/evms", self.verbose) process("mkdir -p " + self.temp["work"] + "/initramfs-bin-evms-temp/etc", self.verbose) process("mkdir -p " + self.temp["work"] + "/initramfs-bin-evms-temp/bin", self.verbose) process("mkdir -p " + self.temp["work"] + "/initramfs-bin-evms-temp/sbin", self.verbose) # FIXME compare this list to the one from 'ldd /sbin/evms' process_star("cp -a /lib/ld-* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libgcc_s* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libc.* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libc-* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libdl.* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libdl-* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libpthread* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /lib/libuuid*so* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star("cp -a /usr/lib/libevms*so* %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process("cp -a /usr/lib/evms %s/initramfs-bin-evms-temp/lib" % self.temp["work"], self.verbose) process_star( "cp -a /lib/evms/* %s/initramfs-bin-evms-temp/lib/evms" % self.temp["work"], self.verbose ) process("cp -a /etc/evms.conf %s/initramfs-bin-evms-temp/etc" % self.temp["work"], self.verbose) # FIXME isstatic('/sbin/evms_activate')? process("cp /usr/sbin/evms_activate %s/initramfs-bin-evms-temp/sbin" % self.temp["work"], self.verbose) process_star("rm %s/initramfs-bin-evms-temp/lib/evms/*/swap*.so" % self.temp["work"], self.verbose) os.chdir(self.temp["work"] + "/initramfs-bin-evms-temp") return os.system("find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio" % self.temp["cache"])
def build(self): """ Build kernel """ zero = int('0') print(green(' * ')+'Kernel sources Makefile version '+white(self.KV)+' aka '+white(self.kname)) # dotconfig provided by config file if self.kernel_conf['dotconfig']: # backup the previous .config if found if os.path.isfile(self.kernel_conf['dotconfig']): from time import strftime self.copy_config(self.kerneldir + '/.config', self.kerneldir + '/.config-' + str(strftime("%Y-%m-%d-%H-%M-%S"))) # copy the custom .config if they are not the same if self.kernel_conf['dotconfig'] != self.kerneldir + '/.config': self.copy_config(self.kernel_conf['dotconfig'], self.kerneldir + '/.config') # dot config provided by cli if self.dotconfig: # backup the previous .config if found if os.path.isfile(self.kerneldir + '/.config'): from time import strftime self.copy_config(self.kerneldir + '/.config', self.kerneldir + '/.config-' + str(strftime("%Y-%m-%d-%H-%M-%S"))) # copy the custom .config if they are not the same if self.dotconfig != self.kerneldir + '/.config': self.copy_config(self.dotconfig, self.kerneldir + '/.config') # WARN do not use self.dotconfig from now on but use self.kerneldir + '/.config' to point to kernel config if (self.mrproper is True) or (self.mrproper == 'True'): if self.make_mrproper() is not zero: self.fail('mrproper') if (self.clean is True) or (self.clean == 'True' ): if self.make_clean() is not zero: self.fail('clean') # self.fixdotconfig is a list like : initramfs,selinux,splash,pax fixdotconfiglist = self.fixdotconfig.split(',') d = {} for i in fixdotconfiglist: d[i] = '' if 'initramfs' in d: # PATCH initramfs kernel option self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs']) if 'selinux' in d: # PATCH selinux kernel option self.add_option('CONFIG_AUDIT=y') self.add_option('CONFIG_AUDITSYSCALL=y') self.add_option('CONFIG_AUDIT_TREE=y') self.add_option('CONFIG_AUDIT_GENERIC=y') self.add_option('CONFIG_SECURITY_NETWORK=y') # above required to show SElinux self.add_option('CONFIG_SECURITY_SELINUX=y') if 'pax' in d: # PATCH PaX kernel option self.add_option('CONFIG_PAX_EMUTRAP=y') if 'splash' in d: # PATCH splash support self.add_option('CONFIG_FB=y') self.add_option('CONFIG_CONNECTOR=y') self.add_option('CONFIG_FB_UVESA=y') self.add_option('CONFIG_BLK_DEV=y') self.add_option('CONFIG_BLK_DEV_RAM=y') self.add_option('CONFIG_BLK_DEV_INITRD=y') self.add_option('CONFIG_FB_MODE_HELPERS=y') self.add_option('CONFIG_FB_TILEBLITTING=n') self.add_option('CONFIG_FRAMEBUFFER_CONSOLE=y') self.add_option('CONFIG_FB_CON_DECOR=y') self.add_option('CONFIG_INPUT_EVDEV=y') self.add_option('CONFIG_EXT2_FS=y') # FIXME this needs sys-apps/v86d # self.add_option('/usr/share/v86d/initramfs') # !!! by default don't alter dotconfig # !!! only if --fixdotconfig=<feat> is passed if (self.initramfs is not '') and (os.path.isfile(self.initramfs)): # user provides an initramfs! # FIXME do error handling: gzip screws it all like tar # if (self.fixdotconfig is True) or (self.kernel_conf['fixdotconfig'] is True): # self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs']) self.import_user_initramfs(self.initramfs) #else: # # ensure previous run with --initramfs have not left INITRAMFS configs if --fixdotconfig # if self.fixdotconfig is True: # self.remove_option('CONFIG_INITRAMFS_SOURCE') # initramfs provided by config file only elif (self.kernel_conf['initramfs'] is not '') and (self.initramfs is '') and (os.path.isfile(self.initramfs)): # if (self.fixdotconfig is True) or (self.kernel_conf['fixdotconfig'] is True): # self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs']) self.import_user_initramfs(self.kernel_conf['initramfs']) # else: # if self.fixdotconfig is True: # self.remove_option('CONFIG_INITRAMFS_SOURCE') elif (self.initramfs is not ''): print(red('error: ') + self.initramfs + " is not a file") sys.exit(2) if self.defconfig is True: if self.make_defconfig() is not zero: self.fail('defconfig') if self.localmodconfig is True: if self.make_localmodconfig() is not zero: self.fail('localmodconfig') if self.localyesconfig is True: if self.make_localyesconfig() is not zero: self.fail('localyesconfig') if self.silentoldconfig is True: if self.make_silentoldconfig() is not zero: self.fail('silentoldconfig') if (self.oldconfig is True): if self.make_oldconfig() is not zero: self.fail('oldconfig') if (self.menuconfig is True) or (self.menuconfig == 'True'): if self.make_menuconfig() is not zero: self.fail('menuconfig') # check for kernel .config (gotta be sure) if os.path.isfile(self.kerneldir+'/.config') is not True: self.fail(self.kerneldir+'/.config'+' does not exist.') # prepare if self.make_prepare() is not zero: self.fail('prepare') # bzImage if self.make_bzImage() is not zero: self.fail('bzImage') # modules # if --allnoconfig is passed, then modules are disabled # same with --nomodules if self.allnoconfig is not True and self.nomodules is not True: if self.make_modules() is not zero: self.fail('modules') if (self.nomodinstall is False) or (self.nomodinstall == 'False'): # modules_install if self.make_modules_install() is not zero: self.fail('modules_install') # save kernel config if (self.nosaveconfig is False) or (self.nosaveconfig == 'False'): if os.path.isdir('/etc/kernels/'): process('cp %s %s' % (self.kerneldir+'/.config', '/etc/kernels/dotconfig-kigen-'+self.arch+'-'+self.KV), self.verbose) else: process('mkdir /etc/kernels', self.verbose) process('cp %s %s' % (self.kerneldir+'/.config', '/etc/kernels/dotconfig-kigen-'+self.arch+'-'+self.KV), self.verbose) print(green(' * saved ') + '/etc/kernels/dotconfig-kigen-'+self.arch+'-'+self.KV)