leds: move documentation to readme, broken on -M virt

This commit is contained in:
Ciro Santilli
2018-05-22 08:16:33 +01:00
parent 207306fa31
commit 8916262327
3 changed files with 57 additions and 47 deletions

View File

@@ -3557,7 +3557,7 @@ Looks like a recompile is needed to modify the image...
=== 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.
TODO: broken. 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
@@ -3585,6 +3585,50 @@ Buildroot's Linux tools package provides some GPIO CLI tools: `lsgpio`, `gpio-ev
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.
=== LEDs
TODO: broken when `arm` moved to `-M virt`, same as <<gpio>>.
Try hacking QEMU's `hw/misc/arm_sysctl.c` with a printf:
....
static void arm_sysctl_write(void *opaque, hwaddr offset,
uint64_t val, unsigned size)
{
arm_sysctl_state *s = (arm_sysctl_state *)opaque;
switch (offset) {
case 0x08: /* LED */
printf("LED val = %llx\n", (unsigned long long)val);
....
and then rebuild with:
....
./build -aa -c kernel_config_fragment/leds -lq
....
But beware that one of the LEDs has a heartbeat trigger by default (specified on dts), so it will produce a lot of output.
And then activate it with:
....
cd /sys/class/leds/versatile:0
cat max_brightness
echo 255 >brightness
....
Relevant QEMU files:
* `hw/arm/versatilepb.c`
* `hw/misc/arm_sysctl.c`
Relevant kernel files:
* `arch/arm/boot/dts/versatile-pb.dts`
* `drivers/leds/led-class.c`
* `drivers/leds/leds-sysctl.c`
=== Linux kernel hardening
Make it harder to get hacked and easier to notice that you were, at the cost of some (small?) runtime overhead.

View File

@@ -130,52 +130,6 @@ CONFIG_UIO_PCI_GENERIC=m
## ARM
# LEDs:
#
# cd /sys/class/leds/versatile:0
# cat max_brightness
# echo 255 >brightness
#
# https://raspberrypi.stackexchange.com/questions/697/how-do-i-control-the-system-leds-using-my-software
#
# Relevant QEMU files:
#
# - hw/arm/versatilepb.c
# - hw/misc/arm_sysctl.c
#
# Relevant kernel files:
#
# - arch/arm/boot/dts/versatile-pb.dts
# - drivers/leds/led-class.c
# - drivers/leds/leds-sysctl.c
#
# Try hacking QEMU's `hw/misc/arm_sysctl.c` with a printf:
#
# static void arm_sysctl_write(void *opaque, hwaddr offset,
# uint64_t val, unsigned size)
# {
# arm_sysctl_state *s = (arm_sysctl_state *)opaque;
#
# switch (offset) {
# case 0x08: /* LED */
# printf("LED val = %llx\n", (unsigned long long)val);
#
# 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.
#
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=y
CONFIG_LEDS_SYSCON=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_ONESHOT=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_NEW_LEDS=y
# Like CONFIG_X86_PTDUMP for ARM.
CONFIG_ARM64_PTDUMP=y

View File

@@ -0,0 +1,12 @@
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=y
CONFIG_LEDS_SYSCON=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_ONESHOT=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_NEW_LEDS=y