LEGO MINDSTORMS EV3 Updates
cover LEGO MINDSTORMS EV3 Updates
Hi,
I saw that you have EV3 support using the ev3dev kernel (I'm the ev3dev maintainer). Here are some updates for better EV3 support in Buildroot.
Earlier this year, I submitted a patch to U-Boot for EV3 support, so we can now use mainline U-Boot for EV3.
Also, following up from a recent Buildroot email thread, I have added a script to create usable images using the genimage tool. I also added a linux extension for the ev3dev drivers. We use them as a git submodule in our kernel, but since buildroot doesn't seem to be able to handle that, this accomplishes the same result.
FYI, I am also working on mainline linux kernel support for the EV3, so maybe around 4.10 or 4.11, we can switch to a mainline kernel here and it will actually boot. If you don't want to include the ev3dev kernel extension stuff, that is OK. I assume no one is using Buildroot much with the EV3 at this point anyway.
David Lechner (4):
configs/lego_ev3: add U-Boot support board/lego/ev3: Create images using genimage
linux: add ev3dev extension
board/lego/ev3: Use ev3dev linux ext for ev3dev drivers
board/lego/ev3/genimage.cfg | 57 ++++ board/lego/ev3/linux_defconfig | 297 +++++++++++++++++++++ .../0001-Create-empty-drivers-lego-Kconfig.patch | 24 -- board/lego/ev3/post-image.sh | 14 + board/lego/ev3/readme.txt | 84 ++---- configs/lego_ev3_defconfig | 17 +- linux/Config.ext.in | 10 + linux/linux-ext-ev3dev.mk | 13 + package/Config.in | 1 + package/ev3dev/Config.in | 12 + package/ev3dev/ev3dev.mk | 11 + package/ev3dev/lego-linux-drivers.hash | 2 + support/scripts/pkg-stats | 1 + 13 files changed, 450 insertions(+), 93 deletions(-) create mode 100644 board/lego/ev3/genimage.cfg create mode 100644 board/lego/ev3/linux_defconfig delete mode 100644 board/lego/ev3/patches/linux/0001-Create-empty-drivers-lego-Kconfig.patch create mode 100755 board/lego/ev3/post-image.sh create mode 100644 linux/linux-ext-ev3dev.mk create mode 100644 package/ev3dev/Config.in create mode 100644 package/ev3dev/ev3dev.mk create mode 100644 package/ev3dev/lego-linux-drivers.hash
Signature · 1 line
2.7.4
PATCH 1/4 configs/lego_ev3: add U-Boot support
This adds U-Boot configuration for LEGO MINDSTORMS EV3. U-Boot has had support for LEGO MINDSTORMS EV3 since v2016.05.
--- configs/lego_ev3_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/lego_ev3_defconfig +5 -0
@@ -24,3 +24,8 @@ BR2_LINUX_KERNEL_UIMAGE=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_3=y # BR2_TARGET_ROOTFS_TAR is not set + +# U-Boot +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3"
Signature · 1 line
2.7.4
PATCH 2/4 board/lego/ev3: Create images using genimage
In reply to David LechnerThis adds a script to create SD card and flash images for LEGO MINDSTORMS EV3 using the genimage tool.
The default kernel config had to be modifed to add support for squashfs and to add a ram disk.
--- board/lego/ev3/genimage.cfg | 57 ++++++++ board/lego/ev3/linux_defconfig | 291 +++++++++++++++++++++++++++++++++++++++++ board/lego/ev3/post-image.sh | 14 ++ board/lego/ev3/readme.txt | 80 +++-------- configs/lego_ev3_defconfig | 8 +- 5 files changed, 386 insertions(+), 64 deletions(-) create mode 100644 board/lego/ev3/genimage.cfg create mode 100644 board/lego/ev3/linux_defconfig create mode 100755 board/lego/ev3/post-image.sh
board/lego/ev3/genimage.cfg new file +57 -0
@@ -0,0 +1,57 @@ +# LEGO MINDSTORMS EV3 can boot from a 16MB flash or from a microSD card. +# The U-Boot bootloader from the flash is always used, even when booting +# from a microSD card. + +# The Flash image + +flash nor-16M-256 { + pebsize = 4096 + numpebs = 4096 + minimum-io-unit-size = 256 +} + +image flash.bin { + flash { + } + flashtype = "nor-16M-256" + partition uboot { + image = "u-boot.bin" + size = 320K + } + partition uimage { + image = "uImage" + size = 3M + offset = 0x50000 + } + partition rootfs { + image = "rootfs.squashfs" + size = 9600K + offset = 0x350000 + } +} + +# The SD card image + +image boot.vfat { + vfat { + files = { + "uImage" + } + } + size = 16M +} + +image sdcard.img { + hdimage { + } + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + offset = 4M + } + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + } +}
board/lego/ev3/linux_defconfig new file +291 -0
291 lines not on this page · raw message
board/lego/ev3/post-image.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" +GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}"
board/lego/ev3/readme.txt +18 -62
101 lines not on this page · raw message
configs/lego_ev3_defconfig +6 -2
@@ -8,7 +8,7 @@ BR2_GLOBAL_PATCH_DIR="board/lego/ev3/patches" # system BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS1" - +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/lego/ev3/post-image.sh" # Linux headers same as kernel, a 4.4 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
@@ -17,15 +17,19 @@ BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_GIT=y BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/ev3dev/ev3dev-kernel.git" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v4.4.19-15-ev3dev-ev3_1" -BR2_LINUX_KERNEL_DEFCONFIG="ev3dev" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/lego/ev3/linux_defconfig" BR2_LINUX_KERNEL_UIMAGE=y # filesystem BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_3=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y # BR2_TARGET_ROOTFS_TAR is not set # U-Boot BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3" +BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.7.4
PATCH 3/4 linux: add ev3dev extension
In reply to David LechnerThis adds an ev3dev extension that provides linux kernel drivers for LEGO MINDSTORMS EV3 from the ev3dev project.
--- linux/Config.ext.in | 10 ++++++++++ linux/linux-ext-ev3dev.mk | 13 +++++++++++++ package/Config.in | 1 + package/ev3dev/Config.in | 12 ++++++++++++ package/ev3dev/ev3dev.mk | 11 +++++++++++ package/ev3dev/lego-linux-drivers.hash | 2 ++ support/scripts/pkg-stats | 1 + 7 files changed, 50 insertions(+) create mode 100644 linux/linux-ext-ev3dev.mk create mode 100644 package/ev3dev/Config.in create mode 100644 package/ev3dev/ev3dev.mk create mode 100644 package/ev3dev/lego-linux-drivers.hash
linux/Config.ext.in +10 -0
@@ -46,6 +46,16 @@ config BR2_LINUX_KERNEL_EXT_RTAI RTAI Kernel part. #------------------------------------------------------------------------------- +# ev3dev +config BR2_LINUX_KERNEL_EXT_EV3DEV + bool "ev3dev drivers" + select BR2_PACKAGE_EV3DEV + help + Linux drivers for LEGO MINDSTORMS EV3 from the ev3dev project. + + https://github.com/ev3dev/lego-linux-drivers + +#------------------------------------------------------------------------------- # fbtft config BR2_LINUX_KERNEL_EXT_FBTFT bool "FB TFT drivers"
linux/linux-ext-ev3dev.mk new file +13 -0
@@ -0,0 +1,13 @@ +################################################################################ +# Linux ev3dev extensions +# +# Patch the linux kernel with ev3dev extension +################################################################################ + +LINUX_EXTENSIONS += ev3dev + +define EV3DEV_PREPARE_KERNEL + dest=drivers/lego ; \ + mkdir -p $(LINUX_DIR)/$${dest}; \ + cp -dpfr $(EV3DEV_DIR)/* $(LINUX_DIR)/$${dest}/ +endef
package/Config.in +1 -0
@@ -369,6 +369,7 @@ endmenu source "package/edid-decode/Config.in" source "package/eeprog/Config.in" source "package/eudev/Config.in" + source "package/ev3dev/Config.in" source "package/evemu/Config.in" source "package/evtest/Config.in" source "package/fan-ctrl/Config.in"
package/ev3dev/Config.in new file +12 -0
@@ -0,0 +1,12 @@ +# Prompt-less option, because this package is not doing anything except +# downloading the ev3dev driver sources. The real work is done by a Linux +# extension. +config BR2_PACKAGE_EV3DEV + bool + depends on BR2_LINUX_KERNEL + help + Linux drivers for LEGO MINDSTORMS EV3 + + This is only the download helper for the kernel patch. + + https://github.com/ev3dev/lego-linux-drivers
package/ev3dev/ev3dev.mk new file +11 -0
@@ -0,0 +1,11 @@ +################################################################################ +# +# ev3dev +# +################################################################################ + +EV3DEV_VERSION = 0e551eb25ae8600c1f178814781bfb42dc835496 +EV3DEV_SITE = $(call github,ev3dev,lego-linux-drivers,$(EV3DEV_VERSION)) +EV3DEV_LICENSE = GPLv2 + +$(eval $(generic-package))
package/ev3dev/lego-linux-drivers.hash new file +2 -0
@@ -0,0 +1,2 @@ +# locally computed +sha256 9d2740b348c8d43e7e15fedc4cec99bf351a3a2ba8691f2a07c439a9c034bc04 lego-linux-drivers-0e551eb25ae8600c1f178814781bfb42dc835496.tar.gz
support/scripts/pkg-stats +1 -0
@@ -94,6 +94,7 @@ for i in $(find boot/ linux/ package/ -name '*.mk' | sort) ; do if test \ $i = "boot/common.mk" -o \ + $i = "linux/linux-ext-ev3dev.mk" -o \ $i = "linux/linux-ext-fbtft.mk" -o \ $i = "linux/linux-ext-xenomai.mk" -o \ $i = "linux/linux-ext-rtai.mk" -o \
Signature · 1 line
2.7.4
PATCH 4/4 board/lego/ev3: Use ev3dev linux ext for ev3dev drivers
In reply to David LechnerThis uses the ev3dev linux extension to compile the ev3dev drivers for LEGO MINDSTORMS EV3.
--- board/lego/ev3/linux_defconfig | 10 +++++++-- .../0001-Create-empty-drivers-lego-Kconfig.patch | 24 ---------------------- board/lego/ev3/readme.txt | 4 ++-- configs/lego_ev3_defconfig | 4 +--- 4 files changed, 11 insertions(+), 31 deletions(-) delete mode 100644 board/lego/ev3/patches/linux/0001-Create-empty-drivers-lego-Kconfig.patch
board/lego/ev3/linux_defconfig +8 -2
@@ -80,6 +80,12 @@ CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_STANDALONE is not set # CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_LEGO_DRIVERS=y +CONFIG_LEGOEV3_I2C=y +CONFIG_LEGOEV3_BATTERY=y +CONFIG_LEGOEV3_SOUND=y +# CONFIG_LEGO_USER_DEVICES is not set +CONFIG_WEDO=m CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_BLOCK=y
@@ -164,8 +170,8 @@ CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set # CONFIG_LOGO_LINUX_CLUT224 is not set -CONFIG_SOUND=m -CONFIG_SND=m +CONFIG_SOUND=y +CONFIG_SND=y CONFIG_SND_SEQUENCER=m CONFIG_SND_SEQ_DUMMY=m CONFIG_SND_HRTIMER=m
board/lego/ev3/patches/linux/0001-Create-empty-drivers-lego-Kconfig.patch deleted +0 -24
@@ -1,24 +0,0 @@ -From 72c5727488f10160abfadcc77dd9763c4408b5e9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <[email protected]> -Date: Sat, 15 Oct 2016 16:23:31 +0200 -Subject: [PATCH] Create empty drivers/lego/Kconfig -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Vincent Stehl? <[email protected]> ---- - drivers/lego/Kconfig | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 drivers/lego/Kconfig - -diff --git a/drivers/lego/Kconfig b/drivers/lego/Kconfig -new file mode 100644 -index 0000000..d7cbf4f ---- /dev/null -+++ b/drivers/lego/Kconfig -@@ -0,0 +1 @@ -+# Empty Kconfig just to make source from drivers/Kconfig succeed. --- -2.9.3 -
board/lego/ev3/readme.txt +2 -2
@@ -4,8 +4,7 @@ Intro ===== This is the buildroot basic board support for the Lego Mindstorms EV3 -programmable brick. No support for sensors and drivers is provided for the -moment. +programmable brick. The Lego Mindstorms EV3 brick comprises a Texas Instruments AM1808 SoC, with an ARM 926EJ-S main processor running at 300 MHz.
@@ -17,6 +16,7 @@ See: The buildroot configuration uses the Linux kernel of the ev3dev project. See: - https://github.com/ev3dev/ev3-kernel/ +- https://github.com/ev3dev/lego-linux-drivers/ - http://www.ev3dev.org/ How it works
configs/lego_ev3_defconfig +1 -3
@@ -2,9 +2,6 @@ BR2_arm=y BR2_arm926t=y -# patches -BR2_GLOBAL_PATCH_DIR="board/lego/ev3/patches" - # system BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS1"
@@ -20,6 +17,7 @@ BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v4.4.19-15-ev3dev-ev3_1" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/lego/ev3/linux_defconfig" BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_EXT_EV3DEV=y # filesystem BR2_TARGET_ROOTFS_EXT2=y
Signature · 1 line
2.7.4
PATCH 2/4 board/lego/ev3: Create images using genimage
In reply to David LechnerHi David,
Quoted 17 lines · David Lechner
This adds a script to create SD card and flash images for LEGO MINDSTORMS EV3 using the genimage tool.
The default kernel config had to be modifed to add support for squashfs and to add a ram disk.
Signed-off-by David Lechner <[email protected]>--- board/lego/ev3/genimage.cfg | 57 ++++++++ board/lego/ev3/linux_defconfig | 291 +++++++++++++++++++++++++++++++++++++++++ board/lego/ev3/post-image.sh | 14 ++ board/lego/ev3/readme.txt | 80 +++-------- configs/lego_ev3_defconfig | 8 +- 5 files changed, 386 insertions(+), 64 deletions(-) create mode 100644 board/lego/ev3/genimage.cfg create mode 100644 board/lego/ev3/linux_defconfig create mode 100755 board/lego/ev3/post-image.sh
[...]
Quoted 6 lines
board/lego/ev3/linux_defconfig new file +0
-0@@ -0,0 +1,291 @@
[...]
board/lego/ev3/linux_defconfig line 247
Quoted 2 lines
board/lego/ev3/linux_defconfig new file +2
-0+CONFIG_EXT2_FS=m +CONFIG_EXT3_FS=m
ext3 was removed in kernel version 4.3, while lego_ev3_defconfig uses kernel version 4.4. Under which kernel have you generated this defconfig?
You may try using a config fragment file to add support for additional kernel features. See pc_x86_64_bios_defconfig, for example.
Quoted 24 lines
configs/lego_ev3_defconfig +3
-2@@ -8,7 +8,7 @@ BR2_GLOBAL_PATCH_DIR="board/lego/ev3/patches" # system BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS1" - +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/lego/ev3/post-image.sh" # Linux headers same as kernel, a 4.4 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y@@ -17,15 +17,19 @@ BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_GIT=y BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/ev3dev/ev3dev-kernel.git" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v4.4.19-15-ev3dev-ev3_1" -BR2_LINUX_KERNEL_DEFCONFIG="ev3dev" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/lego/ev3/linux_defconfig" BR2_LINUX_KERNEL_UIMAGE=y # filesystem BR2_TARGET_ROOTFS_EXT2=y
configs/lego_ev3_defconfig BR2_LINUX_KERNEL=y · line 35
Quoted 10 lines
configs/lego_ev3_defconfig +3
-0BR2_TARGET_ROOTFS_EXT2_3=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y # BR2_TARGET_ROOTFS_TAR is not set # U-Boot BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3" +BR2_PACKAGE_HOST_GENIMAGE=y
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 2/4 board/lego/ev3: Create images using genimage
Quoted 30 lines · Baruch Siach
Hi David,
Quoted 17 lines · David Lechner
This adds a script to create SD card and flash images for LEGO MINDSTORMS EV3 using the genimage tool.
The default kernel config had to be modifed to add support for squashfs and to add a ram disk.
Signed-off-by David Lechner <[email protected]>--- board/lego/ev3/genimage.cfg | 57 ++++++++ board/lego/ev3/linux_defconfig | 291 +++++++++++++++++++++++++++++++++++++++++ board/lego/ev3/post-image.sh | 14 ++ board/lego/ev3/readme.txt | 80 +++-------- configs/lego_ev3_defconfig | 8 +- 5 files changed, 386 insertions(+), 64 deletions(-) create mode 100644 board/lego/ev3/genimage.cfg create mode 100644 board/lego/ev3/linux_defconfig create mode 100755 board/lego/ev3/post-image.sh[...]
Quoted 6 lines
board/lego/ev3/linux_defconfig new file +0
-0@@ -0,0 +1,291 @@[...]
Quoted 5 lines
board/lego/ev3/linux_defconfig line 247
Quoted 2 lines
board/lego/ev3/linux_defconfig new file +2
-0+CONFIG_EXT2_FS=m +CONFIG_EXT3_FS=mext3 was removed in kernel version 4.3, while
lego_ev3_defconfiguses kernel version 4.4. Under which kernel have you generated this defconfig?
4.4. There is still a kernel option for ext3 that does nothing (for backwards compatibility according to the help text).
Quoted 3 lines
You may try using a config fragment file to add support for additional kernel features. See
pc_x86_64_bios_defconfig, for example.
That is much better. Thanks for the idea.
Quoted 38 lines
Quoted 25 lines
configs/lego_ev3_defconfig +3
-2@@ -8,7 +8,7 @@ BR2_GLOBAL_PATCH_DIR="board/lego/ev3/patches" # system BR2_TARGET_GENERIC_GETTY=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS1" - +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/lego/ev3/post-image.sh" # Linux headers same as kernel, a 4.4 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y@@ -17,15 +17,19 @@ BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_GIT=y BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/ev3dev/ev3dev-kernel.git" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v4.4.19-15-ev3dev-ev3_1" -BR2_LINUX_KERNEL_DEFCONFIG="ev3dev" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/lego/ev3/linux_defconfig" BR2_LINUX_KERNEL_UIMAGE=y # filesystem BR2_TARGET_ROOTFS_EXT2=yconfigs/lego_ev3_defconfig BR2_LINUX_KERNEL=y · line 35
Quoted 10 lines
configs/lego_ev3_defconfig +3
-0BR2_TARGET_ROOTFS_EXT2_3=y +BR2_TARGET_ROOTFS_SQUASHFS=y +BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y # BR2_TARGET_ROOTFS_TAR is not set # U-Boot BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3" +BR2_PACKAGE_HOST_GENIMAGE=ybaruch
PATCH 1/4 configs/lego_ev3: add U-Boot support
In reply to David LechnerHello,
Thanks for this patch series updating the lego_ev3 support, much appreciated!
Quoted 13 lines · David Lechner
This adds U-Boot configuration for LEGO MINDSTORMS EV3. U-Boot has had support for LEGO MINDSTORMS EV3 since v2016.05.
Signed-off-by David Lechner <[email protected]>--- configs/lego_ev3_defconfig | 5 +++++ 1 file changed, 5 insertions(+)configs/lego_ev3_defconfig +0
-0
configs/lego_ev3_defconfig BR2_LINUX_KERNEL_UIMAGE=y · line 31
Quoted 8 lines
configs/lego_ev3_defconfig +5
-0@@ -24,3 +24,8 @@ BR2_LINUX_KERNEL_UIMAGE=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_3=y # BR2_TARGET_ROOTFS_TAR is not set + +# U-Boot +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3"
You should use a specific U-Boot version, so that we're sure we'll continue to use the same tested version over time. See other defconfigs:
wandboard_defconfig:BR2_TARGET_UBOOT=y wandboard_defconfig:BR2_TARGET_UBOOT_BOARDNAME="wandboard" wandboard_defconfig:BR2_TARGET_UBOOT_CUSTOM_VERSION=y wandboard_defconfig:BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2016.09.01"
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/4 board/lego/ev3: Create images using genimage
In reply to David LechnerHello,
Quoted 7 lines · David Lechner
This adds a script to create SD card and flash images for LEGO MINDSTORMS EV3 using the genimage tool.
The default kernel config had to be modifed to add support for squashfs and to add a ram disk.
Signed-off-by David Lechner <[email protected]>
In addition to the comment made by Baruch about using a defconfig fragment for Linux, I have another comment, see below.
Quoted 5 lines
# U-Boot
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="legoev3"
+BR2_PACKAGE_HOST_GENIMAGE=y
This line probably need an additional comment above it, as it's not U-Boot related.
But more importantly, since you're building a FAT filesystem image, you also need:
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_MTOOLS=y
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 3/4 linux: add ev3dev extension
In reply to David LechnerHello,
Quoted 4 lines · David Lechner
This adds an ev3dev extension that provides linux kernel drivers for LEGO MINDSTORMS EV3 from the ev3dev project.
Signed-off-by David Lechner <[email protected]>
This all looks mostly good, I only have a few minor comments.
The first one is about the naming: ev3dev is really the name of the overall project/organization, so I think the package should rather be named ev3dev-lego-linux or ev3dev-lego-linux-drivers or ev3dev-linux-drivers or something like this. Of course, this applies to both the package itself and the corresponding Linux extension.
Quoted 8 lines
linux/linux-ext-ev3dev.mk new file +2
-0@@ -0,0 +1,13 @@ +################################################################################ +# Linux ev3dev extensions
linux/linux-ext-ev3dev.mk line 12
Quoted 10 lines
linux/linux-ext-ev3dev.mk new file +10
-0+# +# Patch the linux kernel with ev3dev extension +################################################################################ + +LINUX_EXTENSIONS += ev3dev + +define EV3DEV_PREPARE_KERNEL + dest=drivers/lego ; \ + mkdir -p $(LINUX_DIR)/$${dest}; \ + cp -dpfr $(EV3DEV_DIR)/* $(LINUX_DIR)/$${dest}/
I'm not sure using a variable for $${dest} is really useful since there are only two instances, but if you really want to do so, please use a make variable. Maybe:
EV3DEV_LINUX_DRIVER_DIR = $(LINUX_DIR)/drivers/lego/
define EV3DEV_PREPARE_KERNEL
mkdir -p $(EV3DEV_LINUX_DRIVER_DIR) cp -dpfr $(EV3DEV_DIR)/* $(EV3DEV_LINUX_DRIVER_DIR)
endef
or something along those lines.
linux/linux-ext-ev3dev.mk
Quoted 7 lines
linux/linux-ext-ev3dev.mk new file +7
-0+config BR2_PACKAGE_EV3DEV + bool + depends on BR2_LINUX_KERNEL + help + Linux drivers for LEGO MINDSTORMS EV3 + + This is only the download helper for the kernel patch.
kernel extension
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 4/4 board/lego/ev3: Use ev3dev linux ext for ev3dev drivers
In reply to David LechnerHello,
Quoted 4 lines · David Lechner
This uses the ev3dev linux extension to compile the ev3dev drivers for LEGO MINDSTORMS EV3.
Signed-off-by David Lechner <[email protected]>
This also looks good, but please use a defconfig fragment for enabling the Linux drivers. Note that you can use several fragments: one to enable squashfs/ramdisk, and one to enable the lego drivers. It's not mandatory, but it can be done this way.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[Buildroot] <DKIM> [PATCH 2/4] board/lego/ev3: Create images using genimage
In reply to David LechnerQuoted 2 lines · David Lechner
This adds a script to create SD card and flash images for LEGO MINDSTORMS EV3 using the genimage tool.
Hi David,
Thank you very much for your ev3 patches series!
..
Quoted 7 lines
board/lego/ev3/readme.txt +0
-0@@ -25,9 +25,13 @@ How it works Boot process : --------------
board/lego/ev3/readme.txt How it works · line 33
Quoted 10 lines
board/lego/ev3/readme.txt +6
-3-The u-boot on-board the EV3 brick has provision to boot a Linux kernel from the -external ?SD card. It will try to load a uImage from the first ?SD card -partition, which must be formatted with a FAT filesystem. +The EV3 boots from an EEPROM. This loads whatever is on the built-in 16MB flash +(usually U-Boot) and runs it. The U-Boot from the official LEGO firmware and +mainline U-Boot will attempt to boot a Linux kernel from the external ?SD card. +It will try to load a uImage (and optional boot.scr) from the first ?SD card +partition, which must be formatted with a FAT filesystem. If no ?SD is found or +it does not contain a uImage file, then the EV3 will boot the uImage from from
Very minor remark: there is a duplicate "from" at the end of the line.
As Thomas mentioned already I needed to add host-dosfstools and host-mtools for proper build, then the generated sdcard.img booted ok, and I do see weedo.ko from the ev3dev "extra" drivers.
Thanks!
Best regards,
Vincent.