Skip to contentSkip to conversation

lego: ev3: use mainline kernel

PATCH New David Lechner 2 participants 4 messages May 15, 2017 – May 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lego: ev3: use mainline kernel

It is finally possible to boot LEGO MINDSTORMS EV3 from the mainline Linux kernel. This patch updates the defconfg to use the mainline kernel instead of the custom ev3dev kernel.

---
 board/lego/ev3/busybox.fragment                    |  3 +
 board/lego/ev3/genimage.cfg                        |  2 +-
 board/lego/ev3/linux.fragment                      | 49 +++++++++++++
 .../patches/linux/0001-adc-device-tree-node.patch  | 56 ++++++++++++++
 .../linux/0002-sound-device-tree-node.patch        | 85 ++++++++++++++++++++++
 board/lego/ev3/post-image.sh                       |  2 +
 board/lego/ev3/readme.txt                          |  9 +--
 configs/lego_ev3_defconfig                         | 20 +++--
 8 files changed, 210 insertions(+), 16 deletions(-)
 create mode 100644 board/lego/ev3/busybox.fragment
 create mode 100644 board/lego/ev3/patches/linux/0001-adc-device-tree-node.patch
 create mode 100644 board/lego/ev3/patches/linux/0002-sound-device-tree-node.patch
board/lego/ev3/busybox.fragment new file +3 -0
new file mode 100644
index 0000000..901274d
@@ -0,0 +1,3 @@
+CONFIG_BEEP=y
+CONFIG_FEATURE_BEEP_FREQ=440
+CONFIG_FEATURE_BEEP_LENGTH_MS=250
board/lego/ev3/genimage.cfg +1 -1
index 6b8546c..3568295 100644
@@ -19,7 +19,7 @@ image flash.bin {
 		size = 320K
 	}
 	partition uimage {
-		image = "uImage"
+		image = "uImage.da850-lego-ev3"
 		size = 3M
 		offset = 0x50000
 	}
board/lego/ev3/linux.fragment +49 -0

55 lines not on this page · raw message

board/lego/ev3/patches/linux/0001-adc-device-tree-node.patch new file +56 -0

56 lines not on this page · raw message

board/lego/ev3/patches/linux/0002-sound-device-tree-node.patch new file +85 -0

85 lines not on this page · raw message

board/lego/ev3/post-image.sh +2 -0
index 81626dc..553d27a 100755
@@ -4,6 +4,8 @@ BOARD_DIR="$(dirname $0)"
 GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 
+ln -sf "uImage.da850-lego-ev3" "${BINARIES_DIR}/uImage"
+
 rm -rf "${GENIMAGE_TMP}"
 
 genimage \
board/lego/ev3/readme.txt +2 -7
index c40907c..8df91ac 100644
@@ -13,12 +13,6 @@ See:
 - http://www.lego.com/en-us/mindstorms/products/ev3/31313-mindstorms-ev3/
 - http://www.ti.com/product/am1808
 
-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
 ============
 
@@ -65,7 +59,8 @@ After building, you should obtain this tree:
     ??? rootfs.squashfs
     ??? sdcard.img
     ??? u-boot.bin
-    ??? uImage
+    ??? uImage -> uImage.da850-lego-ev3
+    ??? uImage.da850-lego-ev3
 
 Installation
 ============
configs/lego_ev3_defconfig +12 -8
index 543a227..0996b8c 100644
@@ -2,22 +2,26 @@
 BR2_arm=y
 BR2_arm926t=y
 
+# Build options
+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
 
 # Kernel
 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_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11"
+BR2_LINUX_KERNEL_DEFCONFIG="davinci_all"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/lego/ev3/linux.fragment"
-BR2_LINUX_KERNEL_UIMAGE=y
-BR2_LINUX_KERNEL_EXT_EV3DEV_LINUX_DRIVERS=y
+BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0xc0008000"
+BR2_LINUX_KERNEL_APPENDED_UIMAGE=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="da850-lego-ev3"
+
+# Target packages
+BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/lego/ev3/busybox.fragment"
 
 # filesystem
 BR2_TARGET_ROOTFS_EXT2=y
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 lego: ev3: use mainline kernel

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"David" == David Lechner <[email protected]> writes:

It is finally possible to boot LEGO MINDSTORMS EV3 from the mainline Linux kernel. This patch updates the defconfg to use the mainline kernel instead of the custom ev3dev kernel.

