Beispiel #1
0
def ConfigureSerialPortOutput():
    # https://wiki.archlinux.org/index.php/working_with_the_serial_console
    # Try this: http://wiki.alpinelinux.org/wiki/Enable_Serial_Console_on_Boot
    utils.LogStep('Configure Serial Port Output')

    utils.Sed('/boot/syslinux/syslinux.cfg', '/DEFAULT/aserial 0 38400')
    utils.ReplaceLine('/boot/syslinux/syslinux.cfg', 'TIMEOUT', 'TIMEOUT 1')
Beispiel #2
0
def InstallBootloader(device, uuid, debugmode):
    utils.LogStep('Install Syslinux bootloader')
    '''
  utils.Run(['syslinux-install_update', '-i', '-a', '-m'])
  '''
    utils.Run(['blkid', '-s', 'PTTYPE', '-o', 'value', device])
    utils.CreateDirectory('/boot/syslinux')
    utils.CopyFiles('/usr/lib/syslinux/bios/*.c32', '/boot/syslinux/')
    utils.Run(['extlinux', '--install', '/boot/syslinux'])
    utils.Replace('/boot/syslinux/syslinux.cfg', 'sda3', 'sda1')
    utils.Run(['fdisk', '-l', device])
    utils.Run([
        'dd', 'bs=440', 'count=1', 'conv=notrunc',
        'if=/usr/lib/syslinux/bios/mbr.bin',
        'of=%s' % device
    ])

    boot_params = [
        'console=ttyS0,38400',
        'CONFIG_KVM_GUEST=y',
        'CONFIG_KVM_CLOCK=y',
        'CONFIG_VIRTIO_PCI=y',
        'CONFIG_SCSI_VIRTIO=y',
        'CONFIG_VIRTIO_NET=y',
        'CONFIG_STRICT_DEVMEM=y',
        'CONFIG_DEVKMEM=n',
        'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536',
        'CONFIG_DEBUG_RODATA=y',
        'CONFIG_DEBUG_SET_MODULE_RONX=y',
        'CONFIG_CC_STACKPROTECTOR=y',
        'CONFIG_COMPAT_VDSO=n',
        'CONFIG_COMPAT_BRK=n',
        'CONFIG_X86_PAE=y',
        'CONFIG_SYN_COOKIES=y',
        'CONFIG_SECURITY_YAMA=y',
        'CONFIG_SECURITY_YAMA_STACKED=y',
    ]
    if debugmode:
        boot_params += [
            'systemd.log_level=debug',
            'systemd.log_target=console',
            'systemd.journald.forward_to_syslog=yes',
            'systemd.journald.forward_to_kmsg=yes',
            'systemd.journald.forward_to_console=yes',
        ]
    boot_params = ' '.join(boot_params)
    boot_spec = '    APPEND root=UUID=%s rw append %s' % (uuid, boot_params)
    utils.ReplaceLine('/boot/syslinux/syslinux.cfg', 'APPEND root=', boot_spec)
def PrepareBootstrap(workspace_dir, mirror_server, use_pacman_keys):
    utils.LogStep('Setting up Bootstrap Environment')
    arch_root = os.path.join(workspace_dir, os.listdir(workspace_dir)[0])
    mirrorlist = 'Server = {MIRROR_SERVER}'.format(MIRROR_SERVER=mirror_server)
    utils.AppendFile(os.path.join(arch_root, 'etc/pacman.d/mirrorlist'),
                     mirrorlist)
    utils.CreateDirectory(os.path.join(arch_root, 'run/shm'))
    if use_pacman_keys:
        utils.RunChroot(arch_root, 'pacman-key --init')
        utils.RunChroot(arch_root, 'pacman-key --populate archlinux')
    else:
        utils.ReplaceLine(os.path.join(arch_root, 'etc/pacman.conf'),
                          'SigLevel', 'SigLevel = Never')
    # Install the most basic utilities for the bootstrapper.
    utils.RunChroot(arch_root, 'pacman --noconfirm -Sy python3 sed')

    return arch_root
Beispiel #4
0
def PatchGoogleSystemdService(file_path):
    utils.ReplaceLine(file_path, 'After=network.target',
                      'After=network-online.target')
    utils.ReplaceLine(file_path, 'Requires=network.target',
                      'Requires=network-online.target')