Beispiel #1
0
    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'])
Beispiel #2
0
    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'])
Beispiel #3
0
    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'])
Beispiel #4
0
    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'])
Beispiel #5
0
    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'])
Beispiel #6
0
    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"])
Beispiel #7
0
    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'])
Beispiel #8
0
    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"])
Beispiel #9
0
    def build(self):
        """
        Append lvm2 static binary from host to the initramfs
    
        @return: bool
        """
        logging.debug('>>> entering initramfs.append.host.lvm2')
        lvm2_static_bin = '/sbin/lvm.static'
        lvm2_bin        = '/sbin/lvm'

        process('mkdir -p ' + self.temp['work']+'/initramfs-bin-lvm2-temp/etc/lvm', self.verbose)
        process('mkdir -p ' + self.temp['work']+'/initramfs-bin-lvm2-temp/bin', self.verbose)

        # copy binary from host
        logging.debug('initramfs.append.bin_lvm2')
        process('cp %s      %s/initramfs-bin-lvm2-temp/bin/lvm'         % (lvm2_static_bin, self.temp['work']), self.verbose)
        process('cp %s      %s/initramfs-bin-lvm2-temp/bin/lvm_static'  % (lvm2_static_bin, self.temp['work']), self.verbose)
        process('chmod +x   %s/initramfs-bin-lvm2-temp/bin/lvm'         % self.temp['work'], self.verbose)
        process('chmod +x   %s/initramfs-bin-lvm2-temp/bin/lvm_static'  % self.temp['work'], self.verbose)

        if not isstatic(lvm2_static_bin, self.verbose) and self.cli['dynlibs'] is True:
            lvm2_libs = listdynamiclibs(lvm2_static_bin, self.verbose)
            process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-lvm2-temp/lib', self.verbose)
            print(yellow(' * ') + '... ' + yellow('warning')+': '+lvm2_bin+' is dynamically linked, copying detected libraries')
            for i in lvm2_libs:
                print (green(' * ') + '... ' + i)
                process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-lvm2-temp/lib'), self.verbose)
        else:
            logging.debug(lvm2_static_bin+' is statically linked nothing to do')

        # FIXME print something to the user about it so he knows and can tweak it before
        if os.path.isfile(lvm2_static_bin) or os.path.isfile(lvm2_bin):
            process('cp /etc/lvm/lvm.conf %s/initramfs-bin-lvm2-temp/etc/lvm/' % self.temp['work'], self.verbose)

        os.chdir(self.temp['work']+'/initramfs-bin-lvm2-temp')
        return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])
