2

I have an embedded system based on the Intel-Atom with PCH which we are busy developing. In the embedded environment I have:

  • A Serial console through the PCH which means this doesn't work with the standard kernel. (as CONFIG_SERIAL_PCH_UART_CONSOLE is required)
  • The SATA drive is only available in the embedded environment and can't be taken out for install.
  • I can boot via USB drive.
  • The system does have ethernet via the PCH which I have not yet confirmed to work.

I have managed to build a custom Linux 3.16.7 kernel that can be booted with console=uartPCH0,115200 and then displays a console on the serial line.

However, to move from here to an actual installation seems to be problematic. I am unable to convince debian-installer to be built using my custom kernel.

My current theory is a double bootstrap process where I first bootstrap an installation into a usb-drive and then boot that and then bootstrap an installation into the SATA drive on the system? Any better suggestions?

I'm not sure if there is some way to install via a network console?

The system requires the e1000e driver which I assume will be built into the standard debian installer ISO's, however so far I was unable to find very clear documentation on how to convince the install system to boot and then open up ssh/telnet.

Any hint ?

  • Indeed you can bootstrap Debian manually without installer, but it would become much easier if you could boot off a sophistcated live distro like Debian Live, PartedMagic, etc. Does it lack any video ouput capability, even VT console on VGA text mode or framebuffer? Non-standard PCH serial port is the only possible way to get console? – yaegashi Jul 23 '15 at 2:07
  • Yes my only options for terminal would be PCH serial port (EG20T) and/or via ethernet (e1000e). – Heinrich du Toit Jul 23 '15 at 5:45
5

I managed to solve my problem with debootstrap, here is a quick run-down of the process I followed.

  1. unmount usb
  2. Partition the USB (4GB)

    Zap out GPT with gdisk, as my board didn't want to boot GPT.
    Created just one linux partition, nothing else.
    I had lots of problems getting a usb drive bootable on my embedded system.        
    
  3. mkfs.ext4 /dev/sdb1

  4. mount /dev/sdb1 /media/usb
  5. debootstrap jessie /media/usb http://my.mirror/debian

    I highly recommend setting up something like apt-cacher
    
  6. chroot /media/usb

    Mount all these: 
    mount -t devtmpfs dev /dev
    mount -t devpts devpts /dev/pts
    mount -t proc proc /proc
    mount -t sysfs sysfs /sys
    
  7. Edit /etc/fstab : (I use nano for editing normally)

    proc /proc proc defaults 0 0
    sysfs /sys sysfs defaults 0 0
    UUID=xxxx / ext4 errors=remount-ro 0 1
    
    to write UUID into file use: blkid -o value -s UUID /dev/sdb1 >> /etc/fstab
    
  8. house-keeping:

    apt-get install locales
    dpkg-reconfigure locales
    apt-get install console-setup
    dpkg-reconfigure keyboard-configuration (optional?)
    apt-get install console-data
    passwd root
    adduser linuxuser
    
  9. Install grub and kernel

    apt-get install grub-pc
    I installed grub into both /dev/sdb and /dev/sdb1 but you can use install-mbr for /dev/sdb I think
    apt-get install linux-image-686-pae
    
  10. now edit /etc/default/grub:

    uncomment GRUB_TERMINAL=console
    add GRUB_GFXPAYLOAD_LINUX=text
    to GRUB_CMDLINE_LINUX_DEFAULT add: console=tty0 console=ttyPCH0,115200
    run upgrade-grub2 
    
  11. edit /etc/default/console-setup :

    CODESET="guess"
    FONTFACE=
    FONTSIZE=
    VIDEOMODE=
    
  12. create /etc/kernel-img.conf with this inside:

    image_dest = /
    do_symlinks = yes
    do_bootloader = yes
    do_bootfloppy = no
    do_initrd = yes
    link_in_boot = no
    
  13. Now install custom kernel with dpkg -i

    For me 2 options was important:
    CONFIG_SERIAL_PCH_UART=y
    CONFIG_SERIAL_PCH_UART_CONSOLE=y
    although I did highly customize the kernel after that.
    Currently I am compiling 3.14 with the rt-patch from linux-source-3.14 I downloaded out of wheezy-backports
    
  14. Other things to do before restarting (optional)

    edit /etc/modules to force drivers to load
    edit /etc/network/interfaces
    echo myHostName > /etc/hostname
    apt-get install telnetd
    apt-get install openssh-server
    

At this stage I could boot the usb on my target embedded system and repeat the whole process again to install debian on the SATA drive. Obviously I needed to install things like debootstrap on the usb drive first to facilitate this but that was minor.

2

You can activate the network console of the Debian Installer via preseeding. The Installation Guide actually contains the following example:

# Use the following settings if you wish to make use of the network-console
# component for remote installation over SSH. This only makes sense if you
# intend to perform the remainder of the installation manually.
#d-i anna/choose_modules string network-console
#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key
#d-i network-console/password password r00tme
#d-i network-console/password-again password r00tme

You have to uncomment the anna/choose_modules setting. If you want to login with your SSH key, make the public key accessible via some URL and uncomment the network-console/authorized_keys_url setting. If you want to use a password, uncomment the other two settings.

Of course, you also have to preseed all previous questions, because you have no interface to answer them before the network console is started up by the above settings. In a DHCP environment this means you'll also need something like

d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i keyboard-configuration/xkb-keymap select us

Instead of adding a preseed.cfg file to your initrd (which your bootloader may not support directly), you can supply all these settings on the kernel command line like

linux language=en country=US locale=en_US.UTF-8 keymap=us anna/choose_modules=network-console network-console/authorized_keys_url="http://..." initrd=initrd.gz

(see the list of abbreviations).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.