mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 12:04:27 +01:00
gpio: move documentation to README, document that it broke on -M virt
This commit is contained in:
30
README.adoc
30
README.adoc
@@ -3555,6 +3555,36 @@ Looks like a recompile is needed to modify the image...
|
|||||||
* https://superuser.com/questions/736423/changing-kernel-bootsplash-image
|
* https://superuser.com/questions/736423/changing-kernel-bootsplash-image
|
||||||
* https://unix.stackexchange.com/questions/153975/how-to-change-boot-logo-in-linux-mint
|
* https://unix.stackexchange.com/questions/153975/how-to-change-boot-logo-in-linux-mint
|
||||||
|
|
||||||
|
=== GPIO
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
The best you can do is to hack our link:build[] script to add:
|
||||||
|
|
||||||
|
....
|
||||||
|
HOST_QEMU_OPTS='--extra-cflags=-DDEBUG_PL061=1'
|
||||||
|
....
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Then compile with:
|
||||||
|
|
||||||
|
....
|
||||||
|
./build -aa -b br2_gpio -c kernel_config_fragment/gpio -l
|
||||||
|
....
|
||||||
|
|
||||||
|
then test it out with:
|
||||||
|
|
||||||
|
....
|
||||||
|
/gpio.sh
|
||||||
|
....
|
||||||
|
|
||||||
|
Buildroot's Linux tools package provides some GPIO CLI tools: `lsgpio`, `gpio-event-mon`, `gpio-hammer`, TODO document them here.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
=== Linux kernel hardening
|
=== Linux kernel hardening
|
||||||
|
|
||||||
Make it harder to get hacked and easier to notice that you were, at the cost of some (small?) runtime overhead.
|
Make it harder to get hacked and easier to notice that you were, at the cost of some (small?) runtime overhead.
|
||||||
|
|||||||
6
br2
6
br2
@@ -62,12 +62,6 @@ BR2_PTHREAD_DEBUG=y
|
|||||||
# ftrace
|
# ftrace
|
||||||
BR2_PACKAGE_TRACE_CMD=y
|
BR2_PACKAGE_TRACE_CMD=y
|
||||||
|
|
||||||
# GPIO: lsgpio, gpio-event-mon, gpio-hammer
|
|
||||||
# Breask MIPS build in 2017-02:
|
|
||||||
# https://bugs.busybox.net/show_bug.cgi?id=10276
|
|
||||||
BR2_PACKAGE_LINUX_TOOLS=y
|
|
||||||
BR2_PACKAGE_LINUX_TOOLS_GPIO=y
|
|
||||||
|
|
||||||
# DTC
|
# DTC
|
||||||
BR2_PACKAGE_DTC=y
|
BR2_PACKAGE_DTC=y
|
||||||
BR2_PACKAGE_DTC_PROGRAMS=y
|
BR2_PACKAGE_DTC_PROGRAMS=y
|
||||||
|
|||||||
2
br2_gpio
Normal file
2
br2_gpio
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
BR2_PACKAGE_LINUX_TOOLS=y
|
||||||
|
BR2_PACKAGE_LINUX_TOOLS_GPIO=y
|
||||||
8
build
8
build
@@ -160,14 +160,12 @@ BR2_ROOTFS_POST_SCRIPT_ARGS=\"${post_script_args}\"
|
|||||||
touch "${kernel_config_fragment_dir}/min"
|
touch "${kernel_config_fragment_dir}/min"
|
||||||
fi
|
fi
|
||||||
if [ "$arch" = 'mips64' ]; then
|
if [ "$arch" = 'mips64' ]; then
|
||||||
# Workaround for:
|
# Workaround for: https://bugs.busybox.net/show_bug.cgi?id=10276
|
||||||
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
|
|
||||||
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
|
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
|
||||||
fi
|
fi
|
||||||
make O="$buildroot_out_dir" olddefconfig
|
make O="$buildroot_out_dir" olddefconfig
|
||||||
if [ "$arch" = 'mips64' ]; then
|
if [ "$arch" = 'mips64' ]; then
|
||||||
# Workaround for:
|
# Workaround for: https://bugs.busybox.net/show_bug.cgi?id=10276
|
||||||
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
|
|
||||||
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
|
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "$config_file"
|
||||||
fi
|
fi
|
||||||
make O="$buildroot_out_dir" olddefconfig
|
make O="$buildroot_out_dir" olddefconfig
|
||||||
@@ -192,7 +190,7 @@ env \\
|
|||||||
-u LD_LIBRARY_PATH \\
|
-u LD_LIBRARY_PATH \\
|
||||||
make \\
|
make \\
|
||||||
O='${buildroot_out_dir}' \\
|
O='${buildroot_out_dir}' \\
|
||||||
HOST_QEMU_OPTS='--enable-debug --extra-cflags=-DDEBUG_PL061=1 --enable-trace-backends=simple ${qemu_sdl}' \\
|
HOST_QEMU_OPTS='--enable-debug --enable-trace-backends=simple ${qemu_sdl}' \\
|
||||||
V='${v}' \\
|
V='${v}' \\
|
||||||
${extra_make_args} \
|
${extra_make_args} \
|
||||||
all \\
|
all \\
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ CONFIG_VIRTIO_NET=y
|
|||||||
# Misc
|
# Misc
|
||||||
CONFIG_DUMMY_IRQ=m
|
CONFIG_DUMMY_IRQ=m
|
||||||
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
|
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
|
||||||
|
# Requirement for LOGO.
|
||||||
|
CONFIG_FB=y
|
||||||
CONFIG_LOGO=y
|
CONFIG_LOGO=y
|
||||||
|
|
||||||
## Networking
|
## Networking
|
||||||
@@ -158,8 +160,9 @@ CONFIG_UIO_PCI_GENERIC=m
|
|||||||
# case 0x08: /* LED */
|
# case 0x08: /* LED */
|
||||||
# printf("LED val = %llx\n", (unsigned long long)val);
|
# printf("LED val = %llx\n", (unsigned long long)val);
|
||||||
#
|
#
|
||||||
# to obeserve when the callback is made. But beware that one of the LEDs
|
# to observe when the callback is made. But beware that one of the LEDs
|
||||||
# has a heartbeat trigger by default (specified on dts), so it will produce a lot of output.
|
# has a heartbeat trigger by default (specified on dts), so it will produce a lot of output.
|
||||||
|
#
|
||||||
CONFIG_LEDS_CLASS=y
|
CONFIG_LEDS_CLASS=y
|
||||||
CONFIG_LEDS_CLASS_FLASH=y
|
CONFIG_LEDS_CLASS_FLASH=y
|
||||||
CONFIG_LEDS_SYSCON=y
|
CONFIG_LEDS_SYSCON=y
|
||||||
@@ -173,12 +176,6 @@ CONFIG_LEDS_TRIGGER_ONESHOT=y
|
|||||||
CONFIG_LEDS_TRIGGER_TIMER=y
|
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||||
CONFIG_NEW_LEDS=y
|
CONFIG_NEW_LEDS=y
|
||||||
|
|
||||||
# GPIO
|
|
||||||
CONFIG_ARM_AMBA=y
|
|
||||||
CONFIG_GPIOLIB=y
|
|
||||||
CONFIG_GPIO_SYSFS=y
|
|
||||||
CONFIG_GPIO_PL061=y
|
|
||||||
|
|
||||||
# Like CONFIG_X86_PTDUMP for ARM.
|
# Like CONFIG_X86_PTDUMP for ARM.
|
||||||
CONFIG_ARM64_PTDUMP=y
|
CONFIG_ARM64_PTDUMP=y
|
||||||
|
|
||||||
|
|||||||
4
kernel_config_fragment/gpio
Normal file
4
kernel_config_fragment/gpio
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
CONFIG_ARM_AMBA=y
|
||||||
|
CONFIG_GPIOLIB=y
|
||||||
|
CONFIG_GPIO_SYSFS=y
|
||||||
|
CONFIG_GPIO_PL061=y
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ARM only.
|
|
||||||
# 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
|
|
||||||
set -e
|
set -e
|
||||||
cd /sys/class/gpio
|
cd /sys/class/gpio
|
||||||
echo 480 > export
|
echo 480 > export
|
||||||
|
|||||||
Reference in New Issue
Block a user