Beispiel #10
0
    def build(self):
        """
        Append dropbear support to the initramfs
    
        @return: bool
        """
        logging.debug(">>> entering initramfs.append.host.dropbear")
        for i in ["bin", "sbin", "dev", "usr/bin", "usr/sbin", "lib", "etc", "var/log", "var/run", "root"]:
            process("mkdir -p %s/%s" % (self.temp["work"] + "/initramfs-bin-dropbear-temp/", i), self.verbose)

        dropbear_sbin = "/usr/sbin/dropbear"

        dbscp_bin = "/usr/bin/dbscp"  # FIXME assumes host version is patched w/ scp->dbscp because of openssh.
        # FIXME compilation of dropbear sources are not patched hence
        # FIXME if --dropbear --hostbin
        # FIXME then /usr/bin/scp
        # FIXME else /usr/bin/dbscp
        dbclient_bin = "/usr/bin/dbclient"
        dropbearkey_bin = "/usr/bin/dropbearkey"
        dropbearconvert_bin = "/usr/bin/dropbearconvert"

        process("cp %s %s/initramfs-bin-dropbear-temp/bin" % (dbscp_bin, self.temp["work"]), self.verbose)
        process("cp %s %s/initramfs-bin-dropbear-temp/bin" % (dbclient_bin, self.temp["work"]), self.verbose)
        process("cp %s %s/initramfs-bin-dropbear-temp/bin" % (dropbearkey_bin, self.temp["work"]), self.verbose)
        process("cp %s %s/initramfs-bin-dropbear-temp/bin" % (dropbearconvert_bin, self.temp["work"]), self.verbose)
        process("cp %s %s/initramfs-bin-dropbear-temp/sbin" % (dropbear_sbin, self.temp["work"]), self.verbose)
        process("chmod +x %s/initramfs-bin-dropbear-temp/bin/dbscp" % self.temp["work"], self.verbose)
        process("chmod +x %s/initramfs-bin-dropbear-temp/bin/dbclient" % self.temp["work"], self.verbose)
        process("chmod +x %s/initramfs-bin-dropbear-temp/bin/dropbearkey" % self.temp["work"], self.verbose)
        process("chmod +x %s/initramfs-bin-dropbear-temp/bin/dropbearconvert" % self.temp["work"], self.verbose)
        process("chmod +x %s/initramfs-bin-dropbear-temp/sbin/dropbear" % self.temp["work"], self.verbose)

        # FIXME check if dropbearkey dropbearconvert dbclient dbscp static too? NO ldd says they all use the same as /usr/sbin/dropbear
        if not isstatic(dropbear_sbin, self.verbose) and self.cli["dynlibs"] is True:
            dropbear_libs = listdynamiclibs(dropbear_sbin, self.verbose)
            process("mkdir -p %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/lib", self.verbose)
            print(
                yellow(" * ")
                + "... "
                + yellow("warning")
                + ": "
                + dropbear_sbin
                + " is dynamically linked, copying detected libraries"
            )
            for i in dropbear_libs:
                print(green(" * ") + "... " + i)
                process("cp %s %s" % (i, self.temp["work"] + "/initramfs-bin-dropbear-temp/lib"), self.verbose)
        else:
            logging.debug("dropbear is static nothing to do")

        process("cp /etc/localtime %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/etc", self.verbose)
        process("cp /etc/nsswitch.conf %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/etc", self.verbose)
        process("cp /etc/hosts %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/etc", self.verbose)
        process("touch %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/var/log/lastlog", self.verbose)
        process("touch %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/var/log/wtmp", self.verbose)
        process("touch %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/var/run/utmp", self.verbose)

        # ship the boot* scripts too
        #        process('cp %s/scripts/boot-luks-lvm.sh %s' % (self.libdir, self.temp['work']+'/initramfs-bin-dropbear-temp/root'), self.verbose)
        #        process('chmod +x %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/root/boot-luks-lvm.sh', self.verbose)
        #        process('cp %s/scripts/boot-luks.sh %s' % (self.libdir, self.temp['work']+'/initramfs-bin-dropbear-temp/root'), self.verbose)
        #        process('chmod +x %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/root/boot-luks.sh', self.verbose)
        process(
            "cp %s/scripts/boot.sh %s" % (self.libdir, self.temp["work"] + "/initramfs-bin-dropbear-temp/root"),
            self.verbose,
        )
        process("chmod +x %s" % self.temp["work"] + "/initramfs-bin-dropbear-temp/root/boot.sh", self.verbose)

        os.chdir(self.temp["work"] + "/initramfs-bin-dropbear-temp/dev")
        process("mknod urandom c 1 9", self.verbose)
        process("mknod ptmx c 5 2", self.verbose)
        process("mknod tty c 5 0", self.verbose)
        process("chmod 0666 urandom", self.verbose)
        process("chmod 0666 ptmx", self.verbose)
        process("chmod 0666 tty", self.verbose)

        # create keys
        process("mkdir -p %s/initramfs-bin-dropbear-temp/etc/dropbear" % self.temp["work"], self.verbose)
        print(green(" * ") + "... creating dss key")
        process(
            "%s/initramfs-bin-dropbear-temp/bin/dropbearkey -t dss -f %s/initramfs-bin-dropbear-temp/etc/dropbear/dropbear_dss_host_key"
            % (self.temp["work"], self.temp["work"]),
            self.verbose,
        )
        print(green(" * ") + "... creating rsa key")
        process(
            "%s/initramfs-bin-dropbear-temp/bin/dropbearkey -t rsa -s 4096 -f %s/initramfs-bin-dropbear-temp/etc/dropbear/dropbear_rsa_host_key"
            % (self.temp["work"], self.temp["work"]),
            self.verbose,
        )

        os.chdir(self.temp["work"] + "/initramfs-bin-dropbear-temp")

        return os.system("find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio" % self.temp["cache"])
Beispiel #11
0
def print_usage_kernel(cli, master_conf, kernel_conf):
    print 'Parameter:\t\t     Config value:\tDescription:'
    print
    print  'Kernel:'
    print '  --dotconfig=/file          "'+kernel_conf['dotconfig']+'"',
    print '\t\tCustom kernel .config file'

    print '  --initramfs=/file          "'+kernel_conf['initramfs']+'"',
    print '\t\tEmbed initramfs into the kernel'

    if kernel_conf['fixdotconfig'] != '':
        if len(kernel_conf['fixdotconfig']) <= 4:
            tab = '\t\t'
        elif len(kernel_conf['fixdotconfig']) > 4:
            tab = '\t'
    else:
        tab = '\t\t'
    print yellow('  --fixdotconfig=<feature>  '),
    print '"'+kernel_conf['fixdotconfig']+'"',
    print yellow(tab+'Check and auto fix the kernel config file (experimental)')

    print '  --clean                   ',
    print kernel_conf['clean'],
    print '\t\tClean precompiled objects only'

    print '  --mrproper                ',
    print kernel_conf['mrproper'],
    print '\t\tClean precompiled objects and remove config file'

    print '  --menuconfig              ',
    print kernel_conf['menuconfig'],
    print '\t\tInteractive kernel options menu'

    print '  --fakeroot=/dir            "'+cli['fakeroot']+'"\t\tAppend modules to /dir/lib/modules'

    print '  --nooldconfig             ',
    print kernel_conf['nooldconfig'],
    print '\t\tDo not ask for new kernel/initramfs options'

    print '  --nomodinstall            ',
    print kernel_conf['nomodinstall'],
    print '\t\tDo not install modules'
    print
    print 'Misc:'
    print '  --nosaveconfig            ',
    print kernel_conf['nosaveconfig'],
    print '\t\tDo not save kernel config in /etc/kernels'

    print '  --noboot                  ',
    print kernel_conf['noboot'],
    print '\t\tDo not copy kernel to /boot'

    print '  --rename=/file             "'+kernel_conf['rename']+'"',
    print '\t\tCustom kernel file name'

    print '  --logfile=/file            "'+master_conf['logfile']+'"',
    print #'\t\tLog to file'

    print '  --debug, -d                '+master_conf['debug']+'\t\tDebug verbose'
    print
    print 'Handy tools:'
    print '  --getdotconfig=/vmlinux    "'+cli['getdotconfig']+'"\t\t\tExtract .config from compiled binary kernel (if IKCONFIG has been set)'
