optimize startup logo load and add PyQT5 package

This commit is contained in:
Neucrack
2025-07-28 15:15:49 +08:00
parent 4c9e842ee1
commit 64510bd44d
14 changed files with 4615 additions and 628 deletions

View File

@@ -1,4 +1,4 @@
<physical_partition type="sd">
<partition label="BOOT" size_in_kb="80960" readonly="false" file="boot.sd"/>
<partition label="ROOTFS" size_in_kb="1572864" readonly="false" file="rootfs.sd" />
<partition label="ROOTFS" size_in_kb="1638400" readonly="false" file="rootfs.sd" />
</physical_partition>

View File

@@ -17,18 +17,14 @@ then
insmod soph_vo.ko
# insmod soph_mipi_tx.ko
insmod soph_rgn.ko
insmod soph_wdt.ko
insmod soph_clock_cooling.ko
insmod soph_tpu.ko
insmod soph_vcodec.ko
insmod soph_jpeg.ko
insmod soph_vc_driver.ko MaxVencChnNum=9 MaxVdecChnNum=9
insmod soph_rtc.ko
insmod soph_ive.ko
insmod soph_mon.ko
insmod soph_pwm.ko
insmod soph_saradc.ko
insmod soph_wiegand.ko
# insmod soph_wiegand.ko # uncomment it if want use wiegand
echo "OK"
exit 0
fi

View File

@@ -1,24 +1,25 @@
#!/bin/sh
if ! command -v i2cget &> /dev/null
then
start() {
if ! command -v i2cget &> /dev/null
then
echo "i2cdetect not find, please install i2c-tools"
exit 1
fi
fi
pmu_version=$(i2cget -y 4 0x34 0x03)
pmu_version=$((pmu_version & 0xCF))
pmu_version=$(i2cget -y 4 0x34 0x03)
pmu_version=$((pmu_version & 0xCF))
chip_id_1=$(printf "%d" 0x47)
chip_id_2=$(printf "%d" 0x4a)
chip_id_1=$(printf "%d" 0x47)
chip_id_2=$(printf "%d" 0x4a)
if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; then
case "$1" in
start)
if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; then
exec /usr/bin/axp2101
echo "Starting PMU: OK\n"
;;
stop)
fi
}
stop() {
runlevel=$(cat /run/runlevel | awk '{ print $1 }')
if [ "$runlevel" = "0" ]; then
printf "Stopping PMU\n"
@@ -26,6 +27,22 @@ if [ "$pmu_version" -eq "$chip_id_1" ] || [ "$pmu_version" -eq "$chip_id_2" ]; t
value=$((value | 0x01))
i2cset -y 4 0x34 0x10 $value
fi
}
case "$1" in
start)
if grep -q "pmu=axp2101" /boot/board 2>/dev/null; then
start
fi
;;
esac
fi
stop)
if grep -q "pmu=axp2101" /boot/board 2>/dev/null; then
stop
fi
;;
*)
echo "Usage: /etc/init.d/S00pmu {start}"
exit 1
;;
esac

View File

@@ -6,7 +6,5 @@ then
printf "mounting filesystem : "
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
mount -t configfs configfs /sys/kernel/config
mount -t debugfs debugfs /sys/kernel/debug
echo "OK"
fi

View File

