Launching the latest Linux kernel on Intel Edison

    For World ArduinoD15 Day, I have prepared material on the configuration and launch of the latest Linux kernel on the Intel Edison (Arduino Edition) board.

    Earlier, I wrote about how to ensure that the vanilla core is loaded on the Intel Galileo board, but now it’s the turn for Intel Edison.


    To date, there is no serial port driver in vanilla kernels, which practically makes working with the board impossible. Today, Greg KH, the tty subsystem maintainer, has approved the changes that bring Intel Edison High Speed ​​UART support to the kernel. In reality, in the main branch, changes will appear only in version v4.1-rc1.

    So let's get started. I want to immediately note that I will not re-describe some of the actions described in the article Launching the Vanilla Core on Intel Galileo. I also assume that you are using stock firmware based on Yocto.

    Preparing the kernel and file system


    First of all, we need a kernel that can be easily accessed from the linux-next repository of the tty subsystem repository (we will need a branch tty-next) :

    mkdir ~/devel
    cd ~/devel
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
    cd ~/devel/linux-next
    

    You need to make a few minimal changes to the default configuration, namely the arch / x86 / configs / i386_defconfig file . If for some reason you do not want to touch this file, we can easily copy it using the command cp arch/x86/configs/{i386,eds}_defconfig, and in this case use eds_defconfig where i386_defconfig is mentioned in the article .

    So it was (delete lines from the file):
    CONFIG_DRM_I915 = y

    Now (add lines to the file):
    # CONFIG_DRM_I915 is not set
    CONFIG_BACKLIGHT_LCD_SUPPORT = y
    CONFIG_USB_XHCI_HCD = y
    CONFIG_USB_DWC3 = y
    CONFIG_USB_DWC3_GADGET = y
    CONFIG_GPIOLIB = y
    CONFIG_GPIO_INTEL_MID = y
    CONFIG_INTEL_MID_WATCHDOG = y
    CONFIG_X86_EXTENDED_PLATFORM = y
    CONFIG_X86_INTEL_MID = y
    CONFIG_EFI_STUB = y
    CONFIG_EARLY_PRINTK_EFI = y
    CONFIG_HSU_DMA = y
    CONFIG_HSU_DMA_PCI = y
    CONFIG_SERIAL_8250_DMA = y
    CONFIG_SERIAL_8250_PCI = y

    This configuration will immediately enable USB, watchdog, GPIO, HSU drivers.

    We collect the received:
    make i386_defconfig
    make -j4
    

    The result is the file arch / x86 / boot / bzImage .

    The process of preparing the image of the file system is no different from the one described above, with the exception of the output device, which for Intel Edison will be / dev / ttyS2 , and accordingly it must be specified in the Buildroot configuration parameters:
    BR2_TARGET_GENERIC_GETTY_PORT = "ttyS2"

    As a result of the assembly, we get the file output / images / rootfs.cpio.bz2 .

    Copy results to eMMC



    The files ~ / devel / linux / arch / x86 / boot / bzImage and
    ~ / devel / buildroot / output / images / rootfs.cpio.bz2 obtained during the assembly must be copied to our board under the names vmlinuz.efi and initrd, respectively.

    We launch the board on the stock firmware by first switching it to the device mode via USB and connecting the cable to the computer on which we were assembling. After starting the board, the computer will find the USB drive device. This is what we need. We copy our files directly to the root of the mapped drive.

    Configuring the U-Boot bootloader



    The most interesting part of the story is the magic lines that we need to write to the U-Boot configuration. This is what we need to do.
    1. Download the board to the U-Boot command line by pressing any key.
    2. Add a few environment variables so that the following happens:
        boot_edsboot=zboot 0x100000 0 0x3000000 0x800000
        bootargs_edsboot=console=tty1 console=ttyS2,115200n8 rootfstype=ramfs rw
        bootcmd_edsboot=setenv bootargs ${bootargs_edsboot}; run load_edsboot; run boot_edsboot
        load_edsboot=load mmc 0:9 0x100000 vmlinuz.efi; load mmc 0:9 0x3000000 initrd
      

      This is done using the command setenv(detailed examples can be found here ).
    3. Save our changes without ruining the existing ones:
        setenv bootcmd_orig ${bootcmd}
        setenv bootcmd ${bootcmd_edsboot}
        saveenv
      

    Now you can load the board, for example, with this command:
    run bootcmd
    

    or by pressing the reset button.

    Accordingly, you can always return to the original configuration by running:
    run bootcmd_orig
    


    And that is all!

    See what happened
    Welcome to Buildroot
    buildroot login: root
    # uname -a
    Linux buildroot 4.0.0-rc5 + # 1 SMP Fri Mar 27 15:15:28 EET 2015 i686 GNU / Linux

    # lspci -kn
    00: 00.0 0600: 8086: 1170 (rev 01 )
    00: 01.0 0805: 8086: 1190 (rev 01)
    00: 01.2 0805: 8086: 1190 (rev 01)
    00: 01.3 0805: 8086: 1190 (rev 01)
    00: 02.0 0380: 8086: 1182 (rev 01)
    00 : 04.0 0700: 8086: 1191 (rev 01)
    00: 04.1 0700: 8086: 1191 (rev 01)
    Kernel driver in use: serial
    00: 04.2 0700: 8086: 1191 (rev 01)
    Kernel driver in use: serial
    00: 04.3 0700: 8086: 1191 (rev 01)
    Kernel driver in use: serial
    00: 05.0 0700: 8086: 1192 (rev 01)
    Kernel driver in use: hsu_dma_pci
    00: 06.0 0880: 8086: 1193 (rev 01)
    00: 06.1 0880: 8086: 1193 (rev 01)
    00: 07.0 0880: 8086: 1194 (rev 01)
    00: 07.1 0880: 8086: 1194 (rev 01)
    00: 07.2 0880: 8086: 1194 (rev 01)
    00: 08.0 0780: 8086: 1195 (rev 01)
    00: 08.1 0780: 8086: 1195 (rev 01)
    00: 08.2 0780: 8086: 1195 (rev 01)
    00: 08.3 0780 : 8086: 1195 (rev 01)
    00: 09.0 0780: 8086: 1196 (rev 01)
    00: 09.1 0780: 8086: 1196 (rev 01)
    00: 09.2 0780: 8086: 1196 (rev 01)
    00: 0a.0 0780 : 8086: 1197 (rev 01)
    00: 0b.0 1080: 8086: 1198 (rev 01)
    00: 0c.0 0880: 8086: 1199 (rev 01)
    Kernel driver in use: intel_mid_gpio
    00: 0d.0 0401: 8086 : 119a (rev 01)
    00: 0e.0 0880: 8086: 119b (rev 01)
    00: 11.0 0c03: 8086: 119e (rev 01)
    Kernel driver in use: dwc3-pci
    00: 12.0 1180: 8086: 119f (rev 01)
    00: 13.0 0b40: 8086: 11a0 (rev 01)
    Kernel driver in use: intel_scu_ipc
    00: 14.0 0b40: 8086: 11a1 (rev 01)
    00: 15.0 0880: 8086: 11a2 (rev 01)
    00: 16.0 0b40: 8086: 11a3 (rev 01)
    00: 16.1 0b40: 8086: 11a4 (rev 01)
    00: 17.0 0880: 8086: 11a5 (rev 01)
    00: 18.0 0380: 8086: 11a6 (rev 01)

    # cat / proc / interrupts
    CPU0 CPU1
    15: 0 0 IO-APIC 15-fasteoi watchdog
    31: 3 1 IO-APIC 31- fasteoi hsu_dma_pci
    34: 50 49 IO-APIC 34-fasteoi xhci-hcd: usb1
    48: 0 0 IO-APIC 48-fasteoi intel_scu_ipc
    54: 61 65 IO-APIC 54-fasteoi serial
    ...

    Also popular now: