From 857f2cbda336ac4122033b9e9f6ddb92b18559a9 Mon Sep 17 00:00:00 2001 From: Qiyang Sun <qs2g22@soton.ac.uk> Date: Fri, 2 Aug 2024 15:17:51 +0100 Subject: [PATCH] Update fastinit, add GPIO support --- recipes-bsp/bootfiles/rpi-cmdline.bbappend | 1 + recipes-core/fastinit/fastinit.bb | 2 ++ recipes-core/fastinit/files/fastinit.sh | 5 ++++- recipes-core/images/mar-image-minimal.bb | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/recipes-bsp/bootfiles/rpi-cmdline.bbappend b/recipes-bsp/bootfiles/rpi-cmdline.bbappend index 5228eea..edd3908 100644 --- a/recipes-bsp/bootfiles/rpi-cmdline.bbappend +++ b/recipes-bsp/bootfiles/rpi-cmdline.bbappend @@ -5,3 +5,4 @@ CMDLINE:append = " modules.load=dwc2,g_serial" CMDLINE:append = " earlycon=uart8250,mmio32,0x20215040" #CMDLINE:append = " earlycon=pl011,mmio32,0x20201000" +CMDLINE:append = " init=/usr/sbin/fastinit.sh 1" diff --git a/recipes-core/fastinit/fastinit.bb b/recipes-core/fastinit/fastinit.bb index 1d97a8d..035bea3 100644 --- a/recipes-core/fastinit/fastinit.bb +++ b/recipes-core/fastinit/fastinit.bb @@ -3,6 +3,8 @@ LICENSE = "CLOSED" SRC_URI = "file://fastinit.sh" +DEPENDS = "libgpiod" + S = "${WORKDIR}" do_install() { diff --git a/recipes-core/fastinit/files/fastinit.sh b/recipes-core/fastinit/files/fastinit.sh index 059a909..c05cafa 100755 --- a/recipes-core/fastinit/files/fastinit.sh +++ b/recipes-core/fastinit/files/fastinit.sh @@ -25,10 +25,12 @@ level_one() { mount -t sysfs sysfs /sys mount -o ro /dev/mmcblk0p1 /boot + log_to_kernel "setting gpio 23 to high" + /usr/bin/gpioset -c 0 23=1 & + log_to_kernel "getting teletypes on ttyS0" /sbin/getty -L 115200 ttyS0 vt100 } - level_five() { exec /sbin/init 5 } @@ -51,6 +53,7 @@ else ;; 1) log_to_kernel "entering runlevel 1 (minimal)" + log_to_kernel "runlevel 1: tty, serial, gpio" level_one ;; 5) diff --git a/recipes-core/images/mar-image-minimal.bb b/recipes-core/images/mar-image-minimal.bb index 30a2700..2582ff4 100644 --- a/recipes-core/images/mar-image-minimal.bb +++ b/recipes-core/images/mar-image-minimal.bb @@ -6,6 +6,8 @@ IMAGE_INSTALL = "packagegroup-core-boot \ python3-pyserial \ screen \ usb-modeswitch \ + libgpiod \ + libgpiod-tools \ fastinit \ serial-usb \ ${CORE_IMAGE_EXTRA_INSTALL}" -- GitLab