@@ -1,226 +0,0 @@
#!/bin/sh
if [ "$1" = "start" ]
then
. /etc/profile
if [ -e /boot/usb.host ]
then
echo "usb mode: host"
echo host > /proc/cviusb/otg_role
elif [ -e /boot/usb.dev ]
then
echo "usb mode: device"
cd /sys/kernel/config/usb_gadget
mkdir -p g0
cd g0
if [ -e /boot/usb.idVendor ]
then
cat /boot/usb.idVendor > idVendor
else
echo 0x359F > idVendor
fi
if [ -e /boot/usb.idProduct ]
then
cat /boot/usb.idProduct > idProduct
else
echo 0x2120 > idProduct
fi
if [ -e /boot/usb.bcdDevice ]
then
cat /boot/usb.bcdDevice > bcdDevice
else
echo 0x0300 > bcdDevice
fi
if [ -e /boot/usb.bcdUSB ]
then
cat /boot/usb.bcdUSB > bcdUSB
else
echo 0x0200 > bcdUSB
fi
if [ -e /boot/usb.bDeviceClass ]
then
cat /boot/usb.bDeviceClass > bDeviceClass
else
echo 0xef > bDeviceClass
fi
if [ -e /boot/usb.bDeviceSubClass ]
then
cat /boot/usb.bDeviceSubClass > bDeviceSubClass
else
echo 0x02 > bDeviceSubClass
fi
if [ -e /boot/usb.bDeviceProtocol ]
then
cat /boot/usb.bDeviceProtocol > bDeviceProtocol
else
echo 0x01 > bDeviceProtocol
fi
mkdir -p strings/0x409
if [ -e /boot/usb.serialnumber ]
then
cat /boot/usb.serialnumber > strings/0x409/serialnumber
else
cat /device_key > strings/0x409/serialnumber
fi
if [ -e /boot/usb.manufacturer ]
then
cat /boot/usb.manufacturer > strings/0x409/manufacturer
else
echo 'sipeed' > strings/0x409/manufacturer
fi
if [ -e /boot/usb.product ]
then
cat /boot/usb.product > strings/0x409/product
else
echo 'licheervnano' > strings/0x409/product
fi
mkdir -p configs/c.1
# uvc
if [ -e /boot/usb.uvc ]
then
/etc/init.d/uvc_tool.sh mount /boot/usb.uvc
/etc/init.d/uvc_tool.sh server
fi
if [ -e /boot/usb.GS0 ]
then
mkdir -p functions/acm.GS0
rm -rf configs/c.1/acm.GS0
ln -s functions/acm.GS0 configs/c.1/
fi
if [ -e /boot/usb.disk0 ]
then
mkdir -p functions/mass_storage.disk0
rm -rf configs/c.1/mass_storage.disk0
ln -s functions/mass_storage.disk0 configs/c.1/
echo 1 > functions/mass_storage.disk0/lun.0/removable
if [ -e /boot/usb.disk0.ro ]
then
echo 1 > functions/mass_storage.disk0/lun.0/ro
echo 1 > functions/mass_storage.disk0/lun.0/cdrom
fi
disk=$(cat /boot/usb.disk0)
if [ -z "${disk}" ]
then
if [ ! -e /mnt/usbdisk.img ]
then
dd if=/dev/zero of=/mnt/usbdisk.img bs=1M count=16
mkfs.vfat /mnt/usbdisk.img
fi
echo /mnt/usbdisk.img > functions/mass_storage.disk0/lun.0/file
else
cat /boot/usb.disk0 > functions/mass_storage.disk0/lun.0/file
fi
fi
# rndis
if [ -e /boot/usb.rndis ]
then
mkdir -p functions/rndis.usb0
ln -s functions/rndis.usb0 configs/c.1/
echo e0 > functions/rndis.usb0/class
echo 01 > functions/rndis.usb0/subclass
echo 03 > functions/rndis.usb0/protocol
fi
# ncm
if [ -e /boot/usb.ncm ]
then
mkdir -p functions/ncm.usb0
ln -s functions/ncm.usb0 configs/c.1/
fi
# keyboard
if [ -e /boot/usb.keyboard ]
then
mkdir functions/hid.GS0
# echo 1 > functions/hid.GS0/subclass
echo 1 > functions/hid.GS0/wakeup_on_write
echo 1 > functions/hid.GS0/protocol
echo 6 > functions/hid.GS0/report_length
echo -ne \\x05\\x01\\x09\\x06\\xa1\\x01\\x05\\x07\\x19\\xe0\\x29\\xe7\\x15\\x00\\x25\\x01\\x75\\x01\\x95\\x08\\x81\\x02\\x95\\x01\\x75\\x08\\x81\\x03\\x95\\x05\\x75\\x01\\x05\\x08\\x19\\x01\\x29\\x05\\x91\\x02\\x95\\x01\\x75\\x03\\x91\\x03\\x95\\x06\\x75\\x08\\x15\\x00\\x25\\x65\\x05\\x07\\x19\\x00\\x29\\x65\\x81\\x00\\xc0 > functions/hid.GS0/report_desc
ln -s functions/hid.GS0 configs/c.1
fi
# mouse
if [ -e /boot/usb.mouse ]
then
mkdir functions/hid.GS1
# echo 1 > functions/hid.GS1/subclass
echo 1 > functions/hid.GS1/wakeup_on_write
echo 2 > functions/hid.GS1/protocol
echo -ne \\x34 > functions/hid.GS1/report_length
echo -ne \\x5\\x1\\x9\\x2\\xa1\\x1\\x9\\x1\\xa1\\x0\\x5\\x9\\x19\\x1\\x29\\x3\\x15\\x0\\x25\\x1\\x95\\x3\\x75\\x1\\x81\\x2\\x95\\x1\\x75\\x5\\x81\\x3\\x5\\x1\\x9\\x30\\x9\\x31\\x9\\x38\\x15\\x81\\x25\\x7f\\x75\\x8\\x95\\x3\\x81\\x6\\xc0\\xc0 > functions/hid.GS1/report_desc
ln -s functions/hid.GS1 configs/c.1
fi
# touchpad
if [ -e /boot/usb.touchpad ]
then
mkdir functions/hid.GS2
# echo 1 > functions/hid.GS2/subclass
echo 1 > functions/hid.GS2/wakeup_on_write
echo 2 > functions/hid.GS2/protocol
echo 6 > functions/hid.GS2/report_length
echo -ne \\x05\\x01\\x09\\x02\\xa1\\x01\\x09\\x01\\xa1\\x00\\x05\\x09\\x19\\x01\\x29\\x03\\x15\\x00\\x25\\x01\\x95\\x03\\x75\\x01\\x81\\x02\\x95\\x01\\x75\\x05\\x81\\x01\\x05\\x01\\x09\\x30\\x09\\x31\\x15\\x00\\x26\\xff\\x7f\\x35\\x00\\x46\\xff\\x7f\\x75\\x10\\x95\\x02\\x81\\x02\\x05\\x01\\x09\\x38\\x15\\x81\\x25\\x7f\\x35\\x00\\x45\\x00\\x75\\x08\\x95\\x01\\x81\\x06\\xc0\\xc0 > functions/hid.GS2/report_desc
ln -s functions/hid.GS2 configs/c.1
fi
# adbd
if [ -e /boot/usb.adbd ]
then
echo 0x18d1 > idVendor # google
mkdir -p configs/c.1/strings/0x409
echo "" > configs/c.1/strings/0x409/configuration
echo 0x80 > configs/c.1/bmAttributes
mkdir functions/ffs.adb
ln -s functions/ffs.adb configs/c.1/
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb/
/usr/bin/adbd &
for i in $(seq 1 40); do
if [ -e /dev/usb-ffs/adb/ep2 ]; then
break
fi
sleep 0.1
done
fi
while true; do
ls /sys/class/udc/ | cat > UDC || true
res=$(cat UDC)
if [[ "x$res" != "x" ]]; then
break
fi
sleep 0.4
done
echo device > /proc/cviusb/otg_role
fi
fi
if [ "$1" = "stop" ]
then
echo '' > /sys/kernel/config/usb_gadget/g0/UDC
echo host > /proc/cviusb/otg_role
# uvc
if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/uvc.usb0 ]
then
/etc/init.d/uvc_tool.sh unmount
fi
# rndis
if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/rndis.usb0 ]
then
unlink /sys/kernel/config/usb_gadget/g0/configs/c.1/rndis.usb0
rmdir /sys/kernel/config/usb_gadget/g0/functions/rndis.usb0
fi
# ncm
if [ -e /sys/kernel/config/usb_gadget/g0/configs/c.1/ncm.usb0 ]
then
unlink /sys/kernel/config/usb_gadget/g0/configs/c.1/ncm.usb0
rmdir /sys/kernel/config/usb_gadget/g0/functions/ncm.usb0
fi
fi

