📜 ⬆️ ⬇️

Launch the vanilla core on Intel Galileo

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




Recently Linus Torvalds tagged the kernel repository with the current version 4.0-rc3 . As he himself wrote, the version means nothing, although for our present case it means a lot, namely, that from this point on, happy owners of motherboards based on the Intel Quark SoC can try to launch a new kernel without any additional patches.
')
Let's figure out how to achieve this. As initial conditions, an Intel Galileo board with a default Yocto-based system and a grub bootloader is stitched onto it.

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

Core preparation


First of all, we need a kernel that can be easily retrieved 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 edits 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 (we delete lines from the file):
CONFIG_SMP = y
CONFIG_DRM_I915 = y


It became (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

The remaining parameters remained unchanged.

We collect the received:
 make i386_defconfig make -j4 

The result will be the file arch / x86 / boot / bzImage .


Preparing the root image


In order not to bother much, we use the Buildroot distribution.

Download it from the repository, select the latest release ( 2015.02 ):

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

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

# 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

# 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

Build the initrd with a couple of commands:

 make galileo_defconfig make 

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

We pack 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

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 obtained 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 last messages 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.

We include SDHCI, USB gadget, ethernet, GPIO SCH, watchdog:
CONFIG_MMC = y
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

Enable SPI in 4.0-rc1, 4.0-rc2 cores
To enable SPI, you will 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 very easy to turn on.
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 corrective 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: intel_quark_mfd_i2c_gpio
00: 17.0 0604: 8086: 11c3
Kernel driver in use: pcieport
00: 17.1 0604: 8086: 11c4
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 timer
8: 1 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

Source: https://habr.com/ru/post/252301/


All Articles