Skip to content

Commit 207306f

Browse files
committed
gpio: move documentation to README, document that it broke on -M virt
1 parent 26ecfac commit 207306f

File tree

7 files changed

+43
-20
lines changed

7 files changed

+43
-20
lines changed

README.adoc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3555,6 +3555,36 @@ Looks like a recompile is needed to modify the image...
35553555
* https://superuser.com/questions/736423/changing-kernel-bootsplash-image
35563556
* https://unix.stackexchange.com/questions/153975/how-to-change-boot-logo-in-linux-mint
35573557

3558+
=== GPIO
3559+
3560+
TODO: this was working before we moved `arm` from `-M versatilepb` to `-M virt` around af210a76711b7fa4554dcc2abd0ddacfc810dfd4. Either make it work on `-M virt` if that is possible, or document precisely how to make it work with `versatilepb`, or hopefully `vexpress` which is newer.
3561+
3562+
QEMU does not have a very nice mechanism to observe GPIO activity: https://raspberrypi.stackexchange.com/questions/56373/is-it-possible-to-get-the-state-of-the-leds-and-gpios-in-a-qemu-emulation-like-t/69267#69267
3563+
3564+
The best you can do is to hack our link:build[] script to add:
3565+
3566+
....
3567+
HOST_QEMU_OPTS='--extra-cflags=-DDEBUG_PL061=1'
3568+
....
3569+
3570+
where link:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0190b/index.html[PL061] is the dominating ARM Holdings hardware that handles GPIO.
3571+
3572+
Then compile with:
3573+
3574+
....
3575+
./build -aa -b br2_gpio -c kernel_config_fragment/gpio -l
3576+
....
3577+
3578+
then test it out with:
3579+
3580+
....
3581+
/gpio.sh
3582+
....
3583+
3584+
Buildroot's Linux tools package provides some GPIO CLI tools: `lsgpio`, `gpio-event-mon`, `gpio-hammer`, TODO document them here.
3585+
3586+
Those broke MIPS build in 2017-02: https://bugs.busybox.net/show_bug.cgi?id=10276 and so we force disable them in our MIPS build currently.
3587+
35583588
=== Linux kernel hardening
35593589

35603590
Make it harder to get hacked and easier to notice that you were, at the cost of some (small?) runtime overhead.

br2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ BR2_PTHREAD_DEBUG=y
6262
# ftrace
6363
BR2_PACKAGE_TRACE_CMD=y
6464

65-
# GPIO: lsgpio, gpio-event-mon, gpio-hammer
66-
# Breask MIPS build in 2017-02:
67-
# https://bugs.busybox.net/show_bug.cgi?id=10276
68-
BR2_PACKAGE_LINUX_TOOLS=y
69-
BR2_PACKAGE_LINUX_TOOLS_GPIO=y
70-
7165
# DTC
7266
BR2_PACKAGE_DTC=y
7367
BR2_PACKAGE_DTC_PROGRAMS=y

br2_gpio

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BR2_PACKAGE_LINUX_TOOLS=y
2+
BR2_PACKAGE_LINUX_TOOLS_GPIO=y

build

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,12 @@ BR2_ROOTFS_POST_SCRIPT_ARGS=\"${post_script_args}\"
160160
touch "${kernel_config_fragment_dir}/min"
161161
fi
162162
if [ "$arch" = 'mips64' ]; then
163-
# Workaround for:
164-
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
163+
# Workaround for: https://bugs.busybox.net/show_bug.cgi?id=10276
165164
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
166165
fi
167166
make O="$buildroot_out_dir" olddefconfig
168167
if [ "$arch" = 'mips64' ]; then
169-
# Workaround for:
170-
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
168+
# Workaround for: https://bugs.busybox.net/show_bug.cgi?id=10276
171169
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
172170
fi
173171
make O="$buildroot_out_dir" olddefconfig
@@ -192,7 +190,7 @@ env \\
192190
-u LD_LIBRARY_PATH \\
193191
make \\
194192
O='${buildroot_out_dir}' \\
195-
HOST_QEMU_OPTS='--enable-debug --extra-cflags=-DDEBUG_PL061=1 --enable-trace-backends=simple ${qemu_sdl}' \\
193+
HOST_QEMU_OPTS='--enable-debug --enable-trace-backends=simple ${qemu_sdl}' \\
196194
V='${v}' \\
197195
${extra_make_args} \
198196
all \\

kernel_config_fragment/default

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ CONFIG_VIRTIO_NET=y
7979
# Misc
8080
CONFIG_DUMMY_IRQ=m
8181
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
82+
# Requirement for LOGO.
83+
CONFIG_FB=y
8284
CONFIG_LOGO=y
8385

8486
## Networking
@@ -158,8 +160,9 @@ CONFIG_UIO_PCI_GENERIC=m
158160
# case 0x08: /* LED */
159161
# printf("LED val = %llx\n", (unsigned long long)val);
160162
#
161-
# to obeserve when the callback is made. But beware that one of the LEDs
163+
# to observe when the callback is made. But beware that one of the LEDs
162164
# has a heartbeat trigger by default (specified on dts), so it will produce a lot of output.
165+
#
163166
CONFIG_LEDS_CLASS=y
164167
CONFIG_LEDS_CLASS_FLASH=y
165168
CONFIG_LEDS_SYSCON=y
@@ -173,12 +176,6 @@ CONFIG_LEDS_TRIGGER_ONESHOT=y
173176
CONFIG_LEDS_TRIGGER_TIMER=y
174177
CONFIG_NEW_LEDS=y
175178

176-
# GPIO
177-
CONFIG_ARM_AMBA=y
178-
CONFIG_GPIOLIB=y
179-
CONFIG_GPIO_SYSFS=y
180-
CONFIG_GPIO_PL061=y
181-
182179
# Like CONFIG_X86_PTDUMP for ARM.
183180
CONFIG_ARM64_PTDUMP=y
184181

kernel_config_fragment/gpio

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_ARM_AMBA=y
2+
CONFIG_GPIOLIB=y
3+
CONFIG_GPIO_SYSFS=y
4+
CONFIG_GPIO_PL061=y

rootfs_overlay/gpio.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/bin/sh
2-
# ARM only.
3-
# https://raspberrypi.stackexchange.com/questions/56373/is-it-possible-to-get-the-state-of-the-leds-and-gpios-in-a-qemu-emulation-like-t/69267#69267
42
set -e
53
cd /sys/class/gpio
64
echo 480 > export

0 commit comments

Comments
 (0)