View File

@@ -2,7 +2,7 @@
if [ "$1" = "start" ]
then
. /etc/profile
# . /etc/profile
if [ ! -e /boot/alpha ]
then
devmem 0x030010AC 32 0x04 # PINMUX PWM10
@@ -21,11 +21,11 @@ then
then
panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2)
fi
if [ "$panel_value" = "st7701_hd228001c31" ]
if [ "$panel_value" = "st7701_hd228001c31" ] || [ "$panel_value" = "st7701_lct024bsi20" ]
then
echo "2000" > ${blpwm}/duty_cycle # 20%
else
echo "9000" > ${blpwm}/duty_cycle
echo "5000" > ${blpwm}/duty_cycle
fi
echo 1 > $blpwm/enable
fi

File diff suppressed because it is too large Load Diff

View File

@@ -1252,6 +1252,7 @@ menu "External python modules"
source "package/python-pyphen/Config.in"
source "package/python-pyqrcode/Config.in"
source "package/python-pyqt5/Config.in"
source "package/python-pyqt5-sip/Config.in"
source "package/python-pyratemp/Config.in"
source "package/python-pyroute2/Config.in"
source "package/python-pyrsistent/Config.in"

View File

@@ -0,0 +1,7 @@
config BR2_PACKAGE_PYTHON_PYQT5_SIP
bool "python-pyqt5-sip"
help
This is the PyQt5.sip module which is needed at runtime for
the PyQt5 module from package python-pyqt5.
https://pypi.org/project/PyQt5-sip/

