Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
0x754C committed Mar 7, 2024
1 parent 9abea77 commit 00ac8f8
Show file tree
Hide file tree
Showing 23 changed files with 281 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_MASS_STORAGE=y
CONFIG_USB_F_FS=y
CONFIG_USB_F_UAC1=y
CONFIG_USB_F_UVC=y
# buggy driver, need fix
# CONFIG_USB_F_UVC is not set
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
Expand All @@ -485,11 +486,8 @@ CONFIG_USB_CONFIGFS_F_UAC1=y
# CONFIG_USB_CONFIGFS_F_HID is not set
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_BUG=n
CONFIG_IO_URING=n
CONFIG_ADVISE_SYSCALLS=n
CONFIG_SIGNALFD=n
CONFIG_TIMERFD=n
CONFIG_EPOLL=n

# for licheervnano
CONFIG_FB_SIMPLE=y
Expand Down Expand Up @@ -647,6 +645,11 @@ CONFIG_LEDS_TRIGGER_CAMERA=y
CONFIG_LEDS_TRIGGER_ACTIVITY=y
CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_V4L2_FLASH_LED_CLASS=y
CONFIG_MEDIA_USB_SUPPORT=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y


# these driver may be broken jpeg driver
# CONFIG_FUSE_FS is not set
Expand All @@ -668,3 +671,6 @@ CONFIG_LEDS_TRIGGER_PANIC=y
# CONFIG_CGROUP_PIDS=y
# CONFIG_CGROUP_DEVICE=y
# CONFIG_CHECKPOINT_RESTORE=y
CONFIG_EPOLL=y
CONFIG_IO_URING=y
CONFIG_SIGNALFD=y
Original file line number Diff line number Diff line change
@@ -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="734003200" readonly="false" file="rootfs.sd" />
<partition label="ROOTFS" size_in_kb="838860800" readonly="false" file="rootfs.sd" />
</physical_partition>
9 changes: 9 additions & 0 deletions buildroot/board/cvitek/SG200X/busybox-extra.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
CONFIG_UDHCPD=y
CONFIG_RX=y
CONFIG_DEFAULT_MODULES_DIR="/mnt/system/ko"
CONFIG_DEPMOD=y
CONFIG_FEATURE_MODPROBE_BLACKLIST=y
CONFIG_RUNSV=y
CONFIG_RUNSVDIR=y
CONFIG_SV=y
CONFIG_SVC=y
CONFIG_SVOK=y
CONFIG_SVLOGD=y
7 changes: 7 additions & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/console_handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

. /etc/profile
if [ -e /dev/console ]
then
login
fi
5 changes: 4 additions & 1 deletion buildroot/board/cvitek/SG200X/overlay/etc/init.d/S00kmod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
if [ "$1" = "start" ]
then
. /etc/profile
printf "load kernel module: "
depmod -a
ls /etc/modules-load.d/*.conf | sort | while read conf
do
cat $conf | while read line
do
if [ -e /lib/modules ]
if [ -e /mnt/system/ko/modules.dep ]
then
modprobe $line
else
Expand All @@ -20,5 +22,6 @@ then
fi
done
done
echo "OK"
exit 0
fi
2 changes: 2 additions & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S01fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
if [ "$1" = "start" ]
then
. /etc/profile
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
20 changes: 20 additions & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S02config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,28 @@
if [ "$1" = "start" ]
then
. /etc/profile
printf "copy config file from /boot: "
if [ -e /boot/sshd_config ]
then
cp -vf /boot/sshd_config /etc/ssh/sshd_config
fi
if [ -e /boot/input-event-daemon ]
then
chmod 0644 /etc/input-event-daemon.conf
else
chmod 0000 /etc/input-event-daemon.conf
fi
if [ -e /boot/rc.local ]
then
cp -vf /boot/rc.local /etc/rc.local
fi
if [ -e /boot/ttyGS0_handler.sh ]
then
cp /boot/ttyGS0_handler.sh /etc/ttyGS0_handler.sh
fi
if [ -e /boot/console_handler.sh ]
then
cp /boot/ttyGS0_handler.sh /etc/ttyGS0_handler.sh
fi
echo "OK"
fi
100 changes: 58 additions & 42 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S03usbdev
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,66 @@

if [ "$1" = "start" ]
then
if [ -e /boot/usb.host ]
then
exit 0
fi
. /etc/profile
cd /sys/kernel/config/usb_gadget
mkdir g0
cd g0
if [ -e /boot/usb.idVendor ]
then
cat /boot/usb.idVendor > idVendor
else
echo 0123 > idVendor
fi
if [ -e /boot/usb.idProduct ]
then
cat /boot/usb.idProduct > idProduct
else
echo 4567 > idProduct
fi
mkdir strings/0x409
if [ -e /boot/usb.serialnumber ]
then
cat /boot/usb.serialnumber > strings/0x409/serialnumber
else
echo '0123456789ABCDEF' > strings/0x409/serialnumber
fi
if [ -e /boot/usb.manufacturer ]
if [ -e /boot/usb.host ]
then
cat /boot/usb.manufacturer > strings/0x409/manufacturer
else
echo 'sipeed' > strings/0x409/manufacturer
fi
if [ -e /boot/usb.product ]
echo "usb mode: host"
echo host > /proc/cviusb/otg_role
elif [ -e /boot/usb.dev ]
then
cat /boot/usb.product > strings/0x409/product
else
echo 'licheervnano' > strings/0x409/product
echo "usb mode: device"
cd /sys/kernel/config/usb_gadget
mkdir g0
cd g0
if [ -e /boot/usb.idVendor ]
then
cat /boot/usb.idVendor > idVendor
else
echo 0123 > idVendor
fi
if [ -e /boot/usb.idProduct ]
then
cat /boot/usb.idProduct > idProduct
else
echo 4567 > idProduct
fi
mkdir strings/0x409
if [ -e /boot/usb.serialnumber ]
then
cat /boot/usb.serialnumber > strings/0x409/serialnumber
else
echo '0123456789ABCDEF' > 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 configs/c.1
if [ -e /boot/usb.GS0 ]
then
mkdir functions/acm.GS0
ln -s functions/acm.GS0 configs/c.1/
fi
if [ -e /boot/usb.rndis0 ]
then
mkdir functions/rndis.usb0
ln -s functions/rndis.usb0 configs/c.1/
fi
ls /sys/class/udc/ | cat > UDC
echo device > /proc/cviusb/otg_role
fi
mkdir functions/acm.GS0
mkdir functions/rndis.usb0
mkdir configs/c.1
ln -s functions/acm.GS0 configs/c.1/
ln -s functions/rndis.usb0 configs/c.1/
ls /sys/class/udc/ | cat > UDC
echo device > /proc/cviusb/otg_role
fi

if [ "$1" = "stop" ]
then
echo '' > /sys/kernel/config/usb_gadget/g0/UDC
echo host > /proc/cviusb/otg_role
fi
1 change: 1 addition & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S04fb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ then
. /etc/profile
if [ -e /boot/fb ]
then
echo "framebuffer enable"
insmod /mnt/system/ko/soph_fb.ko
# we need keep node /dev/fb0 open
# graphic layer will disable after node /dev/fb0 is closed
Expand Down
1 change: 1 addition & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S05tp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ then
. /etc/profile
if [ -e /boot/gt9xx ]
then
echo "load gt9xx touchscreen driver"
insmod /mnt/system/ko/3rd/gt9xx.ko
fi
exit 0
Expand Down
33 changes: 23 additions & 10 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S10uuid
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@ hex2mac() {

if [ "${1}" = start ]
then
prefix=licheervnano
if [ -e /boot/hostname.prefix ]
then
prefix=$(cat /boot/hostname.prefix)
fi
old_hostname=$(cat /etc/hostname)
new_hostname=licheervnano-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)
new_hostname=${prefix}-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)

if [ -e /boot/hostname ]
then
new_hostname=$(cat /boot/hostname)
fi

if [ "${old_hostname}" != "${new_hostname}" ]
then
Expand All @@ -24,7 +34,7 @@ then
fi
echo "hostname: ${new_hostname}"

if [ -e /boot/ethmac ]
if [ -e /boot/eth.mac ]
then
new_ethmac=$(cat /boot/ethmac)
else
Expand All @@ -36,14 +46,17 @@ then
ifconfig eth0 up
echo "ethernet mac address: ${new_ethmac}"

if [ -e /boot/rndismac ]
if [ -e /boot/usb.rndis0 ]
then
new_rndismac=$(cat /boot/rndismac)
else
new_rndismac=$(hex2mac 48da356e$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
if [ -e /boot/usb.rndis0.mac ]
then
new_rndismac=$(cat /boot/usb.rndis0.mac)
else
new_rndismac=$(hex2mac 48da356e$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
fi
ifconfig usb0 down
ip link set usb0 address ${new_rndismac}
ifconfig usb0 up
echo "rndis mac address: ${new_rndismac}"
fi
ifconfig usb0 down
ip link set usb0 address ${new_rndismac}
ifconfig usb0 up
echo "rndis mac address: ${new_ethmac}"
fi
2 changes: 2 additions & 0 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30eth
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
. /etc/profile

start() {
printf "start ethernet: "
if [ ! -e /boot/eth.nodhcp ]
then
(udhcpc -i eth0 -t 10 -T 1 -A 5 -b -p /run/udhcpc.eth0.pid) &
fi
echo "OK"
}

stop() {
Expand Down
45 changes: 25 additions & 20 deletions buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30rndis
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,36 @@ gen_udhcpd_conf() {
}

start() {
if [ ! -e /boot/rndis.nodhcpd ]
if [ -e /boot/usb.rndis0 ]
then
if [ -e /boot/rndis.ipv4_prefix ]
printf "start usb rndis: "
if [ ! -e /boot/rndis.nodhcpd ]
then
ipv4_prefix=`cat /boot/rndis.ipv4_prefix`
else
id2=$(printf "%d" 0x$(sha512sum /sys/class/cvi-base/base_uid | head -c 2))
id3=$(printf "%d" 0x$(sha512sum /sys/class/cvi-base/base_uid | head -c 4 | tail -c 2))
if [ "$id2" = "$id3" ]
if [ -e /boot/rndis.ipv4_prefix ]
then
id2=$((id2 + 1))
ipv4_prefix=`cat /boot/rndis.ipv4_prefix`
else
id2=$(printf "%d" 0x$(sha512sum /sys/class/cvi-base/base_uid | head -c 2))
id3=$(printf "%d" 0x$(sha512sum /sys/class/cvi-base/base_uid | head -c 4 | tail -c 2))
if [ "$id2" = "$id3" ]
then
id2=$((id2 + 1))
fi
if [ "$id2" -ge 255 ]
then
id2=253
fi
if [ "$id3" -ge 255 ]
then
id3=254
fi
ipv4_prefix=10.$id2.$id3
fi
if [ "$id2" -ge 255 ]
then
id2=253
fi
if [ "$id3" -ge 255 ]
then
id3=254
fi
ipv4_prefix=10.$id2.$id3
gen_udhcpd_conf usb0 "${ipv4_prefix}" > /etc/udhcpd.usb0.conf
ip addr add $ipv4_prefix.1/24 dev usb0
udhcpd -S /etc/udhcpd.usb0.conf
fi
gen_udhcpd_conf usb0 "${ipv4_prefix}" > /etc/udhcpd.usb0.conf
ip addr add $ipv4_prefix.1/24 dev usb0
udhcpd -S /etc/udhcpd.usb0.conf
echo "ok"
fi
}

Expand Down
Loading

0 comments on commit 00ac8f8

Please sign in to comment.