[FE training-materials-updates] labs/buildroot-rootfs: checkpoint progress
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Wed Apr 22 18:14:47 CEST 2015
Repository : git://git.free-electrons.com/training-materials.git
On branch : master
Link : http://git.free-electrons.com/training-materials/commit/?id=d02c445cdae18b88dbfc61a3bddd424192d0a1b4
>---------------------------------------------------------------
commit d02c445cdae18b88dbfc61a3bddd424192d0a1b4
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date: Wed Apr 22 18:14:21 2015 +0200
labs/buildroot-rootfs: checkpoint progress
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>---------------------------------------------------------------
d02c445cdae18b88dbfc61a3bddd424192d0a1b4
.../0001-Add-nunchuk-driver.patch | 11 ++--
.../0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch | 41 +++++++-------
labs/buildroot-rootfs/buildroot-rootfs.tex | 65 ++++++++++++++++++++++
3 files changed, 92 insertions(+), 25 deletions(-)
diff --git a/lab-data/yocto/nunchuck/linux/0001-Add-nunchuk-driver.patch b/lab-data/buildroot/buildroot-rootfs/0001-Add-nunchuk-driver.patch
similarity index 98%
copy from lab-data/yocto/nunchuck/linux/0001-Add-nunchuk-driver.patch
copy to lab-data/buildroot/buildroot-rootfs/0001-Add-nunchuk-driver.patch
index 6361ed7..a5ba62e 100644
--- a/lab-data/yocto/nunchuck/linux/0001-Add-nunchuk-driver.patch
+++ b/lab-data/buildroot/buildroot-rootfs/0001-Add-nunchuk-driver.patch
@@ -1,4 +1,4 @@
-From cfc44d9fd1c7bb03e9ee612b797c85ed0a9747c2 Mon Sep 17 00:00:00 2001
+From 3b54b33e76ba503852df8bd77398432b0b2147f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20T=C3=A9nart?= <antoine.tenart at free-electrons.com>
Date: Mon, 7 Apr 2014 11:55:31 +0200
Subject: [PATCH 1/2] Add nunchuk driver
@@ -7,6 +7,7 @@ Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Antoine Ténart <antoine.tenart at free-electrons.com>
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
drivers/input/joystick/Kconfig | 13 ++
drivers/input/joystick/Makefile | 1 +
@@ -15,7 +16,7 @@ Signed-off-by: Antoine Ténart <antoine.tenart at free-electrons.com>
create mode 100644 drivers/input/joystick/wiichuck.c
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
-index 56eb471b5576..5b7fba7c4cb1 100644
+index 56eb471..5b7fba7 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -193,6 +193,19 @@ config JOYSTICK_TWIDJOY
@@ -39,7 +40,7 @@ index 56eb471b5576..5b7fba7c4cb1 100644
tristate "5-byte Zhenhua RC transmitter"
select SERIO
diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile
-index 92dc0de9dfed..78466d66e278 100644
+index 92dc0de..78466d6 100644
--- a/drivers/input/joystick/Makefile
+++ b/drivers/input/joystick/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_JOYSTICK_TMDC) += tmdc.o
@@ -52,7 +53,7 @@ index 92dc0de9dfed..78466d66e278 100644
obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o
diff --git a/drivers/input/joystick/wiichuck.c b/drivers/input/joystick/wiichuck.c
new file mode 100644
-index 000000000000..ea7a1e078f2c
+index 0000000..ea7a1e0
--- /dev/null
+++ b/drivers/input/joystick/wiichuck.c
@@ -0,0 +1,423 @@
@@ -480,5 +481,5 @@ index 000000000000..ea7a1e078f2c
+}
+module_exit(wiichuck_exit);
--
-1.8.3.2
+2.1.0
diff --git a/lab-data/yocto/nunchuck/linux/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch b/lab-data/buildroot/buildroot-rootfs/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
similarity index 64%
copy from lab-data/yocto/nunchuck/linux/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
copy to lab-data/buildroot/buildroot-rootfs/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
index 154ef0d..25b3777 100644
--- a/lab-data/yocto/nunchuck/linux/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
+++ b/lab-data/buildroot/buildroot-rootfs/0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
@@ -1,4 +1,4 @@
-From 918b1ce29cd3f78aa6c77b695b51933f02e74c0c Mon Sep 17 00:00:00 2001
+From a995266e8a21583779002b9d14544a09aa2b0b3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20T=C3=A9nart?= <antoine.tenart at free-electrons.com>
Date: Mon, 7 Apr 2014 11:55:56 +0200
Subject: [PATCH 2/2] Add i2c1 and nunchuk nodes in dts
@@ -7,37 +7,39 @@ Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Antoine Ténart <antoine.tenart at free-electrons.com>
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
arch/arm/boot/dts/am335x-bone-common.dtsi | 7 +++++++
arch/arm/boot/dts/am335x-boneblack.dts | 13 +++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
-index df13c3b4a9be..40093497dd7e 100644
+index c3255e0..bde42d7 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
-@@ -50,6 +50,13 @@
- >;
- };
+@@ -81,6 +81,13 @@
+ >;
+ };
-+ i2c1_pins: pinmux_i2c1_pins {
-+ pinctrl-single,pins = <
-+ 0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda */
-+ 0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_cs0.i2c1_scl */
-+ >;
-+ };
++ i2c1_pins: pinmux_i2c1_pins {
++ pinctrl-single,pins = <
++ 0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda */
++ 0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_cs0.i2c1_scl */
++ >;
++ };
+
- uart0_pins: pinmux_uart0_pins {
- pinctrl-single,pins = <
- 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
+ uart0_pins: pinmux_uart0_pins {
+ pinctrl-single,pins = <
+ 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts
-index 2f64afa94fd6..70127b21a12d 100644
+index 5c42d25..778b80a 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
-@@ -105,3 +105,16 @@
- };
+@@ -84,3 +84,16 @@
+ &rtc {
+ system-power-controller;
};
-
++
+&i2c1 {
+ status = "okay";
+ clock-frequency = <100000>;
@@ -50,7 +52,6 @@ index 2f64afa94fd6..70127b21a12d 100644
+ reg = <0x52>;
+ };
+};
-+
--
-1.8.3.2
+2.1.0
diff --git a/labs/buildroot-rootfs/buildroot-rootfs.tex b/labs/buildroot-rootfs/buildroot-rootfs.tex
index f91ac7c..4495d82 100644
--- a/labs/buildroot-rootfs/buildroot-rootfs.tex
+++ b/labs/buildroot-rootfs/buildroot-rootfs.tex
@@ -143,6 +143,71 @@ default.
\section{Linux kernel customization}
+Now, we would like to connect an additional peripheral to our system:
+the {\em Wii Nunchuk}. Using this custom peripheral requires adding a
+new driver to the Linux kernel, making changes to the Device Tree
+describing the hardware, and changing the kernel configuration. This
+is the purpose of this section.
+
+We will first create a new directory to store our kernel patches. It
+will sit next to our {\em rootfs overlay} in our project-specific
+directory:
+
+\begin{verbatim}
+mkdir board/felabs/beagleboneblack/linux-patches/
+\end{verbatim}
+
+Copy in this directory the two patches that we provided with the data
+of this lab, in \code{$HOME/felabs/buildroot-rootfs/}, but change
+their name so that their start with \code{linux-}\footnote{Note: this
+ renaming will no longer be necessary starting from Buildroot
+ 2015.05, all \code{*.patch} files will be applied.}:
+
+\begin{verbatim}
+cp $HOME/felabs/buildroot-rootfs/0001-.....patch \
+ board/felabs/beagleboneblack/linux-patches/linux-0001-.....patch
+cp $HOME/felabs/buildroot-rootfs/0002-.....patch \
+ board/felabs/beagleboneblack/linux-patches/linux-0002-.....patch
+\end{verbatim}
+
+The first patch adds the driver, the second patch adjusts the Device
+Tree. Feel free to look at them. If you're interested, you can look at
+our training course {\em Embedded Linux kernel driver development},
+which precisely covers the development of this driver.
+
+Now, we need to tell Buildroot to apply these patches before building
+the kernel. To do so, run \code{menuconfig}, go the to the {\em
+Kernel} menu, and adjust the \code{Custom kernel patches} variable to
+\code{board/felabs/beagleboneblack/linux-patches/}.
+
+Let's now clean up completely the \code{linux} package so that its
+sources will be re-extracted and our patches applied the next time we
+do a build:
+
+\begin{verbatim}
+make linux-dirclean
+\end{verbatim}
+
+If you check in \code{output/build/}, the \code{linux-4.0} directory
+will have disappeared.
+
+Now, we need to adjust our kernel configuration to enable the {\em Wii
+Nunchuk} driver. To start the Linux kernel configuration tool, run:
+
+\begin{verbatim}
+make linux-menuconfig
+\end{verbatim}
+
+This will:
+
+\begin{itemize}
+\item Extract the Linux kernel sources
+\item Apply our two patches
+\item Load the default kernel configuration
+ \code{omap2plus_defconfig}, as we specified in the previous lab
+\item Start the kernel \code{menuconfig} tool
+\end{itemize}
+
\section{Add and use {\em input-tools}}
\section{Generate a {\em defconfig}}
More information about the training-materials-updates
mailing list