View File

@@ -0,0 +1,6 @@
# From https://pypi.org/pypi/PyQt5-sip/json
md5 9e0909e79f40619b0f2d3d3c33b4d4f7 PyQt5_sip-12.15.0.tar.gz
sha256 d23fdfcf363b5cedd9d39f8a9c5710e7d52804f5b08a58e91c638b36eafcb702 PyQt5_sip-12.15.0.tar.gz
# Locally calculated
sha256 3859cfca971e429d6b79bdfeb1dc9e43aa9592f7295bf28fdd62824097909383 LICENSE

View File

@@ -0,0 +1,24 @@
################################################################################
#
# python-sip-qt5
#
################################################################################
# Note about the package version:
# This module version corresponds in fact to the "sip" ABI
# version (not the version of its generator). See:
# https://github.com/Python-SIP/sip/blob/6.8.6/sipbuild/module/source/12/sip.h.in#L43
# The source git repository of this module is located at:
# https://github.com/Python-SIP/sip/tree/main/sipbuild/module/source
# The Python-SIP version/tag which generated a given "sip" module is
# recorded in the PyPI source file "sip.h", in the SIP_VERSION_STR
# macro. For example, PyQt5-sip 12.15.0 was generated with Python-SIP
# 6.8.6.
PYTHON_PYQT5_SIP_VERSION = 12.15.0
PYTHON_PYQT5_SIP_SITE = https://files.pythonhosted.org/packages/1b/15/78318d50f10062c428e97e7ce387e772616a4673c356018b905f247a6a85
PYTHON_PYQT5_SIP_SOURCE = PyQt5_sip-$(PYTHON_PYQT5_SIP_VERSION).tar.gz
PYTHON_PYQT5_SIP_LICENSE = BSD-2-Clause
PYTHON_PYQT5_SIP_LICENSE_FILES = LICENSE
PYTHON_PYQT5_SIP_SETUP_TYPE = setuptools
$(eval $(python-package))

View File

@@ -3,9 +3,38 @@
export PATH=/
msc() {
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
echo mmc0 > /sys/devices/platform/leds/leds/led-user/trigger
# backlight
devmem 0x030010AC 32 0x04 # PINMUX PWM10
blpwm="/sys/class/pwm/pwmchip8/pwm2/"
if [ ! -e "${blpwm}" ]
then
echo 2 > /sys/class/pwm/pwmchip8/export
fi
echo 0 > $blpwm/enable
echo "10000" > ${blpwm}/period # 100KHZ
panel_value=""
if [ -e /boot/board ]
then
panel_value=$(grep '^panel=' /boot/board | cut -d '=' -f 2)
elif [ -e /boot/uEnv.txt ]
then
panel_value=$(grep '^panel=' /boot/uEnv.txt | cut -d '=' -f 2)
fi
if [ "$panel_value" = "st7701_hd228001c31" ] || [ "$panel_value" = "st7701_lct024bsi20" ]
then
echo "2000" > ${blpwm}/duty_cycle # 20%
else
echo "5000" > ${blpwm}/duty_cycle
fi
echo 1 > $blpwm/enable
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2 || true
# usb
mount -t configfs configfs /sys/kernel/config
cd /sys/kernel/config/usb_gadget
mkdir g0
cd g0
@@ -65,31 +94,38 @@ mkdir -p /proc
mount -t proc proc /proc
mkdir -p /sys
mount -t sysfs sysfs /sys
mount -t configfs configfs /sys/kernel/config
mount -t debugfs debugfs /sys/kernel/debug
# mount -t debugfs debugfs /sys/kernel/debug
mkdir -p /boot
mount -o ro /dev/mmcblk0p1 /boot
msc=0
if [ -e /boot/rec ]
if [ -e /boot/rec ] # recovery mode
then
msc
fi
# flashkey0=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
# if [ "${flashkey0}" -ne 0 ]
# then
# msc
# fi
boot_key=0
for arg in $(cat /proc/cmdline); do
case "$arg" in
boot_key=*)
boot_key="${arg#boot_key=}"
;;
esac
done
if [ "${boot_key}" -eq 1 ] # boot key pressed
then
msc
fi
umount /dev/mmcblk0p1
flashkey0=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
sleep 0.5
flashkey1=$(cat /sys/kernel/debug/gpio | grep 'User Key' | grep lo | wc -l)
if [ "${flashkey0}" -ne 0 ]
then
if [ "${flashkey1}" -ne 0 ]
then
msc
fi
fi
mkdir /realroot
# parted -s /dev/mmcblk0 "resizepart 2 -0"
# echo "yes

