The following patch adds support for the PC Engines APU2 board within the x86_64 target. Currently this patch relies on the beep package, which is in review at http://lists.infradead.org/pipermail/lede- dev/2016-October/003455.html
The changes are as follows: - Enable the LED driver in the kernel config so it is available during boot. Note that this driver does use DMI, so it will only load on the APU2 board. - Enable DEVMEM within the kernel config for use with the flashrom package. - Add userspace support for LEDs & reset button, as well as the default network config. Signed-off-by: Chris Blake <chrisrblak...@gmail.com> --- target/linux/x86/64/config-default | 2 ++ target/linux/x86/64/profiles/001-PCEngines.mk | 21 ++++++++++++ target/linux/x86/base-files/etc/board.d/01_leds | 22 +++++++++++++ target/linux/x86/base-files/etc/board.d/02_network | 26 +++++++++++++++ target/linux/x86/base-files/etc/diag.sh | 37 ++++++++++++++++++++++ target/linux/x86/base-files/lib/x86.sh | 13 ++++++++ 6 files changed, 121 insertions(+) create mode 100644 target/linux/x86/64/profiles/001-PCEngines.mk create mode 100755 target/linux/x86/base-files/etc/board.d/01_leds create mode 100755 target/linux/x86/base-files/etc/board.d/02_network create mode 100755 target/linux/x86/base-files/etc/diag.sh create mode 100755 target/linux/x86/base-files/lib/x86.sh diff --git a/target/linux/x86/64/config-default b/target/linux/x86/64/config-default index 609ff2d..7b8f4f3 100644 --- a/target/linux/x86/64/config-default +++ b/target/linux/x86/64/config-default @@ -76,6 +76,7 @@ CONFIG_CRYPTO_CRCT10DIF=y # CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set # CONFIG_CRYPTO_TWOFISH_X86_64 is not set # CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set +CONFIG_DEVMEM=y # CONFIG_EFI is not set CONFIG_FB=y CONFIG_FB_CMDLINE=y @@ -145,6 +146,7 @@ CONFIG_ITCO_WDT=y # CONFIG_KVM_DEBUG_FS is not set CONFIG_KVM_GUEST=y # CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_LEDS_APU2=y # CONFIG_LEGACY_VSYSCALL_EMULATE is not set # CONFIG_LEGACY_VSYSCALL_NATIVE is not set CONFIG_LEGACY_VSYSCALL_NONE=y diff --git a/target/linux/x86/64/profiles/001-PCEngines.mk b/target/linux/x86/64/profiles/001-PCEngines.mk new file mode 100644 index 0000000..8f416de --- /dev/null +++ b/target/linux/x86/64/profiles/001-PCEngines.mk @@ -0,0 +1,21 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/APU2 + NAME:=PC Engines APU2 + PACKAGES:=beep flashrom libsensors lm-sensors usbutils wpad-mini \ + kmod-ath9k kmod-ath10k kmod-gpio-button-hotplug kmod-gpio-nct5104d \ + kmod-hwmon-core kmod-hwmon-k10temp kmod-leds-gpio kmod-pcspkr \ + kmod-sound-core kmod-sp5100_tco kmod-usb-core kmod-usb-ohci \ + kmod-usb2 kmod-usb3 \ + -kmod-e1000e -kmod-e1000 -kmod-r8169 +endef + +define Profile/APU2/Description + PC Engines APU2 Embedded Board +endef +$(eval $(call Profile,APU2)) diff --git a/target/linux/x86/base-files/etc/board.d/01_leds b/target/linux/x86/base-files/etc/board.d/01_leds new file mode 100755 index 0000000..1cd83e3 --- /dev/null +++ b/target/linux/x86/base-files/etc/board.d/01_leds @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (C) 2016 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/x86.sh + +board_config_update + +board=$(x86_board_name) + +case "$board" in +pc-engines-apu2) + ucidef_set_led_wlan "wlan0" "WLAN0" "apu2:green:led2" "phy0tpt" + ucidef_set_led_wlan "wlan1" "WLAN1" "apu2:green:led3" "phy1tpt" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network new file mode 100755 index 0000000..f0e23f3 --- /dev/null +++ b/target/linux/x86/base-files/etc/board.d/02_network @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Copyright (C) 2016 OpenWrt.org +# + +. /lib/functions/system.sh +. /lib/functions/uci-defaults.sh +. /lib/x86.sh + +board_config_update + +board=$(x86_board_name) + +case "$board" in +pc-engines-apu2) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_set_interface_raw "opt" "eth2" + ;; +*) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/x86/base-files/etc/diag.sh b/target/linux/x86/base-files/etc/diag.sh new file mode 100755 index 0000000..27e150d --- /dev/null +++ b/target/linux/x86/base-files/etc/diag.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Copyright (C) 2016 OpenWrt.org +# + +. /lib/functions/leds.sh +. /lib/x86.sh + +get_status_led() { + case $(x86_board_name) in + pc-engines-apu2) + status_led="apu2:green:power" + ;; + esac +} + +set_state() { + get_status_led + + case "$1" in + preinit) + status_led_blink_preinit + ;; + + failsafe) + status_led_blink_failsafe + ;; + + preinit_regular) + status_led_blink_preinit_regular + ;; + + done) + status_led_on + ;; + esac +} diff --git a/target/linux/x86/base-files/lib/x86.sh b/target/linux/x86/base-files/lib/x86.sh new file mode 100755 index 0000000..53464b6 --- /dev/null +++ b/target/linux/x86/base-files/lib/x86.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Copyright (C) 2016 OpenWrt.org +# + +x86_board_name() { + local name + + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" +} -- 2.7.4 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev