Launch Vanilla Core on Intel Galileo

I have no doubt that the majority of Intel Galileo users are wondering when will the kernel be finally updated?




Linus Torvalds recently tagged the kernel repository with the current version 4.0-rc3 . As he himself wrote, the version does not mean anything, although for our current case it means a lot, namely, from that moment on, happy owners of motherboards based on Intel Quark SoC can try to launch a new kernel without any additional patches.

Let's figure out how to achieve this. As an initial condition, it is assumed that there is an Intel Galileo board with the default Yocto-based system and the grub bootloader stitched on it.

All the actions described below are supposed to be performed on a working laptop or desktop.

Kernel preparation


First of all, we need a kernel that easily gets from the repository (we need a specific version 4.0-rc3 ):

mkdir ~/devel
cd ~/devel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd ~/devel/linux
git checkout v4.0-rc3


You need to make a few minimal changes to the default configuration, namely the arch / x86 / configs / i386_defconfig file . After all, we remember that the processor is 32-bit, and even with features!

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


Now (add lines to the file):
# CONFIG_DRM_I915 is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_M586TSC=y
CONFIG_X86_INTEL_QUARK=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_EXTENDED_PLATFORM=y
CONFIG_EFI_STUB=y
CONFIG_EARLY_PRINTK_EFI=y
CONFIG_PM_RUNTIME=y
CONFIG_SERIAL_8250_PCI=y

Остальные параметры остались в неизменном виде.

Собираем полученное:
make i386_defconfig
make -j4

Результатом будет файл arch/x86/boot/bzImage.


Подготовка образа корневой системы


Чтобы сильно не заморачиваться, воспользуемся дистрибутивом Buildroot.

Скачиваем его из репозитория, выбираем последний релиз (2015.02):

cd ~/devel
git clone git://git.buildroot.net/buildroot
cd ~/devel/buildroot
git checkout 2015.02

Create a minimal configuration for the assembly, for example, in the configs / galileo_defconfig file :
# Architecture
BR2_i386 = y
BR2_x86_i586 = y

# the Misc
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV = y
BR2_TARGET_GENERIC_GETTY_PORT = «ttyS1»

# Root FS
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_ROOTFS_CPIO = y
BR2_TARGET_ROOTFS_CPIO_BZIP2 = y

# the Packages
BR2_PACKAGE_KEXEC = y
BR2_PACKAGE_KEXEC_ZLIB = y
BR2_PACKAGE_LRZSZ = y
BR2_PACKAGE_SCREEN = y
BR2_PACKAGE_PCIUTILS = y
BR2_PACKAGE_DMIDECODE = y
BR2_PACKAGE_BUSYBOX_WATCHDOG = y

We assemble initrd with a couple of commands:

make galileo_defconfig
make

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

Packing the results on micro SD


So, after the previous steps, we got the following files:
~ / devel / linux / arch / x86 / boot / bzImage
~ / devel / buildroot / output / images / rootfs.cpio.bz2

Let's prepare a micro SD card 64MB or more (suppose that a partition table has already been created on it):

mkfs.vfat /dev/sdc1
udisks --mount /dev/sdc1
Mounted /org/freedesktop/UDisks/devices/sdc1 at /media/FB87-F683

And copy the previously received files:

cp ~/devel/linux/arch/x86/boot/bzImage /media/FB87-F683/vmlinuz.efi
cp ~/devel/buildroot/output/images/rootfs.cpio.bz2 /media/FB87-F683/initrd
mkdir -p /media/FB87-F683/boot/grub

Add the configuration for grub ( /media/FB87-F683/boot/grub/grub.conf ):
default 0
timeout 3

title Linux on Intel Galileo
 root (hd0,0)
 kernel /vmlinuz.efi console = ttyS1,115200n8
 initrd / initrd

Unmount the card and insert it into the board. We are trying to download.
A few recent posts on the console
...
[14.632322] mount (853) used greatest stack depth: 6968 bytes left
[14.668185] mkdir (856) used greatest stack depth: 6940 bytes left
[14.694005] mount (858) used greatest stack depth: 6908 bytes left
Starting logging: OK
Starting mdev ...
[15.739672] mdev (869) used greatest stack depth: 6904 bytes left
Starting watchdog ...
Initializing random number generator ... [15.806320] random: dd urandom read with 4 bits of entropy available
done.
Starting network ...
[15.862745] ip (887) used greatest stack depth: 6304 bytes left
[15.886757] ip (889) used greatest stack depth: 5824 bytes left
Starting udhcpc ...

Welcome to Buildroot
buildroot login: root
# uname -a
Linux buildroot 4.0.0-rc3 + # 35 Mon Mar 9 19:26:19 EET 2015 i586 GNU / Linux


