From e30e31fc49c9092848761360d87f1bf51e180fa7 Mon Sep 17 00:00:00 2001 From: Dany LE Date: Wed, 26 Nov 2025 17:57:53 +0100 Subject: [PATCH] Major update: - Switch to Sytemd - Switch to linux 6.12lts - Remove modem power DTS node as it is not compatible with eg25-manager --- conf/layer.conf | 5 +- conf/machine/pinephone.conf | 5 +- recipes-bsp/atf/atf-50i-a64_git.bb | 2 +- .../diya-overlay/diya-overlay.bbappend | 15 ++ recipes-bsp/diya-overlay/files/expandfs | 14 ++ recipes-bsp/diya-overlay/files/firstboot | 0 .../diya-overlay/files/resize2fs.service | 12 ++ recipes-bsp/u-boot/files/boot.cmd | 51 ++---- .../u-boot/files/pinephonefb_defconfig | 74 ++++++++ recipes-bsp/u-boot/u-boot-megous.bb | 6 + .../eg25-manager/eg25-manager_git.bb | 32 +--- recipes-connectivity/eg25-manager/files/eg25d | 77 -------- .../modemmanager/modemmanager_%.bbappend | 1 - .../networkmanager/networkmanager_%.bbappend | 1 - recipes-core/base-files/base-files_%.bbappend | 87 ++++----- recipes-core/images/core-image-base.bbappend | 6 +- ...y.bbapend => core-image-recovery.bbappend} | 1 + ...-dts-pinephone-drop-modem-power-node.patch | 165 ++++++++++++++++++ recipes-kernel/linux/files/defconfig | 2 +- recipes-kernel/linux/linux-megi_6.12.10.bb | 30 ++++ recipes-kernel/linux/linux-megi_6.15.8.bb | 29 +-- recipes-kernel/linux/linux.inc | 24 +++ wic/image.wks.in | 12 +- 23 files changed, 432 insertions(+), 219 deletions(-) create mode 100644 recipes-bsp/diya-overlay/diya-overlay.bbappend create mode 100644 recipes-bsp/diya-overlay/files/expandfs create mode 100644 recipes-bsp/diya-overlay/files/firstboot create mode 100644 recipes-bsp/diya-overlay/files/resize2fs.service create mode 100644 recipes-bsp/u-boot/files/pinephonefb_defconfig delete mode 100644 recipes-connectivity/eg25-manager/files/eg25d delete mode 100644 recipes-connectivity/modemmanager/modemmanager_%.bbappend delete mode 100644 recipes-connectivity/networkmanager/networkmanager_%.bbappend rename recipes-core/images/{core-image-recovery.bbapend => core-image-recovery.bbappend} (83%) create mode 100644 recipes-kernel/linux/files/0001-dts-pinephone-drop-modem-power-node.patch create mode 100644 recipes-kernel/linux/linux-megi_6.12.10.bb diff --git a/conf/layer.conf b/conf/layer.conf index d480948..d2e2a7b 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -15,11 +15,14 @@ LAYERSERIES_COMPAT_meta-pinephone-diya = "walnascar" MACHINE ?= "pinephone" PREFERRED_PROVIDER_virtual/kernel = "linux-megi" -PREFERRED_VERSION_linux-megi = "6.15.8" +PREFERRED_VERSION_linux-megi = "6.12.10" PREFERRED_PROVIDER_virtual/bootloader = "u-boot-megous" PREFERRED_PROVIDER_u-boot = "u-boot-megous" +INITRAMFS_FSTYPES = "cpio.lz4.u-boot" +KERNEL_IMAGETYPE = "Image.gz" + #PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "gcc-cross-${TARGET_ARCH}" #PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "gcc-cross-${TARGET_ARCH}" #PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "gcc-runtime" diff --git a/conf/machine/pinephone.conf b/conf/machine/pinephone.conf index b9fa352..c55dd34 100644 --- a/conf/machine/pinephone.conf +++ b/conf/machine/pinephone.conf @@ -9,13 +9,12 @@ KERNEL_DEVICETREE = "allwinner/sun50i-a64-pinephone-1.0.dtb \ allwinner/sun50i-a64-pinephone-1.2.dtb \ allwinner/sun50i-a64-pinephone-1.2b.dtb \ " -UBOOT_MACHINE = "pinephone_defconfig" SPL_BINARY = "u-boot-sunxi-with-spl.bin" # as for now neither graphics nor audio is supported MACHINE_FEATURES:remove = "x11" -MACHINE_FEATURES:append = "bluetooth wifi" +MACHINE_FEATURES:append = "apm touchscreen keyboard rtc serial screen usbgadget usbhost pic phone vfat bluetooth wifi" MACHINE_EXTRA_RRECOMMENDS = "pinephone-firmware" -SERIAL_CONSOLES = " 115200;ttyS0 " \ No newline at end of file +SERIAL_CONSOLES = "115200;ttyS0" \ No newline at end of file diff --git a/recipes-bsp/atf/atf-50i-a64_git.bb b/recipes-bsp/atf/atf-50i-a64_git.bb index 482301d..2b58de1 100644 --- a/recipes-bsp/atf/atf-50i-a64_git.bb +++ b/recipes-bsp/atf/atf-50i-a64_git.bb @@ -11,7 +11,7 @@ SRCREV = "d3e71ead6ea5bc3555ac90a446efec84ef6c6122" S = "${UNPACKDIR}/git" B = "${WORKDIR}/build" -COMPATIBLE_MACHINE = "(sun50i|sun50i-a64)" +COMPATIBLE_MACHINE = "(sun50i|sun50i-a64|pinephone)" PLATFORM = "sun50i_a64" diff --git a/recipes-bsp/diya-overlay/diya-overlay.bbappend b/recipes-bsp/diya-overlay/diya-overlay.bbappend new file mode 100644 index 0000000..a004edd --- /dev/null +++ b/recipes-bsp/diya-overlay/diya-overlay.bbappend @@ -0,0 +1,15 @@ + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI += " file://resize2fs.service file://firstboot file://expandfs \ + " +inherit systemd +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "resize2fs.service" + +do_install:append () { + install -m 0644 ${UNPACKDIR}/firstboot ${D}${sysconfdir}/firstboot + install -m 0755 ${UNPACKDIR}/expandfs ${D}/usr/sbin/expandfs + install -D -p -m0644 ${UNPACKDIR}/resize2fs.service \ + ${D}${systemd_unitdir}/system/resize2fs.service +} \ No newline at end of file diff --git a/recipes-bsp/diya-overlay/files/expandfs b/recipes-bsp/diya-overlay/files/expandfs new file mode 100644 index 0000000..351c523 --- /dev/null +++ b/recipes-bsp/diya-overlay/files/expandfs @@ -0,0 +1,14 @@ +#! /bin/sh +. /etc/profile +PATH=/sbin:/bin:/usr/sbin:/usr/bin +PARTNO=4 +if [ -z "$DISK" ]; then + DISK="mmcblk0" +fi + +if [ "$(/usr/bin/id -u)" -ne 0 ]; then + echo "$0 shall be run as root" + exit 1 +fi +yes | parted ---pretend-input-tty /dev/mmcblk0 resizepart ${PARTNO} 100% +resize2fs /dev/${DISK}p${PARTNO} \ No newline at end of file diff --git a/recipes-bsp/diya-overlay/files/firstboot b/recipes-bsp/diya-overlay/files/firstboot new file mode 100644 index 0000000..e69de29 diff --git a/recipes-bsp/diya-overlay/files/resize2fs.service b/recipes-bsp/diya-overlay/files/resize2fs.service new file mode 100644 index 0000000..40f0a9a --- /dev/null +++ b/recipes-bsp/diya-overlay/files/resize2fs.service @@ -0,0 +1,12 @@ +[Unit] +Description=Resize home partition +ConditionPathExists=/etc/firstboot + +[Service] +Type=oneshot +ExecStart=/sbin/expandfs +ExecStartPost=rm /etc/firstboot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/recipes-bsp/u-boot/files/boot.cmd b/recipes-bsp/u-boot/files/boot.cmd index 2236e23..882ed65 100644 --- a/recipes-bsp/u-boot/files/boot.cmd +++ b/recipes-bsp/u-boot/files/boot.cmd @@ -2,26 +2,17 @@ setenv load_addr "0x45000000" setenv overlay_error "false" setenv verbosity "1" -setenv rootfstype "ext4" setenv console "both" setenv bootlogo "false" setenv overlay_prefix "sun50i-a64" setenv recovery "false" -setenv recovery_image "recovery.initramfs" - -# Print boot source -if test ${mmc_bootdev} -eq 0; then - echo "Booting from SD device 0" - setenv rootdev "/dev/mmcblk0p2" -else - echo "Booting from eMMC" - setenv rootdev "/dev/mmcblk2p2" -fi +setenv recovery_image "recovery-pinephone.cpio.lz4.u-boot" +setenv kernel = "Image.gz" echo "Boot script loaded from ${devtype}" -echo "Loading environment variables from ${devtype} ${devnum} diya-config.txt" if test -e ${devtype} ${devnum} diya-config.txt; then + echo "Loading environment variables from ${devtype} ${devnum} diya-config.txt" load ${devtype} ${devnum} ${load_addr} diya-config.txt env import -t ${load_addr} ${filesize} fi @@ -34,14 +25,6 @@ else setenv consoleargs "splash=verbose ${consoleargs}" fi -# get PARTUUID of first partition on SD/eMMC it was loaded from -# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from -if test "${devtype}" = "mmc"; then part uuid mmc 0:2 partuuid; fi - -# consoleblank=0 loglevel=${verbosity} -echo "Root dev PARTUUID is ${partuuid}" -setenv bootargs "root=PARTUUID=${partuuid} rootwait rootfstype=${rootfstype} ${consoleargs} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}" - echo "Loading kernel FDT from ${devtype} ${devnum} ${fdtfile}" load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile} @@ -59,24 +42,24 @@ if test "${overlay_error}" = "true"; then load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile} fi -# if test "${ethernet_phy}" = "rtl8211f"; then -# fdt set /soc/ethernet@5020000 allwinner,rx-delay-ps <3100> -# fdt set /soc/ethernet@5020000 allwinner,tx-delay-ps <700> -# fi -# if test "${ethernet_phy}" = "yt8531c"; then -# fdt set /soc/ethernet@5020000 allwinner,rx-delay-ps <0> -# fdt set /soc/ethernet@5020000 allwinner,tx-delay-ps <600> -# fi - -echo "Loading kernel from ${devtype} ${devnum} ${kernel_addr_r} Image" -load ${devtype} ${devnum} ${kernel_addr_r} Image -if test "${recovery}" = "true"; then - echo "Booting Diya in recovery mode" +echo "Loading kernel from ${devtype} ${devnum} ${kernel_comp_addr_r} ${kernel}" +load ${devtype} ${devnum} ${kernel_addr_r} ${kernel} +setenv kernel_comp_size ${filesize} +if test -e ${devtype} ${devnum} enable-recovery-mode; then + echo "Booting Diya in recovery mode with ramdisk at ${devtype} ${devnum} ${ramdisk_addr_r} ${recovery_image}" + fatrm ${devtype} ${devnum} enable-recovery-mode load ${devtype} ${devnum} ${ramdisk_addr_r} ${recovery_image} + setenv bootargs "root=ramfs rootwait ${consoleargs} ${extraargs} ${extraboardargs}" booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} else - echo "Booting Diya" + # get PARTUUID of first partition on SD/eMMC it was loaded from + # mmc 0 is always mapped to device u-boot (2016.09+) was loaded from + if test "${devtype}" = "mmc"; then part uuid mmc 0:2 partuuid; fi + setenv rootfstype "ext4" + echo "Root dev PARTUUID is ${partuuid}" + setenv bootargs "root=PARTUUID=${partuuid} rootwait rootfstype=${rootfstype} ${consoleargs} ${extraargs} ${extraboardargs}" + echo "Booting Diya: ${bootargs}" booti ${kernel_addr_r} - ${fdt_addr_r} fi diff --git a/recipes-bsp/u-boot/files/pinephonefb_defconfig b/recipes-bsp/u-boot/files/pinephonefb_defconfig new file mode 100644 index 0000000..e4b421b --- /dev/null +++ b/recipes-bsp/u-boot/files/pinephonefb_defconfig @@ -0,0 +1,74 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone-1.2" +CONFIG_SPL_DRIVERS_MISC=y +CONFIG_SPL=y +CONFIG_MACH_SUN50I=y +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y +CONFIG_DRAM_CLK=552 +CONFIG_DRAM_ZQ=3881949 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_PINEPHONE_DT_SELECTION=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +# CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2" +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +# +# Fastboot support +# +CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +# CONFIG_UDP_FUNCTION_FASTBOOT is not set +# CONFIG_TCP_FUNCTION_FASTBOOT is not set +CONFIG_FASTBOOT_BUF_ADDR=0x42000000 +CONFIG_FASTBOOT_BUF_SIZE=0x2000000 +CONFIG_FASTBOOT_USB_DEV=0 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_UUU_SUPPORT=y +CONFIG_FASTBOOT_FLASH_MMC=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 +CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y +CONFIG_FASTBOOT_MMC_BOOT1_NAME="mmc0boot0" +CONFIG_FASTBOOT_MMC_BOOT2_NAME="mmc0boot1" +CONFIG_FASTBOOT_MMC_USER_SUPPORT=y +CONFIG_FASTBOOT_MMC_USER_NAME="mmc0" +CONFIG_FASTBOOT_GPT_NAME="gpt" +CONFIG_FASTBOOT_MBR_NAME="mbr" +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FASTBOOT_OEM_RUN=y +CONFIG_FASTBOOT_OEM_BOARD=y +CONFIG_FIRMWARE=y +# CONFIG_SPL_FIRMWARE is not set +# CONFIG_USB_DWC2=y +# CONFIG_USB_DWC3=y +CONFIG_ARM_PSCI_FW=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y + + +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 + +CONFIG_USB_OTG=y +CONFIG_USB_MUSB_HDRC=y +CONFIG_USB_MUSB_SUNXI=y +# CONFIG_USB_MUSB_HCD=y +# CONFIG_USB_MUSB_UDC=y +CONFIG_USB_MUSB_DUAL_ROLE=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_DUAL_ROLE=y +CONFIG_USB_DWC3_OF_SIMPLE=y +CONFIG_USB_DWC2=y +CONFIG_USB_DWC2_DUAL_ROLE=y +CONFIG_USB_BDC_UDC=y + +CONFIG_LED_STATUS=y +CONFIG_LED_STATUS_GPIO=y +CONFIG_LED_STATUS0=y +CONFIG_LED_STATUS_BIT=114 +CONFIG_LED_STATUS_STATE=2 +CONFIG_LEGACY_IMAGE_FORMAT=y \ No newline at end of file diff --git a/recipes-bsp/u-boot/u-boot-megous.bb b/recipes-bsp/u-boot/u-boot-megous.bb index 54a1f11..567d392 100644 --- a/recipes-bsp/u-boot/u-boot-megous.bb +++ b/recipes-bsp/u-boot/u-boot-megous.bb @@ -17,10 +17,12 @@ COMPATIBLE_MACHINE = "(sun50i|sun50i-a64|pinephone)" DEFAULT_PREFERENCE:sun50i = "1" DEFAULT_PREFERENCE:pinephone="1" +UBOOT_MACHINE = "pinephonefb_defconfig" SRC_URI = " \ git://git.iohub.dev/dany/u-boot-megous.git;protocol=https;branch=megi-v2025.01 \ file://boot.cmd \ + file://pinephonefb_defconfig \ " PE = "1" @@ -43,6 +45,10 @@ EXTRA_OEMAKE:append = " BL31=${DEPLOY_DIR_IMAGE}/bl31.bin SCP=/dev/null" do_compile[depends] += "atf-50i-a64:do_install" +do_configure:prepend() { + cp ${UNPACKDIR}/pinephonefb_defconfig ${S}/configs/pinephonefb_defconfig +} + do_configure() { oe_runmake ${UBOOT_MACHINE} # oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} mrproper diff --git a/recipes-connectivity/eg25-manager/eg25-manager_git.bb b/recipes-connectivity/eg25-manager/eg25-manager_git.bb index 0241809..0c75eb9 100644 --- a/recipes-connectivity/eg25-manager/eg25-manager_git.bb +++ b/recipes-connectivity/eg25-manager/eg25-manager_git.bb @@ -3,38 +3,18 @@ DEPENDS = "glib-2.0" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -SRC_URI += "git://git.iohub.dev/dany/eg25-manager.git;protocol=https;branch=master \ - file://eg25d" +SRC_URI += "git://git.iohub.dev/dany/eg25-manager.git;protocol=https;branch=master;tag=0.5.2" -SRCREV = "${AUTOREV}" +# SRCREV = "${AUTOREV}" PV = "0.5.2+git${SRCPV}" S = "${UNPACKDIR}/git" DEPENDS:append = " libgudev libgpiod libusb curl modemmanager " inherit meson pkgconfig - -# inherit update-rc.d -# INITSCRIPT_NAME = "diya-sessiond" -# INITSCRIPT_PARAMS = "start 30 5 . stop 10 0 1 6 ." +inherit systemd +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "eg25-manager.service" -do_install:append() { - install -d ${D}/etc/init.d - install -m 0755 ${UNPACKDIR}/eg25d ${D}/etc/init.d/ - install -d ${D}/etc/udev/ - install -d ${D}/etc/udev/rules.d - mv ${D}/usr/lib/udev/rules.d/80-modem-eg25.rules ${D}/etc/udev/rules.d/ - rm ${D}/usr/lib/systemd/system/eg25-manager.service - rm -rf ${D}/usr/lib/systemd - - install -d ${D}/etc/eg25-manager/ - mv ${D}/usr/share/eg25-manager/* ${D}/etc/eg25-manager/ - rm -rf ${D}/usr/share - rm -rf ${D}/usr/lib -} - -FILES:${PN} = " /etc/init.d/eg25d \ - /etc/eg25-manager \ - /etc/udev/rules.d/80-modem-eg25.rules \ - /usr/bin/eg25-manager " \ No newline at end of file +# FILES:${PN} = " " \ No newline at end of file diff --git a/recipes-connectivity/eg25-manager/files/eg25d b/recipes-connectivity/eg25-manager/files/eg25d deleted file mode 100644 index ee3d5a1..0000000 --- a/recipes-connectivity/eg25-manager/files/eg25d +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: diya -# Short-Description: EG25 manager daemon -# Description: eg25-manager - Quectel EG25 management daemon -### END INIT INFO -# -# -*- coding: utf-8 -*- - -# set -e - -# shellcheck disable=SC1091 -. /etc/init.d/functions - -DAEMON=/usr/bin/eg25-manager -NAME=eg25d -PIDFILE=/var/run/diya/eg25d.pid -DESC="EG25 manager daemon" -DAEMONUSER="root" -PARAMS= -test -x $DAEMON || exit 0 - -start_it_up() -{ - mkdir -p "$(dirname $PIDFILE)" - if [ -e $PIDFILE ]; then - PIDDIR=/proc/$(cat $PIDFILE) - if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then - echo "$DESC already started; not starting." - else - echo "Removing stale PID file $PIDFILE." - rm -f $PIDFILE - fi - fi - - echo -n "Starting $DESC: " - start-stop-daemon -o --start --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER --exec $DAEMON -- $PARAMS - echo "$NAME." -} - -shut_it_down() -{ - echo -n "Stopping $DESC: " - start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER - # We no longer include these arguments so that start-stop-daemon - # can do its job even given that we may have been upgraded. - # We rely on the pidfile being sanely managed - # --exec $DAEMON -- --system $PARAMS - echo "$NAME." - rm -f $PIDFILE -} - -case "$1" in - start) - start_it_up - ;; - stop) - shut_it_down - ;; - status) - status $DAEMON - exit $? - ;; - restart) - shut_it_down - sleep 1 - start_it_up - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|status|restart}" >&2 - exit 1 - ;; -esac - -exit 0 \ No newline at end of file diff --git a/recipes-connectivity/modemmanager/modemmanager_%.bbappend b/recipes-connectivity/modemmanager/modemmanager_%.bbappend deleted file mode 100644 index 844b699..0000000 --- a/recipes-connectivity/modemmanager/modemmanager_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -PACKAGECONFIG:remove =" systemd " \ No newline at end of file diff --git a/recipes-connectivity/networkmanager/networkmanager_%.bbappend b/recipes-connectivity/networkmanager/networkmanager_%.bbappend deleted file mode 100644 index c3ced15..0000000 --- a/recipes-connectivity/networkmanager/networkmanager_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -PACKAGECONFIG:append = " modemmanager ppp wifi dhcpcd iwd resolvconf nmtui wwan " \ No newline at end of file diff --git a/recipes-core/base-files/base-files_%.bbappend b/recipes-core/base-files/base-files_%.bbappend index 430b621..8f180de 100644 --- a/recipes-core/base-files/base-files_%.bbappend +++ b/recipes-core/base-files/base-files_%.bbappend @@ -1,49 +1,56 @@ hostname = "diya" -do_install:append () { +do_install:append:pinephone () { + install -d ${DEPLOY_DIR_IMAGE} + cat << EOF > ${DEPLOY_DIR_IMAGE}/diya-config.txt +recovery_image=recovery-${MACHINE}.cpio.lz4.u-boot +kernel=Image.gz +console=both +bootlogo=false +EOF cat << 'EOF' >> "${D}${sysconfdir}/profile" export DISK="mmcblk0" EOF install -d ${D}${sysconfdir}/modules-load.d cat << EOF >> "${D}${sysconfdir}/modules-load.d/diya.conf" -option -cfg80211 -bluetooth -hci_uart -rfcomm -qmi_wwan -usbnet -usb_wwan -usbserial -mii -snd_seq_dummy -snd_hrtimer -842_decompress -842_compress -zram -crct10dif_ce -polyval_ce -8723cs -btbcm -sm4 -gpio_vibra -st_magn_spi -st_sensors_spi -sunxi_wdt -snd_soc_ec25 -led_class_flash -i2c_gpio -ledtrig_pattern -i2c_algo_bit -ppkb_manager -joydev -sch_fq_codel -crypto_user -loop -fuse -nfnetlink -ip_tables -ipv6 -sun4i_lradc_keys +# option +# cfg80211 +# bluetooth +# hci_uart +# rfcomm +# qmi_wwan +# usbnet +# usb_wwan +# usbserial +# mii +# snd_seq_dummy +# snd_hrtimer +# 842_decompress +# 842_compress +# zram +# crct10dif_ce +# polyval_ce +# 8723cs +# btbcm +# sm4 +# gpio_vibra +# st_magn_spi +# st_sensors_spi +# sunxi_wdt +# snd_soc_ec25 +# led_class_flash +# i2c_gpio +# ledtrig_pattern +# i2c_algo_bit +# ppkb_manager +# joydev +# sch_fq_codel +# crypto_user +# loop +# fuse +# nfnetlink +# ip_tables +# ipv6 +# sun4i_lradc_keys EOF } diff --git a/recipes-core/images/core-image-base.bbappend b/recipes-core/images/core-image-base.bbappend index ded4d2e..f0d7864 100644 --- a/recipes-core/images/core-image-base.bbappend +++ b/recipes-core/images/core-image-base.bbappend @@ -1,7 +1,9 @@ -IMAGE_BOOT_FILES:append:pinephone = " boot.scr ${KERNEL_DEVICETREE} " +IMAGE_BOOT_FILES:append:pinephone = " boot.scr ${KERNEL_DEVICETREE} diya-config.txt recovery-${MACHINE}.cpio.lz4.u-boot Image.gz " +OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p3" IMAGE_INSTALL:append:pinephone = " \ pinephone-firmware \ eg25-manager \ modemmanager \ gpsd \ - gps-utils " \ No newline at end of file + gps-utils \ + " \ No newline at end of file diff --git a/recipes-core/images/core-image-recovery.bbapend b/recipes-core/images/core-image-recovery.bbappend similarity index 83% rename from recipes-core/images/core-image-recovery.bbapend rename to recipes-core/images/core-image-recovery.bbappend index a734430..708af88 100644 --- a/recipes-core/images/core-image-recovery.bbapend +++ b/recipes-core/images/core-image-recovery.bbappend @@ -1,3 +1,4 @@ +PACKAGE_INSTALL:append = " kernel-modules " image_patch:append () { # create /etc/fstab cat << EOF > ${IMAGE_ROOTFS}/etc/fstab diff --git a/recipes-kernel/linux/files/0001-dts-pinephone-drop-modem-power-node.patch b/recipes-kernel/linux/files/0001-dts-pinephone-drop-modem-power-node.patch new file mode 100644 index 0000000..53ef5d3 --- /dev/null +++ b/recipes-kernel/linux/files/0001-dts-pinephone-drop-modem-power-node.patch @@ -0,0 +1,165 @@ +From 4c9bb6e27dc39ffe26f3b92b63a14c1093ce74fd Mon Sep 17 00:00:00 2001 +From: Clayton Craft +Date: Wed, 16 Dec 2020 20:16:14 -0800 +Subject: [PATCH 1/3] dts: pinephone: drop modem-power node + +Upstream-Status: Pending + +--- + .../allwinner/sun50i-a64-pinephone-1.0.dts | 22 --------------- + .../allwinner/sun50i-a64-pinephone-1.1.dts | 27 +++---------------- + .../allwinner/sun50i-a64-pinephone-1.2.dts | 27 +++---------------- + .../dts/allwinner/sun50i-a64-pinephone.dtsi | 12 +++++++++ + 4 files changed, 20 insertions(+), 68 deletions(-) + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts +index 0530881d8..ebe6c8324 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts +@@ -87,28 +87,6 @@ ®_drivevbus { + status = "okay"; + }; + +-&uart3 { +- modem { +- compatible = "quectel,eg25"; +- char-device-name = "modem-power"; +- +- power-supply = <®_vbat_bb>; /* PL7 */ +- +- enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */ +- reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */ +- pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ +- +- sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ +- wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */ +- +- cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */ +- dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */ +- rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */ +- +- quectel,qdai = "1,1,0,1,0,0,1,1"; +- }; +-}; +- + &usbphy { + usb-role-switch; + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts +index 053e4add9..8bacee359 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts +@@ -96,34 +96,15 @@ ®_drivevbus { + status = "okay"; + }; + ++&ring_indicator { ++ gpios = <&pio 1 2 GPIO_ACTIVE_LOW>; /* PB2 */ ++}; ++ + &sgm3140 { + enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */ + }; + +-&uart3 { +- modem { +- compatible = "quectel,eg25"; +- char-device-name = "modem-power"; +- +- power-supply = <®_vbat_bb>; /* PL7 */ +- +- enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */ +- reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */ +- pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ +- //status-pwrkey-multiplexed; /* status acts as pwrkey */ +- +- sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ +- wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */ +- +- dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */ +- cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */ +- rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */ +- +- quectel,qdai = "1,1,0,1,0,0,1,1"; +- }; +-}; +- + &usbphy { + usb-role-switch; + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts +index ec4927dfe..75d8735f6 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts +@@ -88,34 +88,15 @@ ®_anx1v0 { + enable-active-high; + }; + ++&ring_indicator { ++ gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ ++}; ++ + &sgm3140 { + enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */ + }; + +-&uart3 { +- modem { +- compatible = "quectel,eg25"; +- char-device-name = "modem-power"; +- +- power-supply = <®_vbat_bb>; /* PL7 */ +- +- enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */ +- reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */ +- status-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */ +- pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ +- +- host-ready-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ +- wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-RI */ +- +- dtr-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-DTR */ +- cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */ +- rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */ +- +- quectel,qdai = "1,1,0,1,0,0,1,1"; +- }; +-}; +- + &usbphy { + usb-role-switch; + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +index 70a2c4ffb..862c45e81 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi +@@ -310,6 +310,17 @@ ec25_codec: ec25-codec { + sound-name-prefix = "Modem"; + }; + ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ ring_indicator: ring-indicator { ++ label = "Ring Indicator"; ++ linux,can-disable; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ + i2c_csi: i2c-csi { + compatible = "i2c-gpio"; + sda-gpios = <&pio 4 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PE13 */ +@@ -382,6 +393,7 @@ reg_usb_5v: usb-5v { + reg_vbat_bb: vbat-bb { + compatible = "regulator-fixed"; + regulator-name = "vbat-bb"; ++ regulator-always-on; + regulator-min-microvolt = <3500000>; + regulator-max-microvolt = <3500000>; + gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */ +-- +2.44.0 diff --git a/recipes-kernel/linux/files/defconfig b/recipes-kernel/linux/files/defconfig index 17b97f5..3c13ad4 100644 --- a/recipes-kernel/linux/files/defconfig +++ b/recipes-kernel/linux/files/defconfig @@ -3948,7 +3948,7 @@ CONFIG_NOP_USB_XCEIV=m CONFIG_USB_GADGET=m # CONFIG_USB_GADGET_DEBUG_FILES is not set # CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 CONFIG_U_SERIAL_CONSOLE=y diff --git a/recipes-kernel/linux/linux-megi_6.12.10.bb b/recipes-kernel/linux/linux-megi_6.12.10.bb new file mode 100644 index 0000000..f540519 --- /dev/null +++ b/recipes-kernel/linux/linux-megi_6.12.10.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "Linux Kernel for Pinephone" +SECTION = "kernel" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRCREV = "${AUTOREV}" + +COMPATIBLE_MACHINE = "(sun50i|pinephone)" + +LINUX_PINEPHONE_BRANCH ?= "orange-pi-6.12" + +SRC_URI = " \ + git://codeberg.org/megi/linux.git;branch=${LINUX_PINEPHONE_BRANCH};protocol=https \ + file://defconfig \ + file://0001-dts-pinephone-drop-modem-power-node.patch \ + " +KBUILD_DEFCONFIG = "pinephone_diya_defconfig" + + +inherit kernel + +require linux.inc + + +do_kernel_metadata:prepend() { + cp ${UNPACKDIR}/defconfig ${S}/arch/arm64/configs/pinephone_diya_defconfig +} + diff --git a/recipes-kernel/linux/linux-megi_6.15.8.bb b/recipes-kernel/linux/linux-megi_6.15.8.bb index 03443a1..bbbdc43 100644 --- a/recipes-kernel/linux/linux-megi_6.15.8.bb +++ b/recipes-kernel/linux/linux-megi_6.15.8.bb @@ -7,42 +7,23 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRCREV = "${AUTOREV}" -COMPATIBLE_MACHINE = "(sun50i)" +COMPATIBLE_MACHINE = "(sun50i|pinephone)" LINUX_PINEPHONE_BRANCH ?= "orange-pi-6.15" SRC_URI = " \ git://codeberg.org/megi/linux.git;branch=${LINUX_PINEPHONE_BRANCH};protocol=https \ + file://defconfig \ " +KBUILD_DEFCONFIG = "pinephone_diya_defconfig" -KBUILD_DEFCONFIG = "pinephone_defconfig" -# Pull in the devicetree files into the rootfs -RDEPENDS_${KERNEL_PACKAGE_NAME}-base += "kernel-devicetree u-boot" - -KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" inherit kernel require linux.inc -LINUX_VERSION ?= "${PV}" -S = "${UNPACKDIR}/git" - -do_deploy:append() { - install -d ${DEPLOY_DIR_IMAGE} - install -d ${DEPLOY_DIR_IMAGE}/allwinner - install -d ${DEPLOY_DIR_IMAGE}/allwinner/overlay - for file in ${KERNEL_DEVICETREE}; do - name=$(basename $file) - ext="${name##*.}" - if [ "$ext" = "dtb" ]; then - ln -sf ${DEPLOY_DIR_IMAGE}/${name} ${DEPLOY_DIR_IMAGE}/allwinner/${name} - else - ln -sf ${DEPLOY_DIR_IMAGE}/${name} ${DEPLOY_DIR_IMAGE}/allwinner/overlay/${name} - fi - done - # install -m 0755 ${S}/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr ${DEPLOY_DIR_IMAGE}/allwinner/overlay/ +do_kernel_metadata:prepend() { + cp ${UNPACKDIR}/defconfig ${S}/arch/arm64/configs/pinephone_diya_defconfig } -FILES_${KERNEL_PACKAGE_NAME}-base:append = " ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo" diff --git a/recipes-kernel/linux/linux.inc b/recipes-kernel/linux/linux.inc index 540687f..f2cc251 100644 --- a/recipes-kernel/linux/linux.inc +++ b/recipes-kernel/linux/linux.inc @@ -22,6 +22,12 @@ LOGO_SIZE ?= '${@oe.utils.conditional("MACHINE_GUI_CLASS", "bigscreen", "vga", " LOCALVERSION ?= "" KCONFIG_MODE ?= "alldefconfig" KMACHINE ?= "${MACHINE}" +# Pull in the devicetree files into the rootfs +RDEPENDS_${KERNEL_PACKAGE_NAME}-base += "kernel-devicetree u-boot" + +KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" +LINUX_VERSION ?= "${PV}" +S = "${UNPACKDIR}/git" #kernel_conf_variable CMDLINE "\"${CMDLINE} ${CMDLINE_DEBUG}\"" kernel_conf_variable() { @@ -123,3 +129,21 @@ do_configure:append() { fi } +do_deploy:append() { + install -d ${DEPLOY_DIR_IMAGE} + install -d ${DEPLOY_DIR_IMAGE}/allwinner + install -d ${DEPLOY_DIR_IMAGE}/allwinner/overlay + for file in ${KERNEL_DEVICETREE}; do + name=$(basename $file) + ext="${name##*.}" + if [ "$ext" = "dtb" ]; then + ln -sf ${DEPLOY_DIR_IMAGE}/${name} ${DEPLOY_DIR_IMAGE}/allwinner/${name} + else + ln -sf ${DEPLOY_DIR_IMAGE}/${name} ${DEPLOY_DIR_IMAGE}/allwinner/overlay/${name} + fi + done + # install -m 0755 ${S}/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr ${DEPLOY_DIR_IMAGE}/allwinner/overlay/ + +} + +FILES_${KERNEL_PACKAGE_NAME}-base:append = " ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo" diff --git a/wic/image.wks.in b/wic/image.wks.in index 24809eb..4744a3a 100644 --- a/wic/image.wks.in +++ b/wic/image.wks.in @@ -1,12 +1,8 @@ -# short-description: Create Raspberry Pi SD card image -# long-description: Creates a partitioned SD card image for use with - part u-boot --source rawcopy --sourceparams="file=${SPL_BINARY}" --ondisk mmcblk0 --no-table --align 8 -part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 32 +part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 128M # read only roofs -part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size 150 --exclude-path home/ --exclude-path var/etc/ --exclude-path boot/ +part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label rootfs --align 4096 --size 1024M --exclude-path home/ --exclude-path var/etc/ --exclude-path boot/ # modifiable configurations stored in /var/etc -part /var/etc --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/var/etc --ondisk mmcblk0 --fstype=ext4 --label diya --align 1024 --size 32 +part /var/etc --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/var/etc --ondisk mmcblk0 --fstype=ext4 --label diya --align 1024 --size 32M # home partition -part /home --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/home --ondisk mmcblk0 --fstype=ext4 --label home --align 1024 --size 16 -# part /home --ondisk mmcblk0 --fstype=vfat --label music --active --align 1024 --size 16 \ No newline at end of file +part /home --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/home --ondisk mmcblk0 --fstype=ext4 --label home --align 1024 --size 16M \ No newline at end of file