View File

@@ -18,6 +18,8 @@
#include <cvi_panels/cvi_panels.h>
#include <asm/io.h>
#include "part.h"
#include "fs.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -278,6 +280,40 @@ static int get_value_from_header(const char *filepath, const char *key, char *bu
return -2; // 未找到 key 或 value 为空
}
static bool fat_file_exists(const char *filename)
{
struct blk_desc *dev_desc;
#if defined(CONFIG_NAND_SUPPORT) || defined(CONFIG_SPI_FLASH)
const char *dev_part = "0:1";
int dev = 0;
#elif defined(CONFIG_EMMC_SUPPORT)
const char *dev_part = "1:1";
int dev = 1;
#else
const char *dev_part = "0:1";
int dev = 0;
#endif
dev_desc = blk_get_dev("mmc", dev);
if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
printf("Cannot find mmc device %s\n", dev_part);
return -ENODEV;
}
if (fs_set_blk_dev("mmc", dev_part, FS_TYPE_FAT)) {
printf("Failed to set fs device mmc %s\n", dev_part);
return -EINVAL;
}
if (fs_exists(filename)) {
printf("File %s exists on mmc %s\n", filename, dev_part);
return true;
} else {
printf("File %s not found on mmc %s\n", filename, dev_part);
return false;
}
}
/***************************************************/
static int do_startvo(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
{
@@ -288,6 +324,31 @@ static int do_startvo(struct cmd_tbl *cmdtp, int flag, int argc, char * const ar
if (argc < 4)
return CMD_RET_USAGE;
// check boot key pressed
// writel(0x00000003, 0x03001078);
uint32_t val = readl((const volatile void *)0x03020050);
int boot_key = (val >> 30) & 0x01; // GPIOA30
if (boot_key == 0) // boot key pressed
{
char *_bootargs = NULL;
char new_bootargs[256] = {0};
printf("boot key pressed\n");
_bootargs = env_get("othbootargs");
memcpy(new_bootargs, _bootargs, strlen(_bootargs));
char *boot_key_arg = " boot_key=1";
memcpy(new_bootargs + strlen(new_bootargs), boot_key_arg, strlen(boot_key_arg));
printf("new_othbootargs[%ld]: %s\n", strlen(new_bootargs), new_bootargs);
env_set("othbootargs", new_bootargs);
if (fat_file_exists("logo_upgrade.jpeg"))
env_set("logo", "logo_upgrade.jpeg");
else
env_set("logo", "logo.jpeg");
}
else
{
env_set("logo", "logo.jpeg");
}
dev = simple_strtoul(argv[1], &endp, 10);
if (*argv[1] == 0 || *endp != 0)
return CMD_RET_USAGE;

View File

@@ -283,9 +283,9 @@
#elif defined(CONFIG_SPI_FLASH)
#define LOAD_LOGO "sf probe;sf read " LOGO_READ_ADDR " ${MISC_PART_OFFSET} ${MISC_PART_SIZE};"
#else
#define LOAD_LOGO "mmc dev 0;load mmc 0:1 " LOGO_READ_ADDR " logo.jpeg ;"
#define LOAD_LOGO "mmc dev 0;load mmc 0:1 " LOGO_READ_ADDR " ${logo} ;"
#endif
#define SHOWLOGOCOMMAND LOAD_LOGO CVI_JPEG START_VO START_VL SET_VO_BG
#define SHOWLOGOCOMMAND START_VO LOAD_LOGO CVI_JPEG START_VL SET_VO_BG
#else
#define SHOWLOGOCMD
#endif