board: add support for Intel Galileo Gen 2
Kinsella
PATCH v8 1/1 board: add support for Intel Galileo Gen 2
Delta's from v7:-
* Consolidated efi-part.cfg and genimage.cfg into genimage.cfg
* Replaced ext2 with ext4, in kernel and buildroot config.
* Removed redundant kernel configuration entries.
* Hardlinked in modules common to Galileo Gen 1 & Gen 2
* Exception was intel_qrk_gip it appears to need to load after everything else.
* Removed bashism, on /bin/sh now.
* Added comment to defconfig on why binutils 2.25 is required.
Board support package includes:-
* Toplevel build root configuration
* Github based 3.8.7 Kernel
* Upstream 3.8.7
* Linux 3.8.7 Kernel Driver Patches
* Linux 3.8.7 configuration
* Grub configuration
* Init Script to load modules
* genimage config to create sdcard image.
--- board/intel/galileo/genimage.cfg | 31 +++ board/intel/galileo/grub.cfg | 11 + board/intel/galileo/linux-3.8.config | 307 +++++++++++++++++++++ board/intel/galileo/post-build.sh | 2 + board/intel/galileo/post-image.sh | 18 ++ .../galileo/rootfs_overlay/etc/init.d/S09modload | 35 +++ .../etc/modules-load.galileo/galileo.conf | 3 + .../etc/modules-load.galileo/galileo_gen2.conf | 4 + configs/galileo_defconfig | 25 ++ 9 files changed, 436 insertions(+) create mode 100644 board/intel/galileo/genimage.cfg create mode 100644 board/intel/galileo/grub.cfg create mode 100644 board/intel/galileo/linux-3.8.config create mode 100755 board/intel/galileo/post-build.sh create mode 100755 board/intel/galileo/post-image.sh create mode 100755 board/intel/galileo/rootfs_overlay/etc/init.d/S09modload create mode 100644 board/intel/galileo/rootfs_overlay/etc/modules-load.galileo/galileo.conf create mode 100644 board/intel/galileo/rootfs_overlay/etc/modules-load.galileo/galileo_gen2.conf create mode 100644 configs/galileo_defconfig
board/intel/galileo/genimage.cfg new file +31 -0
@@ -0,0 +1,31 @@ +# Create an image of the efi parition +image efi-part.vfat { + vfat { + file startup.nsh { + image = "efi-part/startup.nsh" + } + file EFI { + image = "efi-part/EFI" + } + } + size=512K +} + +# Create the sdcard image, pulling in +# * the image created by buildroot +# * the efi-partition created above. +image sdcard.img { + hdimage { + } + + partition boot { + partition-type = 0xC + image = "efi-part.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 512M + } +}
board/intel/galileo/grub.cfg new file +11 -0
@@ -0,0 +1,11 @@ +set default="0" +set timeout="0" + +menuentry "Buildroot" { + # Grub2 supports ext4, load the kernel from the Linux rootfs partition + # Set root tells grub to search the 2nd partition for the bzImage + set root=(hd0,msdos2) + + # Set Linux to boot from the 2nd partition, SD/MMC support is baked into the kernel + linux /boot/bzImage root=/dev/mmcblk0p2 rootwait console=ttyS1,115200n8 earlycon=uart8250,mmio32,0x9000b000,115200n8 reboot=efi,warm apic=debug rw +}
board/intel/galileo/linux-3.8.config new file +307 -0
307 lines not on this page · raw message
board/intel/galileo/post-build.sh new file +2 -0
@@ -0,0 +1,2 @@ +#!/bin/sh -e +cp board/intel/galileo/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
board/intel/galileo/post-image.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh -e + +GENIMAGE_CFG="board/intel/galileo/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +mkimage () { + rm -rf "${GENIMAGE_TMP}" + + genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "$1" \ + --outputpath "${BINARIES_DIR}" \ + --config "$2" +} + +# Create the SD Card Image +mkimage "${BINARIES_DIR}" "${GENIMAGE_CFG}"
board/intel/galileo/rootfs_overlay/etc/init.d/S09modload new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/sh +# + +load_drivers() +{ + while IFS= read -r line; do + modprobe $line + done < "/etc/modules-load.galileo/$1.conf" +} + +do_board() +{ + board=$(cat /sys/devices/virtual/dmi/id/board_name) + case "$board" in + *"GalileoGen2" ) + load_drivers "galileo_gen2" ;; + *"Galileo" ) + load_drivers "galileo" ;; + esac +} + +case "$1" in + start) + do_board + ;; + stop) + ;; + restart|reload) + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $?
board/intel/galileo/rootfs_overlay/etc/modules-load.galileo/galileo.conf new file +3 -0
@@ -0,0 +1,3 @@ +intel_qrk_gip +cy8c9540a +ad7298
board/intel/galileo/rootfs_overlay/etc/modules-load.galileo/galileo_gen2.conf new file +4 -0
@@ -0,0 +1,4 @@ +intel_qrk_gip +gpio-pca953x +pca9685 +adc1x8s102
configs/galileo_defconfig new file +25 -0
@@ -0,0 +1,25 @@ +BR2_x86_x1000=y +BR2_KERNEL_HEADERS_VERSION=y +BR2_DEFAULT_KERNEL_VERSION="3.8" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_8=y +# Binutils 2.25 is required as this enables stripping the LOCK prefix +BR2_BINUTILS_VERSION_2_25_X=y +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_TARGET_GENERIC_GETTY_PORT="ttyS1" +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y +BR2_ROOTFS_OVERLAY="board/intel/galileo/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/intel/galileo/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/intel/galileo/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/mdr78/Linux-x1000.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="d1a51d55dc67022be6c2d15163ce6dd28540042f" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/intel/galileo/linux-3.8.config" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_GRUB2=y +BR2_TARGET_GRUB2_I386_EFI=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y
Signature · 1 line
2.1.0
PATCH v8 1/1 board: add support for Intel Galileo Gen 2
Ray,
I've applied your patch to next, after making some small additional changes. See below.
Quoted 8 lines · Ray
Delta's from v7:-
* Consolidated efi-part.cfg and genimage.cfg into genimage.cfg
* Replaced ext2 with ext4, in kernel and buildroot config.
* Removed redundant kernel configuration entries.
* Hardlinked in modules common to Galileo Gen 1 & Gen 2
* Exception wasintel_qrk_gipit appears to need to load after everything else.
* Removed bashism, on/bin/shnow.
* Added comment to defconfig on why binutils 2.25 is required.
This shouldn't be part of the commit log proper, since we don't want to preserve that in the history. It should go below the "---" sign.
Quoted 11 lines
Board support package includes:-
* Toplevel build root configuration
* Github based 3.8.7 Kernel
* Upstream 3.8.7
* Linux 3.8.7 Kernel Driver Patches
* Linux 3.8.7 configuration
* Grub configuration
* Init Script to load modules
* genimage config to create sdcard image.
Quoted 2 lines
Signed-off-by Ray Kinsella <[email protected]>---
Here.
Quoted 1 line
+# Create an image of the efi parition
Typo: partition.
Quoted 5 lines
board/intel/galileo/genimage.cfg new file +5
-0+image efi-part.vfat { + vfat { + file startup.nsh { + image = "efi-part/startup.nsh" + }
board/intel/galileo/genimage.cfg line 16
Quoted 10 lines
board/intel/galileo/genimage.cfg new file +10
-0+ file EFI { + image = "efi-part/EFI" + } + } + size=512K +} + +# Create the sdcard image, pulling in +# * the image created by buildroot +# * the efi-partition created above.
Trailing space here.
Quoted 14 lines
board/intel/galileo/post-image.sh new file +8
-0@@ -0,0 +1,18 @@ +#!/bin/sh -e + +GENIMAGE_CFG="board/intel/galileo/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +mkimage () { + rm -rf "${GENIMAGE_TMP}" +
board/intel/galileo/post-image.sh line 18
Quoted 10 lines
board/intel/galileo/post-image.sh new file +10
-0+ genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "$1" \ + --outputpath "${BINARIES_DIR}" \ + --config "$2" +} + +# Create the SD Card Image +mkimage "${BINARIES_DIR}" "${GENIMAGE_CFG}"
The mkimage function was no longer needed, since you're only calling genimage once now. I've simplified this by directly calling genimage. Please verify my commit to make sure that it works fine for you.
board/intel/galileo/post-image.sh
Quoted 4 lines
board/intel/galileo/post-image.sh new file +4
-0+load_drivers() +{ + while IFS= read -r line; do + modprobe $line
Mixed tabs and spaces on this line. I've replaced that with tabs only.
Quoted 18 lines
board/intel/galileo/post-image.sh new file +18
-0+ done < "/etc/modules-load.galileo/$1.conf" +} + +do_board() +{ + board=$(cat /sys/devices/virtual/dmi/id/board_name) + case "$board" in + *"GalileoGen2" ) + load_drivers "galileo_gen2" ;; + *"Galileo" ) + load_drivers "galileo" ;; + esac +} + +case "$1" in + start) + do_board + ;;
board/intel/galileo/post-image.sh
Quoted 10 lines
board/intel/galileo/post-image.sh new file +10
-0+ stop) + ;; + restart|reload) + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $?
Not needed, exiting with the return value of the last command is already the default.
Quoted 1 line
+BR2_PACKAGE_HOST_MTOOLS=y
Why do you need host-mtools? I've kept it for now, but I'm not sure. Is it used internally by genimage?
Also, it is generally customary to add a readme.txt in the board folder, i.e in board/intel/galileo/ in your case to explain how to build/use this configuration. What is especially useful is some indication on which UART is used on the board, how to connect to it, etc.
Since I've applied your patch to the next branch, please base your future submissions on this branch.
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Kinsella
PATCH v8 1/1 board: add support for Intel Galileo Gen 2
Quoted 4 lines
I've applied your patch to next, after making some small additional changes. See below.
Yes, apologies for the trailing spaces and missing tabs ... (again)
Quoted 2 lines
Why do you need host-mtools? I've kept it for now, but I'm not sure. Is it used internally by genimage?
Yes its is used to make the EFI (vfat) partition, it uses mtools under the covers to copy grub into the right place. Strictly speaking it should be auto-selected when you select genimage.
Quoted 5 lines
Also, it is generally customary to add a readme.txt in the board folder, i.e in board/intel/galileo/ in your case to explain how to build/use this configuration. What is especially useful is some indication on which UART is used on the board, how to connect to it, etc.
np, will do this.
I will include a couple of URLs to helpful serial cables.
Quoted 3 lines
Since I've applied your patch to the next branch, please base your future submissions on this branch.
Will do
Quoted 1 line
Thanks a lot!
Thank you - Ray K
PATCH v8 1/1 board: add support for Intel Galileo Gen 2
Ray,
Quoted 6 lines · Ray
Quoted 2 lines
Why do you need host-mtools? I've kept it for now, but I'm not sure. Is it used internally by genimage?
Yes its is used to make the EFI (vfat) partition, it uses mtools under the covers to copy grub into the right place. Strictly speaking it should be auto-selected when you select genimage.
Is mtools *always* used by genimage, or only if you build a vfat partition? I guess the later. And if that's the case, then it's a bit annoying to have host-genimage unconditionally select host-mtools.
Quoted 8 lines
Quoted 5 lines
Also, it is generally customary to add a readme.txt in the board folder, i.e in board/intel/galileo/ in your case to explain how to build/use this configuration. What is especially useful is some indication on which UART is used on the board, how to connect to it, etc.
np, will do this.
I will include a couple of URLs to helpful serial cables.
Great, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Kinsella
PATCH v8 1/1 board: add support for Intel Galileo Gen 2
Quoted 4 lines
Is mtools *always* used by genimage, or only if you build a vfat partition? I guess the later. And if that's the case, then it's a bit annoying to have host-genimage unconditionally select host-mtools.
Your correct the latter, you risk head scratching if a users try to use genimage
and get an error because mtools are missing. mtools is not a huge build cost to incur?
I explicitly set
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
to take care of this, but ideally I would only need to set BR2_PACKAGE_HOST_GENIMAGE.