Beispiel #12
0
def print_usage_initramfs(cli, initramfs_conf, modules_conf):
    print 'Parameter:\t\t     Config value:\tDescription:'
    print
    print 'Linuxrc:'
    print '  --linuxrc=/linuxrc[,/file] "'+initramfs_conf['linuxrc']+'"',
    print '\t\tInclude custom linuxrc (files copied over to etc)'
    print
    print 'Busybox:'
    print '  --dotconfig=/file          "'+initramfs_conf['dotconfig']+'"',
    print '\t\tCustom busybox config file'

    print '  --defconfig               ',
    print initramfs_conf['defconfig'], # bool
    print '\t\tSet .config to largest generic options'

    print '  --oldconfig               ',
    print initramfs_conf['oldconfig'], # bool
    print '\t\tAsk for new busybox options if any'

    print '  --menuconfig              ',
    print initramfs_conf['menuconfig'], # bool
    print '\t\tInteractive busybox options menu'
    print
#    # fix \t display depending on length of cli[splash']
#    if cli['splash'] != '':
#        if len(cli['splash']) <= 4:
#            tab = '\t\t'
#        elif len(cli['splash']) > 4 and len(cli['splash']) < 8:
#            tab = '\t'
#        elif len(cli['splash']) > 8:
#            tab = '\t\t'
#    else:
#        tab = '\t\t'
    print 'Features:'
#    print '  --splash=<theme>           "'+initramfs_conf['splash']+'"',
    print '  --splash=<theme>           "'+cli['splash']+'"',
    print '\t\tInclude splash support (splashutils must be merged)'

    print '   --sres=YxZ[,YxZ]          "'+initramfs_conf['sres']+'"',
    print '\t\t Splash resolution, all if not set'

    print '  --disklabel               ',
    print initramfs_conf['disklabel'], # bool
    print '\t\tInclude support for UUID/LABEL (host binary or sources)'

    print '  --luks                    ',
    print initramfs_conf['luks'], # bool 
    print '\t\tInclude LUKS support (host binary or sources)'

    print '  --lvm2                    ',
    print initramfs_conf['lvm2'], # bool
    print '\t\tInclude LVM2 support (host binary or sources)'

    print yellow('  --evms                    '),
    print initramfs_conf['evms'], # bool
    print yellow('\t\tInclude EVMS support (host binary only)')

    print yellow('  --dmraid                  '),
    print initramfs_conf['dmraid'], # bool
    print yellow('\t\tInclude DMRAID support (host binary or sources)')

#    print yellow('   --selinux                '),
#    print initramfs_conf['selinux'], # bool
#    print yellow('\t\t Include selinux support in --dmraid (selinux libs required)')

#   print '  --iscsi                    False                   Include iscsi support'
#   print '  --mdadm                    False                   Include mdadm support (mdadm must be merged)'

    print '  --dropbear                ',
    print initramfs_conf['dropbear'], # bool
    print '\t\tInclude dropbear tools and daemon (host binary or sources)'

    print '   --debugflag              ',
    print initramfs_conf['debugflag'], # bool
    print '\t\t Compile dropbear with #define DEBUG_TRACE in debug.h'

    # fix \t display depending on length of cli['rootpasswd']
    if cli['rootpasswd'] != '':
        if len(cli['rootpasswd']) <= 4:
            tab = '\t\t'
        elif len(cli['rootpasswd']) > 4:
            tab = '\t'
    else:
        tab = '\t\t'
    print '  --rootpasswd=<passwd>      "'+cli['rootpasswd']+'"',
    print tab+'Create and set root password (required for dropbear)'