Voila!


As a bonus, a list of the following actions and kernel configuration options to support various hardware.

Turn on SDHCI, USB gadget, ethernet, GPIO SCH, watchdog:
Y = CONFIG_MMC
CONFIG_MMC_SDHCI = y
CONFIG_MMC_SDHCI_PCI = y
CONFIG_USB_GADGET = y
CONFIG_USB_EG20T = y
CONFIG_STMMAC_ETH = y
CONFIG_STMMAC_PCI = y
CONFIG_GPIOLIB = y
CONFIG_GPIO_SCH = y
CONFIG_IE6XX_WDT = y

Inclusion of SPI in kernels 4.0-rc1, 4.0-rc2
To enable SPI, you need a patch:

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -499,6 +499,7 @@ config X86_INTEL_QUARK
        depends on X86_IO_APIC
        select IOSF_MBI
        select INTEL_IMR
+       select COMMON_CLK
        ---help---
          Select to include support for Quark X1000 SoC.
          Say Y here if you have a Quark based system such as the Arduino


SPI is included very simply.
CONFIG_SPI = y
CONFIG_SPI_PXA2XX_PCI = y
CONFIG_SPI_PXA2XX = y

For I2C and GPIO, you need to attach a patch with a driver and a correction fix, which is presented below:

--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -148,8 +148,7 @@ config GPIO_GENERIC_PLATFORM
 config GPIO_DWAPB
        tristate "Synopsys DesignWare APB GPIO driver"
-       depends on ARM
-       depends on OF_GPIO
+       depends on (ARM && OF_GPIO) || X86_INTEL_QUARK
        select GPIO_GENERIC
        select GENERIC_IRQ_CHIP
        help

Included with just a few options.
CONFIG_GPIO_DWAPB = y
CONFIG_I2C_DESIGNWARE_PLATFORM = y
CONFIG_MFD_INTEL_QUARK_I2C_GPIO = y
CONFIG_DMI = y

Download the updated kernel and enjoy the result:
Lspci output
# lspci -nk
00: 00.0 0600: 8086: 0958
Subsystem: 8086: 095e
Kernel driver in use: iosf_mbi_pci
00: 14.0 0805: 8086: 08a7 (rev 10)
Subsystem: 8086: 08a7
Kernel driver in use: sdhci-pci
00: 14.1 0700: 8086: 0936 (rev 10)
Subsystem: 8086: 0936
Kernel driver in use: serial
00: 14.2 0c03: 8086: 0939 (rev 10)
Subsystem: 8086: 0939
Kernel driver in use: pch_udc
00: 14.3 0c03: 8086 : 0939 (rev 10)
Subsystem: 8086: 0939
Kernel driver in use: ehci-pci
00: 14.4 0c03: 8086: 093a (rev 10)
Subsystem: 8086: 093a
Kernel driver in use: ohci-pci
00: 14.5 0700: 8086 : 0936 (rev 10)
Subsystem: 8086: 0936
Kernel driver in use: serial
00: 14.6 0200: 8086: 0937 (rev 10)
Subsystem: 8086: 0937
Kernel driver in use: stmmaceth
00: 14.7 0200: 8086: 0937 (rev 10)
Subsystem: 8086: 0937
Kernel driver in use : stmmaceth
00: 15.0 0c80: 8086: 0935 (rev 10)
Subsystem: 8086: 0935
Kernel driver in use: pxa2xx_spi_pci
00: 15.1 0c80: 8086: 0935 (rev 10)
Subsystem: 8086: 0935
Kernel driver in use: pxa2xx_spi_pci
00: 15.2 0c80: 8086: 0934 (rev 10)
Subsystem: 8086: 0934 Kernel driver in use: pcieport 00: 17.1 0604: 8086: 11c4
: intel_quark_mfd_i2c_gpio
00: 17.0 0604: 8086: 11c3


Kernel driver in use: pcieport
00: 1f.0 0601: 8086: 095e
Subsystem: 8086: 095e
Kernel driver in use: lpc_sch


Content / proc / interrupts
# cat / proc / interrupts
CPU0
0: 113 IO-APIC-edge
rtc0
9: 0 IO-APIC-fasteoi acpi
16: 31 IO-APIC 16-fasteoi pxa2xx-spi.168, ohci_hcd : usb2, mmc0
17: 255 IO-APIC 17-fasteoi pxa2xx-spi. 169, serial
18: 0 IO-APIC 18-fasteoi i2c_designware, gpio-dwapb-mfd, pch_udc
19: 0 IO-APIC 19-fasteoi ehci_hcd: usb1


Also popular now: