From 4b162b1af1ddc50e8db330e0271af61274f7072f Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 26 Jul 2023 11:24:53 +0800
Subject: [PATCH] Update packagegroup-misc-utils to add pinctrl
---
recipes-misc/expand-tools/files/expand_rootfs | 0
/dev/null | 15 ---
recipes-misc/wpa-conf/wpa-conf_1.0.bb | 4
recipes-misc/expand-tools/files/pinctrl-igkboard-6ull | 143 +++++++++++++++++++++++++++++++++++
recipes-misc/sshswitch/sshswitch_1.0.bb | 2
recipes-misc/expand-tools/files/pinloop | 42 ++++++++++
recipes-misc/expand-tools/expand-tools_1.0.bb | 21 +++++
recipes-misc/packagegroups/packagegroup-misc-utils.bb | 2
8 files changed, 210 insertions(+), 19 deletions(-)
diff --git a/recipes-misc/expand-rootfs/expand-rootfs_1.0.bb b/recipes-misc/expand-rootfs/expand-rootfs_1.0.bb
deleted file mode 100644
index c79c024..0000000
--- a/recipes-misc/expand-rootfs/expand-rootfs_1.0.bb
+++ /dev/null
@@ -1,15 +0,0 @@
-DESCRIPTION = "Expand rootfs space on MMC"
-
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
-
-FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
-SRC_URI += " file://expand_rootfs "
-FILES_${PN} += "${sbindir}/expand_rootfs"
-
-do_install() {
- install -d ${D}/${sbindir}/
- install -m 0755 ${WORKDIR}/expand_rootfs ${D}/${sbindir}/
-}
-
-RDEPENDS_expand-rootfs = "bash e2fsprogs util-linux"
diff --git a/recipes-misc/expand-tools/expand-tools_1.0.bb b/recipes-misc/expand-tools/expand-tools_1.0.bb
new file mode 100644
index 0000000..997cd22
--- /dev/null
+++ b/recipes-misc/expand-tools/expand-tools_1.0.bb
@@ -0,0 +1,21 @@
+DESCRIPTION = "Expand rootfs space on MMC"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+FILES:${PN} = "${sbindir}"
+SRC_URI = " \
+ file://expand_rootfs \
+ file://pinloop \
+ file://pinctrl-${MACHINE} \
+"
+
+do_install() {
+ install -d ${D}/${sbindir}/
+ install -m 0755 ${WORKDIR}/expand_rootfs ${D}/${sbindir}/
+ install -m 0755 ${WORKDIR}/pinloop ${D}/${sbindir}/
+ install -m 0755 ${WORKDIR}/pinctrl-${MACHINE} ${D}/${sbindir}/pinctrl
+}
+
+RDEPENDS:expand-tools = "bash e2fsprogs util-linux"
diff --git a/recipes-misc/expand-rootfs/files/expand_rootfs b/recipes-misc/expand-tools/files/expand_rootfs
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-misc/expand-rootfs/files/expand_rootfs
rename to recipes-misc/expand-tools/files/expand_rootfs
diff --git a/recipes-misc/expand-tools/files/pinctrl-igkboard-6ull b/recipes-misc/expand-tools/files/pinctrl-igkboard-6ull
new file mode 100755
index 0000000..938a084
--- /dev/null
+++ b/recipes-misc/expand-tools/files/pinctrl-igkboard-6ull
@@ -0,0 +1,143 @@
+# This shell script used to control GPIO port on IGKBoard
+
+direction=out
+sysdir=/sys/class/gpio/
+pinbase=0
+groupin=32
+
+pinnum=
+pindir=
+action=
+
+set -u
+
+# RedLed: GPIO01_IO11 GreenLed: GPIO01_IO10 BlueLed: GPIO05_IO09
+function usage()
+{
+ echo "Show pinmap Usage: $0 [-v]"
+ echo "Output set Usage: $0 GPIO01_IO11 [1/0]"
+ echo "Input read Usage: $0 [-i] GPIO01_IO11"
+ echo "Unexport Usage: $0 [-u] GPIO01_IO11"
+ exit;
+}
+
+function show_pinmap()
+{
+ echo "
++-------------+-------------+---IGKBoard---+-------------+-------------+
+| GPIO | Name | Physical | Name | GPIO |
++-------------+-------------+-----++------+-------------+-------------+
+| 3.3v | 3.3v | 1 || 2 | 5v | 5v |
+| GPIO1_IO03 | I2C1_SDA | 3 || 4 | 5v | 5v |
+| GPIO1_IO02 | I2C1_SCL | 5 || 6 | GND | GND |
+| GPIO1_IO18 | W1 | 7 || 8 | UART2_TX | GPIO1_IO20 |
+| GND | GND | 9 || 10 | UART2_RX | GPIO1_IO21 |
+| GPIO1_IO24 | UART3_TX | 11 || 12 | UART3_RX | GPIO1_IO25 |
+| GPIO1_IO28 | UART4_TX | 13 || 14 | GND | GND |
+| GPIO1_IO29 | UART4_RX | 15 || 16 | UART7_TX | GPIO3_IO21 |
+| 3.3v | 3.3v | 17 || 18 | UART7_RX | GPIO3_IO22 |
+| GPIO3_IO27 | SPI1_MOSI | 19 || 20 | GND | GND |
+| GPIO3_IO28 | SPI1_MISO | 21 || 22 | GPIO | GPIO3_IO23 |
+| GPIO3_IO25 | SPI1_SCLK | 23 || 24 | SPI1_SS0 | GPIO3_IO26 |
+| GND | GND | 25 || 26 | GPIO | GPIO3_IO24 |
+| GPIO1_IO26 | CAN1_TX | 27 || 28 | PWM8 | GPIO1_IO15 |
+| GPIO1_IO27 | CAN1_RX | 29 || 30 | GND | GND |
+| GPIO1_IO22 | CAN2_TX | 31 || 32 | PWM7 | GPIO1_IO14 |
+| GPIO1_IO23 | CAN2_RX | 33 || 34 | GND | GND |
+| GPIO5_IO01 | GPIO | 35 || 36 | GPIO | GPIO1_IO11 |
+| GPIO5_IO08 | GPIO | 37 || 38 | GPIO | GPIO1_IO10 |
+| GND | GND | 39 || 40 | GPIO | GPIO5_IO09 |
++-------------+-------------+---IGKBoard--+-------------+-------------+
+| GPIO | Name | Physical | Name | GPIO |
++-------------+-------------+-----++------+-------------+-------------+
+"
+ exit 0;
+}
+
+function calc_pinum()
+{
+ pinstr=$1
+
+ group=`echo $pinstr | cut -d_ -f1 | tr -cd "[0-9]"`
+ pin=`echo $pinstr | cut -d_ -f2 | tr -cd "[0-9]"`
+
+
+ group=`expr $group \- 1`
+ pinum=`expr $group \* $groupin + $pin + $pinbase`
+ pindir=$sysdir/gpio$pinum
+
+ #echo "INFO: GPIO $pinstr map to pinum[$pinum]"
+}
+
+function export_gpio()
+{
+ if [ -e $pindir ] ; then
+ return ;
+ fi
+
+ echo $pinum > $sysdir/export
+}
+
+function unexport_gpio()
+{
+ if [ ! -e $pindir ] ; then
+ return ;
+ fi
+
+ echo $pinum > $sysdir/unexport
+}
+
+function set_gpio()
+{
+ echo out > $pindir/direction
+ echo $1 > $pindir/value
+}
+
+function read_gpio()
+{
+ echo in > $pindir/direction
+ cat $pindir/value
+}
+
+if [[ $# -lt 1 ]] ; then
+ usage;
+fi
+
+while getopts "iuvh" OPTNAME
+do
+ case "${OPTNAME}" in
+ "i")
+ direction=in
+ shift
+ ;;
+
+ "u")
+ action=unexport;
+ shift
+ ;;
+
+ "v")
+ show_pinmap;
+ shift
+ ;;
+
+ "h")
+ usage;
+ ;;
+ esac
+done
+
+calc_pinum $1
+
+if [[ $action == unexport ]] ; then
+ unexport_gpio
+ exit;
+fi
+
+export_gpio
+
+if [[ $direction == in ]] ; then
+ read_gpio
+else
+ set_gpio $2
+fi
diff --git a/recipes-misc/expand-tools/files/pinloop b/recipes-misc/expand-tools/files/pinloop
new file mode 100755
index 0000000..dbfdc5b
--- /dev/null
+++ b/recipes-misc/expand-tools/files/pinloop
@@ -0,0 +1,42 @@
+#!/bin/sh
+# 40 Pin Header GPIO loop test script, it based on pinctrl shell script
+
+function loop_test()
+{
+ if [[ $# != 3 ]] ; then
+ echo "ERROR: Invalid input arguments"
+ return 1;
+ fi
+
+ level=$3
+ pinctrl $1 $level
+ res=`pinctrl -i $2`
+
+ printf "$1 out [$level] --> $2 in [$res] : "
+ if [[ $level == $res ]] ; then
+ printf " [ OK ]\n"
+ else
+ printf " [ FAIL ]\n"
+ exit 1;
+ fi
+}
+
+
+if [[ $# != 2 ]] ; then
+ echo ""
+ echo "Usage : $0 Pin1 Pin2"
+ echo "Example: $0 GPIO1_IO10 GPIO1_IO11"
+ echo ""
+ echo "You can check pinmap by 'pinctrl -v' "
+ echo ""
+ exit;
+fi
+
+
+loop_test $1 $2 1
+loop_test $1 $2 0
+
+loop_test $2 $1 1
+loop_test $2 $1 0
+
+exit 0;
diff --git a/recipes-misc/packagegroups/packagegroup-misc-utils.bb b/recipes-misc/packagegroups/packagegroup-misc-utils.bb
index 90ca4b8..519c5c0 100644
--- a/recipes-misc/packagegroups/packagegroup-misc-utils.bb
+++ b/recipes-misc/packagegroups/packagegroup-misc-utils.bb
@@ -3,4 +3,4 @@
inherit packagegroup
-RDEPENDS_${PN} = "expand-rootfs sshswitch wpa-conf"
+RDEPENDS:${PN} = "expand-tools sshswitch wpa-conf"
diff --git a/recipes-misc/sshswitch/sshswitch_1.0.bb b/recipes-misc/sshswitch/sshswitch_1.0.bb
index c7686f5..5ae1c6a 100644
--- a/recipes-misc/sshswitch/sshswitch_1.0.bb
+++ b/recipes-misc/sshswitch/sshswitch_1.0.bb
@@ -9,7 +9,7 @@
SYSTEMD_SERVICE_${PN} = "sshswitch.service"
SRC_URI += " file://sshswitch.service "
-FILES_${PN} += "${systemd_unitdir}/system/sshswitch.service"
+FILES:${PN} += "${systemd_unitdir}/system/sshswitch.service"
do_install() {
install -d ${D}/${systemd_unitdir}/system
diff --git a/recipes-misc/wpa-conf/wpa-conf_1.0.bb b/recipes-misc/wpa-conf/wpa-conf_1.0.bb
index ef76751..65a544c 100644
--- a/recipes-misc/wpa-conf/wpa-conf_1.0.bb
+++ b/recipes-misc/wpa-conf/wpa-conf_1.0.bb
@@ -6,10 +6,10 @@
inherit systemd
SYSTEMD_AUTO_ENABLE = "enable"
-SYSTEMD_SERVICE_${PN} = "wpa-conf.service"
+SYSTEMD_SERVICE:${PN} = "wpa-conf.service"
SRC_URI += " file://wpa-conf.service "
-FILES_${PN} += "${systemd_unitdir}/system/wpa-conf.service"
+FILES:${PN} += "${systemd_unitdir}/system/wpa-conf.service"
do_install() {
install -d ${D}/${systemd_unitdir}/system
--
Gitblit v1.9.1