#   print '  --unionfs-fuse             False                   Include unionfs-fuse support'
#   print '  --aufs                     False                   Include aufs support'
#   print '  --firmware=/dir            ""                      Include custom firmware support'

    print '  --keymaps                 ',
    print initramfs_conf['keymaps'], # bool
    print '\t\tInclude all keymaps'

    print '  --ttyecho                 ',
    print initramfs_conf['ttyecho'], # bool
    print '\t\tInclude the handy ttyecho.c tool'

    print '  --strace                  ',
    print initramfs_conf['strace'], # bool
    print '\t\tInclude the strace binary tool (host binary or sources)'

    print '  --screen                  ',
    print initramfs_conf['screen'], # bool
    print '\t\tInclude the screen binary tool (host binary or sources)'

    # fix \t display depending on length of cli['plugin']
    if cli['plugin'] != '': 
        if len(cli['plugin']) <= 4:
            tab = '\t\t'
        elif len(cli['plugin']) > 4:
            tab = '\t'
    else: 
        tab = '\t\t'
    print '  --plugin=/dir[,/dir]       "'+cli['plugin']+'"',
    print tab+'Include list of user generated custom roots'
    print

    print 'Libraries: (host only)'
    print '  --glibc                   ',
    print initramfs_conf['glibc'], # bool
    print '\t\tInclude host GNU C libraries (required for dns,dropbear)'

    print '  --libncurses              ',
    print initramfs_conf['libncurses'], # bool
    print '\t\tInclude host libncurses (required for dropbear)'

    print '  --zlib                    ',
    print initramfs_conf['zlib'], # bool
    print '\t\tInclude host zlib (required for dropbear)'
    print
    print 'Misc:'
    print '  --nocache                 ',
    print initramfs_conf['nocache'],
    print '\t\tDelete previous cached data on startup'

    print yellow('  --hostbin                 '),
    print initramfs_conf['hostbin'],
    print yellow('\t\tUse host binaries (fall back to sources if dynamic linkage detected)')

    print '  --noboot                  ',
    print initramfs_conf['noboot'],
    print '\t\tDo not copy initramfs to /boot'

    print '  --rename=/file             "'+initramfs_conf['rename']+'"',
    print '\t\tCustom initramfs file name'

    print '  --logfile=/file            "'+master_conf['logfile']+'"',
    print #'\t\tLog to file'

    print '  --debug, -d                '+master_conf['debug']+'',
    print '\t\tDebug verbose'
    print
    print 'Handy tools:'
    print '  --extract=/file            "'+cli['extract']+'"                 Extract initramfs file'
    print '   --to=/dir                 "'+cli['to']+'"'
    print '\t\t\t\t\t\t Custom extracting directory'

    print '  --compress=/dir            "'+cli['compress']+'"                 Compress directory into initramfs'
    print '   --into=/file              "'+cli['into']+'"'
    print '\t\t\t\t\t\t Custom initramfs file'
Beispiel #13
0
def print_usage_kernel(cli, master_conf, kernel_conf):
    print('Parameter:\t\t    Config value:\tDescription:')
    print()
    print('--execute, -x\t\t\t\t\tExecute')
    print()
    print('Kernel:')
    print('  --dotconfig=/file         "'+kernel_conf['dotconfig']+'"', end='')
    print('\t\t\tCustom kernel .config file')

    print('  --initramfs=/file         "'+kernel_conf['initramfs']+'"', end='')
    print('\t\t\tEmbed initramfs into the kernel')

    if kernel_conf['fixdotconfig'] != '':
        if len(kernel_conf['fixdotconfig']) <= 4:
            tab = '\t\t\t'
        elif len(kernel_conf['fixdotconfig']) > 4 and len(kernel_conf['fixdotconfig']) < 7:
            tab = '\t\t\t'
        elif len(kernel_conf['fixdotconfig']) > 7 and len(kernel_conf['fixdotconfig']) < 12:
            tab = '\t\t'
        elif len(kernel_conf['fixdotconfig']) > 12:
            tab = ''
    else:
        tab = '\t\t\t'
    print(stdout.yellow('  --fixdotconfig=<feature>  '), end='"')
    print(kernel_conf['fixdotconfig'], end='"')
    print(tab+'Check and auto fix the kernel config file (experimental)')
    print('\t\t\t\t\t\t initramfs,selinux,pax supported (writes to .config)')
    print('  --clean                   ', end='')
    print(kernel_conf['clean'], end='')
    print('\t\tClean precompiled objects only')
    print('  --mrproper                ', end='')
    print(kernel_conf['mrproper'], end='')
    print('\t\tClean precompiled objects and remove config file')
    print('  --localmodconfig          ', end='')
    print(kernel_conf['localmodconfig'], end='')
    print('\t\tUpdate current config disabling modules not loaded')
    print('  --localyesconfig          ', end='')
    print(kernel_conf['localyesconfig'], end='')
    print('\t\tUpdate current config converting local mods to core')
    print('  --silentoldconfig         ', end='')
    print(kernel_conf['silentoldconfig'], end='')
    print('\t\tSame as oldconfig, but quietly, additionally update deps')
    print('  --defconfig               ', end='')
    print(kernel_conf['defconfig'], end='')
    print('\t\tNew config with default from ARCH supplied defconfig')
    print('  --menuconfig              ', end='')
    print(kernel_conf['menuconfig'], end='')
    print('\t\tInteractive kernel options menu')
    print('  --fakeroot=/dir           "'+cli['fakeroot']+'"\t\t\tAppend modules to /dir/lib/modules')
    print('  --module-rebuild          ', end='')
    print(kernel_conf['module-rebuild'], end='')
    print('\t\tCall sys-kernel/module-rebuild last')
    print('  --nooldconfig             ', end='')
    print(kernel_conf['nooldconfig'], end='')
    print('\t\tDo not ask for new kernel/initramfs options')
    print('  --nomodinstall            ', end='')
    print(kernel_conf['nomodinstall'], end='')
    print('\t\tDo not install modules')
    print('  --nomodules               ', end='')
    print(kernel_conf['nomodules'], end='')
    print('\t\tDo not compile or install modules')
    print()
    print('Misc:')
    print('  --nosaveconfig            ', end='')
    print(kernel_conf['nosaveconfig'], end='')
    print('\t\tDo not save kernel config in /etc/kernels')
    print('  --noboot                  ', end='')
    print(kernel_conf['noboot'], end='')
    print('\t\tDo not copy kernel to /boot')
    print('  --rename=/file            "'+kernel_conf['rename']+'"', end='')
    print('\t\t\tCustom kernel file name')
    print('  --logfile=/file           "'+master_conf['logfile']+'"', end='')
    print() #'\t\tLog to file'
    print('  --debug, -d               '+master_conf['debug']+'\t\tDebug verbose')
Beispiel #14
0
def print_usage_initramfs(cli, master_conf, initramfs_conf, modules_conf):
    print('Parameter:\t\t    Config value:\tDescription:')
    print()
    print('--execute, -x\t\t\t\t\tExecute')
    print()
    print('Features:')
    print('+ from source code')
    print('| --source-luks             ', end='')
    print(initramfs_conf['source-luks'], end='') # bool
    print('\t\tInclude LUKS support from sources')
    print('| --source-lvm2             ', end='')
    print(initramfs_conf['source-lvm2'], end='') # bool
    print('\t\tInclude LVM2 support from sources')
    print(stdout.red('| --source-dropbear         '), end='')
    print(initramfs_conf['source-dropbear'], end='') # bool
    print('\t\tInclude dropbear support from sources')
    print('|  --debugflag              ', end='')
    print(initramfs_conf['debugflag'], end='') # bool
    print('\t\t Compile dropbear with #define DEBUG_TRACE in debug.h')
    print('| --source-screen           ', end='')
    print(initramfs_conf['source-screen'], end='') # bool
    print('\t\tInclude the screen binary tool from sources')
    print('| --source-disklabel        ', end='')
    print(initramfs_conf['source-disklabel'], end='') # bool
    print('\t\tInclude support for UUID/LABEL from sources')
    print('| --source-ttyecho          ', end='')
    print(initramfs_conf['source-ttyecho'], end='') # bool
    print('\t\tCompile and include the handy ttyecho.c tool')
    print('| --source-strace           ', end='')
    print(initramfs_conf['source-strace'], end='') # bool
    print('\t\tCompile and include the strace binary tool from sources')
    print('| --source-dmraid           ', end='')
    print(initramfs_conf['source-dmraid'], end='') # bool
    print('\t\tInclude DMRAID support from sources')
#    print('| --source-all              ', end='')
#    print(initramfs_conf['source-all'], end='') # bool
#    print('\t\tInclude all possible features from sources')

    print('+ from host binaries')
    print('| --host-busybox            ', end='')
    print(initramfs_conf['bin-busybox'], end='') # bool
    print('\t\tInclude busybox support from host')
    print('| --host-luks               ', end='')
    print(initramfs_conf['bin-luks'], end='') # bool
    print('\t\tInclude LUKS support from host')
    print('| --host-lvm2               ', end='')
    print(initramfs_conf['bin-lvm2'], end='') # bool
    print('\t\tInclude LVM2 support from host')
    print('| --host-dropbear           ', end='')
    print(initramfs_conf['bin-dropbear'], end='') # bool
    print('\t\tInclude dropbear support from host')
    print('| --host-screen             ', end='')
    print(initramfs_conf['bin-screen'], end='') # bool
    print('\t\tInclude the screen binary tool from host')
    print('| --host-disklabel          ', end='')
    print(initramfs_conf['bin-disklabel'], end='') # bool
    print('\t\tInclude support for UUID/LABEL from host')
    print('| --host-strace             ', end='')
    print(initramfs_conf['bin-strace'], end='') # bool
    print('\t\tInclude the strace binary tool from host')