Great, thanks!

Quoted 2 lines
 .../patches/linux/0001-adc-device-tree-node.patch  | 56 ++++++++++++++
 .../linux/0002-sound-device-tree-node.patch        | 85 ++++++++++++++++++++++

I see these patches are already in mainline post-4.11, so that's great.

board/lego/ev3/genimage.cfg image flash.bin { · line 25

Quoted 10 lines

+++ b/board/lego/ev3/genimage.cfg

board/lego/ev3/genimage.cfg +1 -1
@@ -19,7 +19,7 @@ image flash.bin {
 		size = 320K
 	}
 	partition uimage {
-		image = "uImage"
+		image = "uImage.da850-lego-ev3"
 		size = 3M
 		offset = 0x50000
 	}

I guess this change isn't strictly needed because of the symlink, but OK.

Quoted 7 lines
configs/lego_ev3_defconfig +0 -0
index 543a227..0996b8c 100644
@@ -2,22 +2,26 @@
 BR2_arm=y
 BR2_arm926t=y

configs/lego_ev3_defconfig line 10

Quoted 10 lines
configs/lego_ev3_defconfig +3 -2
 
+# Build options
+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

This shouldn't be dropped (after changing to 4.11) as the defconfig would otherwise break whenever 4.12 gets added.

Committed to next with that fixed, thanks.

I see you are still using a relatively old u-boot and ext3. Any reason to not use 2017.05 and ext4?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 lego: ev3: use mainline kernel

Quoted 13 lines · Peter Korsgaard
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"David" == David Lechner <[email protected]> writes:

It is finally possible to boot LEGO MINDSTORMS EV3 from the mainline Linux kernel. This patch updates the defconfg to use the mainline kernel instead of the custom ev3dev kernel.

Great, thanks!

Quoted 2 lines
 .../patches/linux/0001-adc-device-tree-node.patch  | 56 ++++++++++++++
 .../linux/0002-sound-device-tree-node.patch        | 85 ++++++++++++++++++++++

I see these patches are already in mainline post-4.11, so that's great.

Quoted 13 lines

board/lego/ev3/genimage.cfg image flash.bin { · line 25

Quoted 10 lines

+++ b/board/lego/ev3/genimage.cfg

board/lego/ev3/genimage.cfg +1 -1
@@ -19,7 +19,7 @@ image flash.bin {
 		size = 320K
 	}
 	partition uimage {
-		image = "uImage"
+		image = "uImage.da850-lego-ev3"
 		size = 3M
 		offset = 0x50000
 	}

I guess this change isn't strictly needed because of the symlink, but OK.

The symlink is something that I meant to ask about but forgot. I made the symlink so that the file name in the FAT partition is correct when creating an SD card image. I was wondering if there might be a better way to rename the file using the genimage tool.

Quoted 22 lines
Quoted 8 lines
configs/lego_ev3_defconfig +0 -0
index 543a227..0996b8c 100644
@@ -2,22 +2,26 @@
 BR2_arm=y
 BR2_arm926t=y

configs/lego_ev3_defconfig line 10

Quoted 10 lines
configs/lego_ev3_defconfig +3 -2
 
+# Build options
+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

This shouldn't be dropped (after changing to 4.11) as the defconfig would otherwise break whenever 4.12 gets added.

Quoted 5 lines

Committed to next with that fixed, thanks.

I see you are still using a relatively old u-boot and ext3. Any reason to not use 2017.05 and ext4?

No reason. I will send another patch to update.

#3 lore raw

PATCH 1/1 lego: ev3: use mainline kernel

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"David" == David Lechner <[email protected]> writes:

Hi,

Quoted 7 lines
Quoted 2 lines

I guess this change isn't strictly needed because of the symlink, but OK.

The symlink is something that I meant to ask about but forgot. I made the symlink so that the file name in the FAT partition is correct when creating an SD card image. I was wondering if there might be a better way to rename the file using the genimage tool.

Looking at the source code, you CAN do it using the file argument (instead of files):

image boot.vfat {
	vfat {
		file uImage {
		     image = "uImage.da850-lego-ev3"
		}
	}
	size = 16M
}

The file section title (uImage) is the name the file will have inside the fat filesystem, and image is the source name.

If this is really more readable than the symlink or not I don't know.

Quoted 1 line

No reason. I will send another patch to update.

Great, thanks!

Signature · 1 line
Bye, Peter Korsgaard