#    print('| --host-evms               ', end='')
#    print(initramfs_conf['bin-evms'], end='') # bool
#    print('\t\tInclude the evms binary tool from host')
    print('| --host-glibc              ', end='')
    print(initramfs_conf['bin-glibc'], end='') # bool
    print('\t\tInclude host GNU C libraries (required for dns,dropbear)')
    print('| --host-libncurses         ', end='')
    print(initramfs_conf['bin-libncurses'], end='') # bool
    print('\t\tInclude host libncurses (required for dropbear)')
    print('| --host-zlib               ', end='')
    print(initramfs_conf['bin-zlib'], end='') # bool
    print('\t\tInclude host zlib (required for dropbear)')
    print('| --host-dmraid             ', end='')
    print(initramfs_conf['bin-dmraid'], end='') # bool
    print('\t\tInclude DMRAID support from host')
#    print('| --host-all                ', end='')
#    print(initramfs_conf['bin-all'], end='') # bool
#    print('\t\tInclude all possible features from host')
    print()

    print(stdout.yellow('  --dynlibs                 '), end='')
    print(initramfs_conf['dynlibs'], end='') # bool
    print('\t\tInclude detected libraries from dynamically linked binaries')

    # fix \t display depending on length of cli[splash']
    if cli['splash'] != '':
        if len(cli['splash']) <= 4:
            tab = '\t\t\t'
        elif len(cli['splash']) > 4 and len(cli['splash']) < 8:
            tab = '\t\t'
        elif len(cli['splash']) > 8:
            tab = '\t\t'
    else:
        tab = '\t\t\t'
#    print('  --splash=<theme>          "'+initramfs_conf['splash'], end='"')
#    print(tab+'Include splash support (splashutils must be merged)')
#    print('   --sres=YxZ[,YxZ]         "'+initramfs_conf['sres'], end='"')
#    print('\t\t\t Splash resolution, all if not set')

    # fix \t display depending on length of cli['ply']
    if cli['plymouth'] != '':
        if len(cli['plymouth']) <= 4:
            tab = '\t\t\t'
        elif len(cli['plymouth']) > 4 and len(cli['plymouth']) < 8:
            tab = '\t\t'
        elif len(cli['plymouth']) > 8:
            tab = '\t\t'
    else:
        tab = '\t\t\t'
    print('  --plymouth=<theme>          "'+initramfs_conf['plymouth'], end='"')
    print(tab+'Include plymouth support (plymouth must be merged)')
#    print('   --sres=YxZ[,YxZ]         "'+initramfs_conf['sres'], end='"')
#    print('\t\t\t Plymouth resolution, all if not set')

    # fix \t display depending on length of cli['rootpasswd']
    if cli['rootpasswd'] != '':
        if len(cli['rootpasswd']) <= 4:
            tab = '\t\t'
        elif len(cli['rootpasswd']) > 4:
            tab = '\t\t'
    else:
        tab = '\t\t\t'
    print('  --rootpasswd=<passwd>     "'+cli['rootpasswd'], end='"')
    print(tab+'Create and set root password (required for dropbear)')
    print('  --hostsshkeys             ', end='')
    print(initramfs_conf['hostsshkeys'], end='') # bool
    print('\t\tInclude the OpenSSHd keys from host (used with dropbear)')
    print('  --ssh-pubkeys             ', end='')
    print(initramfs_conf['ssh-pubkeys'], end='') # bool
    print('\t\tInclude the SSH public keys (used with dropbear)')
    print('  --ssh-pubkeys-file        ', end='')
    print(initramfs_conf['ssh-pubkeys-file'], end='') # bool
    print('\n\t\t\t\t\t\tSource file with SSH public keys (used with dropbear)')
    if cli['keymaps'] != '':
        if len(cli['keymaps']) <= 4:
            tab = '\t\t\t'
        elif len(cli['keymaps']) > 4 and len(cli['keymaps']) < 8:
            tab = '\t\t'
        elif len(cli['keymaps']) > 8:
            tab = '\t'
    else:
        tab = '\t\t\t'
    print('  --keymaps=xx[,xx]|all     ', end='"')
    print(initramfs_conf['keymaps'], end='"') # bool
    print(tab+'Include all keymaps')
    # fix \t display depending on length of cli['plugin']
    if cli['plugin'] != '':
        if len(cli['plugin']) <= 4:
            tab = '\t\t\t'
        elif len(cli['plugin']) > 4:
            tab = '\t'
    else:
        tab = '\t\t\t'
    print('  --plugin=/dir[,/dir]      "'+cli['plugin']+'"', end='')
    print(tab+'Include list of user generated custom roots')
    print()

# NOFIX this works but force user to use --plugin= instead
#    print('Linuxrc:')
#    print('  --linuxrc=/linuxrc[,/file]"'+initramfs_conf['linuxrc']+'"', end='')
#    print('\t\t\tInclude custom linuxrc (files copied over to etc)')
#    print()

    print('Busybox:')
    print('  --dotconfig=/file         "'+initramfs_conf['dotconfig']+'"', end='')
    print('\t\t\tCustom busybox config file')
    print('  --defconfig               ', end='')
    print(initramfs_conf['defconfig'], end='') # bool
    print('\t\tSet .config to largest generic options')
    print('  --oldconfig               ', end='')
    print(initramfs_conf['oldconfig'], end='') # bool
    print('\t\tAsk for new busybox options if any')
    print('  --menuconfig              ', end='')
    print(initramfs_conf['menuconfig'], end='') # bool
    print('\t\tInteractive busybox options menu')
    print()

    print('Misc:')
    print('  --nocache                 ', end='')
    print(initramfs_conf['nocache'], end='')
    print('\t\tDelete previous cached data on startup')
    print('  --nomodules               ', end='')
    print(initramfs_conf['nomodules'], end='')
    print('\t\tDo not install kernel modules (all is kernel builtin)')
    print('  --noboot                  ', end='')
    print(initramfs_conf['noboot'], end='')
    print('\t\tDo not copy initramfs to /boot')
    print('  --rename=/file            "'+initramfs_conf['rename']+'"', end='')
    print('\t\t\tCustom initramfs file name')
    print('  --logfile=/file           "'+master_conf['logfile']+'"', end='')
    print() #'\t\tLog to file'
    print('  --debug, -d               '+master_conf['debug']+'', end='')
    print('\t\tDebug verbose')
Beispiel #15
0
    def build(self):
        """
        Busybox build sequence command

        @return         bool
        """
        zero = int("0")

        if os.path.isfile("%s/busybox-%s.tar.bz2" % (get_distdir(self.temp), str(self.bb_version))) is not True:
            print(green(" * ") + "... busybox.download")
            if self.download() is not zero:
                process("rm -v %s/busybox-%s.tar.bz2" % (get_distdir(self.temp), str(self.bb_version)), self.verbose)
                self.fail("download")

        print(green(" * ") + "... busybox.extract")
        if self.extract() is not zero:
            self.fail("extract")

        print(green(" * ") + "... busybox.copy_config " + self.dotconfig)
        if self.copy_config() is not zero:
            self.fail("copy_config")

        # compare bb .config version and the one from version.conf
        # if no match call oldconfig
        head = []
        nlines = 0
        for line in open(self.bb_tmp + "/.config"):
            line = line.replace(" ", "")
            head.append(line.rstrip())
            nlines += 1
            if nlines >= 3:
                break
        lhead = head.pop()
        version = lhead.rsplit(":")
        version = version.pop()
        if version != self.bb_version:
            print(yellow(" * busybox .config version doesnt match the sources version, calling --oldconfig"))
            self.oldconfig = True

        if self.defconfig is True:
            print(green(" * ") + "... busybox.defconfig")
            if self.make_defconfig() is not zero:
                self.fail("defconfig")

        if self.oldconfig is True:
            print(green(" * ") + "... busybox.oldconfig")
            if self.make_oldconfig() is not zero:
                self.fail("oldconfig")

        if self.menuconfig is True:
            print(green(" * ") + "... busybox.menuconfig")
            if self.make_menuconfig() is not zero:
                self.fail("menuconfig")

        print(green(" * ") + "... busybox.make")
        if self.make() is not zero:
            self.fail("make")

        print(green(" * ") + "... busybox.strip")
        if self.strip() is not zero:
            self.fail("stip")

        print(green(" * ") + "... busybox.compress")
        if self.compress() is not zero:
            self.fail("compress")

        print(green(" * ") + "... busybox.cache")
        if self.cache() is not zero:
            self.fail("cache")
Beispiel #16
0
    def build(self):
        """
        Append dropbear support to the initramfs

        @return: bool
        """
        logging.debug('>>> entering initramfs.append.host.dropbear')
        for i in ['bin', 'sbin', 'dev', 'usr/bin', 'usr/sbin', 'lib', 'etc', 'var/log', 'var/run', 'root']:
            process('mkdir -p %s/%s' % (self.temp['work']+'/initramfs-bin-dropbear-temp/', i), self.verbose)

        dropbear_sbin       = '/usr/sbin/dropbear'

        dbscp_bin           = '/usr/bin/dbscp'  # FIXME assumes host version is patched w/ scp->dbscp because of openssh.
                                                # FIXME compilation of dropbear sources are not patched hence
                                                # FIXME if --dropbear --hostbin
                                                # FIXME then /usr/bin/scp
                                                # FIXME else /usr/bin/dbscp
        dbclient_bin        = '/usr/bin/dbclient'
        dropbearkey_bin     = '/usr/bin/dropbearkey'
        dropbearconvert_bin = '/usr/bin/dropbearconvert'

        process('cp %s %s/initramfs-bin-dropbear-temp/bin'                  % (dbscp_bin, self.temp['work']), self.verbose)
        process('cp %s %s/initramfs-bin-dropbear-temp/bin'                  % (dbclient_bin, self.temp['work']), self.verbose)
        process('cp %s %s/initramfs-bin-dropbear-temp/bin'                  % (dropbearkey_bin, self.temp['work']), self.verbose)
        process('cp %s %s/initramfs-bin-dropbear-temp/bin'                  % (dropbearconvert_bin, self.temp['work']), self.verbose)
        process('cp %s %s/initramfs-bin-dropbear-temp/sbin'                 % (dropbear_sbin, self.temp['work']), self.verbose)
        process('chmod +x %s/initramfs-bin-dropbear-temp/bin/dbscp'         % self.temp['work'], self.verbose)
        process('chmod +x %s/initramfs-bin-dropbear-temp/bin/dbclient'      % self.temp['work'], self.verbose)
        process('chmod +x %s/initramfs-bin-dropbear-temp/bin/dropbearkey'   % self.temp['work'], self.verbose)
        process('chmod +x %s/initramfs-bin-dropbear-temp/bin/dropbearconvert' % self.temp['work'], self.verbose)
        process('chmod +x %s/initramfs-bin-dropbear-temp/sbin/dropbear'     % self.temp['work'], self.verbose)

# FIXME check if dropbearkey dropbearconvert dbclient dbscp static too? NO ldd says they all use the same as /usr/sbin/dropbear
        if not isstatic(dropbear_sbin, self.verbose) and self.cli['dynlibs'] is True:
            dropbear_libs = listdynamiclibs(dropbear_sbin, self.verbose)
            process('mkdir -p %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/lib', self.verbose)
            print(yellow(' * ') + '... ' + yellow('warning')+': '+dropbear_sbin+' is dynamically linked, copying detected libraries')
            for i in dropbear_libs:
                print(green(' * ') + '... ' + i)
                process('cp %s %s' % (i, self.temp['work']+'/initramfs-bin-dropbear-temp/lib'), self.verbose)
        else:
            logging.debug('dropbear is static nothing to do')

        process('cp /etc/localtime %s'          % self.temp['work']+'/initramfs-bin-dropbear-temp/etc', self.verbose)
        process('cp /etc/nsswitch.conf %s'      % self.temp['work']+'/initramfs-bin-dropbear-temp/etc', self.verbose)
        process('cp /etc/hosts %s'              % self.temp['work']+'/initramfs-bin-dropbear-temp/etc', self.verbose)
        process('touch %s'                      % self.temp['work']+'/initramfs-bin-dropbear-temp/var/log/lastlog', self.verbose)
        process('touch %s'                      % self.temp['work']+'/initramfs-bin-dropbear-temp/var/log/wtmp', self.verbose)
        process('touch %s'                      % self.temp['work']+'/initramfs-bin-dropbear-temp/var/run/utmp', self.verbose)

        # ship the boot* scripts too
#        process('cp %s/scripts/boot-luks-lvm.sh %s' % (self.libdir, self.temp['work']+'/initramfs-bin-dropbear-temp/root'), self.verbose)
#        process('chmod +x %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/root/boot-luks-lvm.sh', self.verbose)
#        process('cp %s/scripts/boot-luks.sh %s' % (self.libdir, self.temp['work']+'/initramfs-bin-dropbear-temp/root'), self.verbose)
#        process('chmod +x %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/root/boot-luks.sh', self.verbose)
        process('cp %s/scripts/boot.sh %s' % (self.libdir, self.temp['work']+'/initramfs-bin-dropbear-temp/root'), self.verbose)
        process('chmod +x %s' % self.temp['work']+'/initramfs-bin-dropbear-temp/root/boot.sh', self.verbose)

        os.chdir(self.temp['work']+'/initramfs-bin-dropbear-temp/dev')
        process('mknod urandom c 1 9', self.verbose)
        process('mknod ptmx c 5 2', self.verbose)
        process('mknod tty c 5 0', self.verbose)
        process('chmod 0666 urandom', self.verbose)
        process('chmod 0666 ptmx', self.verbose)
        process('chmod 0666 tty', self.verbose)

        # create keys
        process('mkdir -p %s/initramfs-bin-dropbear-temp/etc/dropbear' % self.temp['work'], self.verbose)
        print(green(' * ') + '... creating dss key')
        process('%s/initramfs-bin-dropbear-temp/bin/dropbearkey -t dss -f %s/initramfs-bin-dropbear-temp/etc/dropbear/dropbear_dss_host_key' % (self.temp['work'], self.temp['work']), self.verbose)
        print(green(' * ') + '... creating rsa key')
        process('%s/initramfs-bin-dropbear-temp/bin/dropbearkey -t rsa -s 4096 -f %s/initramfs-bin-dropbear-temp/etc/dropbear/dropbear_rsa_host_key' % (self.temp['work'], self.temp['work']), self.verbose)

        os.chdir(self.temp['work']+'/initramfs-bin-dropbear-temp')

        return os.system('find . -print | cpio --quiet -o -H newc --append -F %s/initramfs-cpio' % self.temp['cache'])