project:app:rkipc:rkipc:Modify udhcpc for silent operation to suppress irrelevant information from being printed to the terminal

project:build.sh:Add support for multiple folders in post overlay
project:cfg:BoardConfig_IPC:Add support for rootfs post overlay
sysdrv:Makefile:Replace the script-based copying method with the post overlay approach

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
luckfox-eng29 2024-11-02 18:41:51 +08:00
parent 7a66b04c61
commit 8fdf14595e
66 changed files with 3791 additions and 166 deletions

View File

@ -1,40 +1,37 @@
#!/bin/sh
rcS()
{
for i in /oem/usr/etc/init.d/S??* ;do
rcS() {
for i in /oem/usr/etc/init.d/S??*; do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
}
check_linker()
{
[ ! -L "$2" ] && ln -sf $1 $2
check_linker() {
[ ! -L "$2" ] && ln -sf $1 $2
}
network_init()
{
ethaddr1=`ifconfig -a | grep "eth.*HWaddr" | awk '{print $5}'`
network_init() {
ethaddr1=$(ifconfig -a | grep "eth.*HWaddr" | awk '{print $5}')
if [ -f /data/ethaddr.txt ]; then
ethaddr2=`cat /data/ethaddr.txt`
ethaddr2=$(cat /data/ethaddr.txt)
if [ $ethaddr1 == $ethaddr2 ]; then
echo "eth HWaddr cfg ok"
else
@ -42,18 +39,16 @@ network_init()
ifconfig eth0 hw ether $ethaddr2
fi
else
echo $ethaddr1 > /data/ethaddr.txt
echo $ethaddr1 >/data/ethaddr.txt
fi
ifconfig eth0 up && udhcpc -i eth0
ifconfig eth0 up && udhcpc -i eth0 >/dev/null 2>&1
}
post_chk()
{
post_chk() {
#TODO: ensure /userdata mount done
cnt=0
while [ $cnt -lt 30 ];
do
cnt=$(( cnt + 1 ))
while [ $cnt -lt 30 ]; do
cnt=$((cnt + 1))
if mount | grep -w userdata; then
break
fi
@ -62,15 +57,15 @@ post_chk()
# if ko exist, install ko first
default_ko_dir=/ko
if [ -f "/oem/usr/ko/insmod_ko.sh" ];then
if [ -f "/oem/usr/ko/insmod_ko.sh" ]; then
default_ko_dir=/oem/usr/ko
fi
if [ -f "$default_ko_dir/insmod_ko.sh" ];then
if [ -f "$default_ko_dir/insmod_ko.sh" ]; then
cd $default_ko_dir && sh insmod_ko.sh && cd -
fi
network_init &
check_linker /userdata /oem/usr/www/userdata
check_linker /userdata /oem/usr/www/userdata
check_linker /media/usb0 /oem/usr/www/usb0
check_linker /mnt/sdcard /oem/usr/www/sdcard
# if /data/rkipc not exist, cp /usr/share
@ -79,33 +74,35 @@ post_chk()
if [ ! -f "/oem/usr/share/rkipc.ini" ]; then
lsmod | grep sc530ai
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-500w.ini $default_rkipc_ini
fi
lsmod | grep sc4336
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-400w.ini $default_rkipc_ini
fi
lsmod | grep sc3336
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-300w.ini $default_rkipc_ini
fi
fi
tmp_md5=/tmp/.rkipc-ini.md5sum
data_md5=/userdata/.rkipc-default.md5sum
md5sum $default_rkipc_ini > $tmp_md5
chk_rkipc=`cat $tmp_md5|awk '{print $1}'`
rm $tmp_md5
if [ ! -f $data_md5 ];then
md5sum $default_rkipc_ini > $data_md5
fi
grep -w $chk_rkipc $data_md5
if [ $? -ne 0 ] ;then
rm -f $rkipc_ini
echo "$chk_rkipc" > $data_md5
fi
if [ ! -f "$default_rkipc_ini" ];then
# check md5sum
# tmp_md5=/tmp/.rkipc-ini.md5sum
# data_md5=/userdata/.rkipc-default.md5sum
# md5sum $default_rkipc_ini > $tmp_md5
# chk_rkipc=`cat $tmp_md5|awk '{print $1}'`
# rm $tmp_md5
# if [ ! -f $data_md5 ];then
# md5sum $default_rkipc_ini > $data_md5
# fi
# grep -w $chk_rkipc $data_md5
# if [ $? -ne 0 ] ;then
# rm -f $rkipc_ini
# echo "$chk_rkipc" > $data_md5
# fi
if [ ! -f "$default_rkipc_ini" ]; then
echo "Error: not found rkipc.ini !!!"
exit -1
fi
@ -117,7 +114,7 @@ post_chk()
cp -fa /oem/usr/share/image.bmp /userdata/
fi
if [ -d "/oem/usr/share/iqfiles" ];then
if [ -d "/oem/usr/share/iqfiles" ]; then
rkipc -a /oem/usr/share/iqfiles &
else
rkipc &
@ -127,9 +124,9 @@ post_chk()
rcS
ulimit -c unlimited
echo "/data/core-%p-%e" > /proc/sys/kernel/core_pattern
echo "/data/core-%p-%e" >/proc/sys/kernel/core_pattern
# echo 0 > /sys/devices/platform/rkcif-mipi-lvds/is_use_dummybuf
echo 1 > /proc/sys/vm/overcommit_memory
echo 1 >/proc/sys/vm/overcommit_memory
post_chk &

View File

@ -1,40 +1,37 @@
#!/bin/sh
rcS()
{
for i in /oem/usr/etc/init.d/S??* ;do
rcS() {
for i in /oem/usr/etc/init.d/S??*; do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
}
check_linker()
{
[ ! -L "$2" ] && ln -sf $1 $2
check_linker() {
[ ! -L "$2" ] && ln -sf $1 $2
}
network_init()
{
ethaddr1=`ifconfig -a | grep "eth.*HWaddr" | awk '{print $5}'`
network_init() {
ethaddr1=$(ifconfig -a | grep "eth.*HWaddr" | awk '{print $5}')
if [ -f /data/ethaddr.txt ]; then
ethaddr2=`cat /data/ethaddr.txt`
ethaddr2=$(cat /data/ethaddr.txt)
if [ $ethaddr1 == $ethaddr2 ]; then
echo "eth HWaddr cfg ok"
else
@ -42,18 +39,16 @@ network_init()
ifconfig eth0 hw ether $ethaddr2
fi
else
echo $ethaddr1 > /data/ethaddr.txt
echo $ethaddr1 >/data/ethaddr.txt
fi
ifconfig eth0 up && udhcpc -i eth0
ifconfig eth0 up && udhcpc -i eth0 >/dev/null 2>&1
}
post_chk()
{
post_chk() {
#TODO: ensure /userdata mount done
cnt=0
while [ $cnt -lt 30 ];
do
cnt=$(( cnt + 1 ))
while [ $cnt -lt 30 ]; do
cnt=$((cnt + 1))
if mount | grep -w userdata; then
break
fi
@ -62,15 +57,15 @@ post_chk()
# if ko exist, install ko first
default_ko_dir=/ko
if [ -f "/oem/usr/ko/insmod_ko.sh" ];then
if [ -f "/oem/usr/ko/insmod_ko.sh" ]; then
default_ko_dir=/oem/usr/ko
fi
if [ -f "$default_ko_dir/insmod_ko.sh" ];then
if [ -f "$default_ko_dir/insmod_ko.sh" ]; then
cd $default_ko_dir && sh insmod_ko.sh && cd -
fi
network_init &
check_linker /userdata /oem/usr/www/userdata
check_linker /userdata /oem/usr/www/userdata
check_linker /media/usb0 /oem/usr/www/usb0
check_linker /mnt/sdcard /oem/usr/www/sdcard
# if /data/rkipc not exist, cp /usr/share
@ -79,37 +74,39 @@ post_chk()
if [ ! -f "/oem/usr/share/rkipc.ini" ]; then
lsmod | grep sc530ai
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-500w.ini $default_rkipc_ini
fi
lsmod | grep sc4336
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-400w.ini $default_rkipc_ini
fi
lsmod | grep sc3336
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-300w.ini $default_rkipc_ini
fi
lsmod | grep imx415
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]; then
ln -s -f /oem/usr/share/rkipc-800w.ini $default_rkipc_ini
fi
fi
tmp_md5=/tmp/.rkipc-ini.md5sum
data_md5=/userdata/.rkipc-default.md5sum
md5sum $default_rkipc_ini > $tmp_md5
chk_rkipc=`cat $tmp_md5|awk '{print $1}'`
rm $tmp_md5
if [ ! -f $data_md5 ];then
md5sum $default_rkipc_ini > $data_md5
fi
grep -w $chk_rkipc $data_md5
if [ $? -ne 0 ] ;then
rm -f $rkipc_ini
echo "$chk_rkipc" > $data_md5
fi
if [ ! -f "$default_rkipc_ini" ];then
# check md5sum
# tmp_md5=/tmp/.rkipc-ini.md5sum
# data_md5=/userdata/.rkipc-default.md5sum
# md5sum $default_rkipc_ini > $tmp_md5
# chk_rkipc=`cat $tmp_md5|awk '{print $1}'`
# rm $tmp_md5
# if [ ! -f $data_md5 ];then
# md5sum $default_rkipc_ini > $data_md5
# fi
# grep -w $chk_rkipc $data_md5
# if [ $? -ne 0 ] ;then
# rm -f $rkipc_ini
# echo "$chk_rkipc" > $data_md5
# fi
if [ ! -f "$default_rkipc_ini" ]; then
echo "Error: not found rkipc.ini !!!"
exit -1
fi
@ -121,11 +118,11 @@ post_chk()
cp -fa /oem/usr/share/image.bmp /userdata/
fi
if [ -f "/oem/usr/share/speaker_test.wav" ];then
if [ -f "/oem/usr/share/speaker_test.wav" ]; then
rk_mpi_ao_test -i /oem/usr/share/speaker_test.wav --sound_card_name=hw:0,0 --device_ch=2 --device_rate=8000 --input_rate=8000 --input_ch=2 --set_volume 50
fi
if [ -d "/oem/usr/share/iqfiles" ];then
if [ -d "/oem/usr/share/iqfiles" ]; then
rkipc -a /oem/usr/share/iqfiles &
else
rkipc &
@ -135,9 +132,9 @@ post_chk()
rcS
ulimit -c unlimited
echo "/data/core-%p-%e" > /proc/sys/kernel/core_pattern
echo "/data/core-%p-%e" >/proc/sys/kernel/core_pattern
# echo 0 > /sys/devices/platform/rkcif-mipi-lvds/is_use_dummybuf
echo 1 > /proc/sys/vm/overcommit_memory
echo 1 >/proc/sys/vm/overcommit_memory
post_chk &

View File

@ -1,14 +1,14 @@
*.o
#hostapd-2.6/hostapd/hostapd
#hostapd-2.6/hostapd/hostapd_cli
hostapd-2.6/hostapd/hostapd
hostapd-2.6/hostapd/hostapd_cli
install_out
libnl-3.4.0
out
#wifi/lib32/librkwifibt.so
#wifi/librkwifibt.so
#wifi/test/rkwifi_server
#wpa_supplicant-2.6/wpa_supplicant/libwpa_client.so
#wpa_supplicant-2.6/wpa_supplicant/wpa_cli
#wpa_supplicant-2.6/wpa_supplicant/wpa_passphrase
#wpa_supplicant-2.6/wpa_supplicant/wpa_supplicant
#wpa_supplicant_hostapd-0.8_rtw-2-ga8ef7c824.20200911
wifi/lib32/librkwifibt.so
wifi/librkwifibt.so
wifi/test/rkwifi_server
wpa_supplicant-2.6/wpa_supplicant/libwpa_client.so
wpa_supplicant-2.6/wpa_supplicant/wpa_cli
wpa_supplicant-2.6/wpa_supplicant/wpa_passphrase
wpa_supplicant-2.6/wpa_supplicant/wpa_supplicant
wpa_supplicant_hostapd-0.8_rtw-2-ga8ef7c824.20200911

View File

@ -2478,15 +2478,18 @@ function __RUN_POST_BUILD_SCRIPT() {
}
function post_overlay() {
check_config RK_POST_OVERLAY || return 0
[ -n "$RK_POST_OVERLAY" ] || return 0
local tmp_path
tmp_path=$(realpath $BOARD_CONFIG)
tmp_path=$(dirname $tmp_path)
if [ -d "$tmp_path/overlay/$RK_POST_OVERLAY" ]; then
rsync -a --ignore-times --keep-dirlinks --chmod=u=rwX,go=rX --exclude .empty \
$tmp_path/overlay/$RK_POST_OVERLAY/* $RK_PROJECT_PACKAGE_ROOTFS_DIR/
fi
for overlay_dir in $RK_POST_OVERLAY; do
if [ -d "$tmp_path/overlay/$overlay_dir" ]; then
rsync -a --ignore-times --keep-dirlinks --chmod=u=rwX,go=rX --exclude .empty \
$tmp_path/overlay/$overlay_dir/* $RK_PROJECT_PACKAGE_ROOTFS_DIR/
fi
done
}
function __RUN_PRE_BUILD_OEM_SCRIPT() {

View File

@ -117,4 +117,8 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow\
overlay-luckfox-buildroot-rgb"

View File

@ -115,7 +115,7 @@ export LF_WIFI_SSID="Your wifi ssid"
export LF_WIFI_PSK="Your wifi password"
#################################################
# PRE and POST
# PRE and POST
#################################################
# specify pre.sh for delete/overlay files
@ -123,3 +123,7 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow\
overlay-luckfox-buildroot-rgb"

View File

@ -132,7 +132,7 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-rv1106-tb-pre-oem.sh
export RK_ENABLE_FASTBOOT=y
# declare overlay directory
export RK_POST_OVERLAY=overlay-luckfox
export RK_POST_OVERLAY=overlay-luckfox-fastboot
# enable tiny meta only support cmdline overlay
export RK_TINY_META=n

View File

@ -118,3 +118,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu-config overlay-luckfox-ubuntu-ultra"

View File

@ -125,4 +125,7 @@ export LF_WIFI_PSK="Your wifi password"
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu-config overlay-luckfox-ubuntu-ultra"

View File

@ -111,4 +111,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -112,3 +112,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -112,3 +112,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -113,3 +113,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -111,4 +111,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -111,4 +111,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -115,3 +115,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -115,3 +115,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -115,3 +115,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -115,3 +115,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -114,4 +114,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -114,4 +114,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-ubuntu-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-ubuntu overlay-luckfox-ubuntu-config"

View File

@ -112,3 +112,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -111,4 +111,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -112,3 +112,6 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -111,4 +111,7 @@ export RK_ENABLE_ROCKCHIP_TEST=y
export RK_PRE_BUILD_OEM_SCRIPT=luckfox-buildroot-oem-pre.sh
# specify post.sh for delete/overlay files
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
export RK_PRE_BUILD_USERDATA_SCRIPT=luckfox-userdata-pre.sh
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"

View File

@ -138,7 +138,7 @@ export RK_PRE_BUILD_OEM_SCRIPT=luckfox-rv1106-tb-pre-oem.sh
export RK_ENABLE_FASTBOOT=y
# declare overlay directory
export RK_POST_OVERLAY=overlay-luckfox
export RK_POST_OVERLAY=overlay-luckfox-fastboot
# enable tiny meta only support cmdline overlay
export RK_TINY_META=n

View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# sshd Starts sshd.
#
# Make sure the ssh-keygen progam exists
[ -f /usr/bin/ssh-keygen ] || exit 0
umask 077
start() {
chown root:root /var/empty/
# Create any missing keys
/usr/bin/ssh-keygen -A
printf "Starting sshd: "
/usr/sbin/sshd
touch /var/lock/sshd
echo "OK"
}
stop() {
printf "Stopping sshd: "
killall sshd
rm -f /var/lock/sshd
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,27 @@
#!/bin/sh
check_hciconfig() {
if command -v hciattach &> /dev/null; then
if lsmod | grep -q "aic8800_fdrv"; then
hciattach -s 1500000 /dev/ttyS1 any 1500000 flow nosleep&
sleep 2
if hciconfig -a | grep -q "hci0"; then
hciconfig hci0 up&
else
echo "hci0 not found or not available."
fi
else
echo "aic8800_fdrv not found."
fi
fi
}
case $1 in
start)
check_hciconfig
;;
*)
exit 1
;;
esac

View File

@ -0,0 +1,55 @@
#!/bin/sh
#
# python Starts python code.
#
# Make sure the python progam exists
[ -f /usr/bin/python ] || exit 0
umask 077
main_path="/root/main.py"
boot_path="/root/boot.py"
start() {
# Run python progam
if [ -f $main_path ]; then
echo "running $main_path..."
python $main_path
else
if [ -f $boot_path ]; then
echo "running $boot_path..."
python $boot_path
else
echo "$main_path and $boot_path not exist ,pass..."
fi
fi
echo "OK"
}
stop() {
printf "Stopping python: "
killall python
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,16 @@
#!/bin/sh
case $1 in
start)
if [ "$(hwclock | grep "1969")" ]; then
echo "RTC time calibration"
date -s 2024-01-01
hwclock -w
else
echo "RTC does not require time calibration"
fi
;;
*)
exit 1
;;
esac

View File

@ -0,0 +1,67 @@
#!/bin/sh
TARGET_IP="172.32.0.93"
USB_KEYWORD="android_work: sent uevent USB_STATE="
USB_MODE_PATH="/proc/device-tree/usbdrd/usb@ffb00000/dr_mode"
MAX_RETRIES=10
retries=0
usb0_config() {
if [ "$(cat /proc/device-tree/usbdrd/usb@ffb00000/dr_mode)" == "peripheral" ]; then
current_ip=$(ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}')
echo "current_ip = $current_ip"
echo "TARGET_IP = $TARGET_IP"
while [[ "$current_ip" != "$TARGET_IP" && $retries -lt $MAX_RETRIES ]]; do
sleep .5
echo "luckfox : set usb0 ip"
ifconfig usb0 "$TARGET_IP"
current_ip=$(ifconfig usb0 | grep -o 'inet addr:[^ ]*' | awk -F ':' '{print $2}')
echo $current_ip
retries=$((retries + 1))
done
if [[ "$current_ip" != "$TARGET_IP" ]]; then
echo "usb0 config error"
else
echo "usb0 config success"
fi
else
echo "usb0 is using host mode"
fi
}
usb_reset() {
while true; do
last_line=$(dmesg | grep "$USB_KEYWORD" | tail -n 1)
if [[ "$last_line" == *"DISCONNECTED"* ]]; then
echo "Detected USB DISCONNECTED."
/etc/init.d/S50usbdevice restart
usb0_config
#elif [[ "$last_line" == *"CONFIGURED"* ]]; then
# echo "Detected CONFIGURED. No action required."
#else
# echo "No relevant USB_STATE found."
fi
sleep 5
done
}
case $1 in
start)
# check peripheral
usb_mode="$(cat $USB_MODE_PATH)"
if [ "$usb_mode" = "peripheral" ]; then
usb0_config
usb_reset &
fi
;;
stop) ;;
*)
exit 1
;;
esac

View File

@ -0,0 +1,24 @@
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export EDITOR='/bin/vi'
#export PS1='[\u@\h \W]# '
if [ "$PS1" ]; then
if [ "`id -u`" -eq 0 ]; then
#export PS1='# '
export PS1='[\u@\h \W]# '
else
#export PS1='$ '
export PS1='[\u@\h \W]$ '
fi
fi
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i

View File

@ -0,0 +1,9 @@
root:$1$dXmV8ZLO$eNAQzSYOgRkYMJRdsHwLS1:19664::::::
daemon:*:::::::
bin:*:::::::
sys:*:::::::
sync:*:::::::
mail:*:::::::
www-data:*:::::::
operator:*:::::::
nobody:*:::::::

View File

@ -0,0 +1,13 @@
[global]
workgroup = WORKGROUP
server string = luckfox samba server
security = user
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
[public]
comment = public share
path = /
read only = no
user = root
create mask = 0755
directory mask = 0755

View File

@ -0,0 +1 @@
root:0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:EF8BDD6C516032CDB7C15080FFE1B2D5:[U ]:LCT-5FEF3549:

View File

@ -0,0 +1,116 @@
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/bin:/sbin:/usr/bin:/usr/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
#KbdInteractiveAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server

View File

@ -0,0 +1,20 @@
#!/bin/sh
load_luckfoxconfig() {
if [ -f /usr/bin/luckfox-config ]; then
luckfox-config load
fi
if [ "$(cat /proc/device-tree/model)" == "Luckfox Pico Ultra" ] ||
[ "$(cat /proc/device-tree/model)" == "Luckfox Pico Ultra W" ]; then
luckfox_switch_rgb_resolution &
fi
}
case $1 in
start)
load_luckfoxconfig
;;
*)
exit 1
;;
esac

View File

@ -0,0 +1,206 @@
#!/bin/bash
LUCKFOX_FDT_DTB=/tmp/.fdt.dtb
LUCKFOX_FDT_HDR_DTB=/tmp/.fdt_header.dtb
LUCKFOX_FDT_HDR_OVERLAY_DTS=/tmp/.fdt_header_overlay.dts
LUCKFOX_FDT_HDR_OVERLAY_DTBO=/tmp/.fdt_header_overlay.dtbo
LUCKFOX_FDT_DUMP_TXT=/tmp/.fdt_dump.txt
LF_CUSTOM_DTS_PATH="/mnt/cfg"
SYS_OVERLAYS_PATH="/sys/kernel/config/device-tree/overlays"
LUCKFOX_CHIP_MEDIA_CLASS="emmc"
LUCKFOX_CHIP_MEDIA="/dev/mmcblk0p4"
function luckfox_tools_check() {
if ! command -v dialog &>/dev/null; then
echo "The dialog is not installed "
exit
fi
if ! command -v dtc &>/dev/null; then
echo "The dtc is not installed"
exit
fi
# get media class dev
if [[ -e /dev/mmcblk0p4 ]]; then
LUCKFOX_CHIP_MEDIA_CLASS="emmc"
LUCKFOX_CHIP_MEDIA=/dev/mmcblk0p4
elif [[ -e /dev/mmcblk1p4 ]]; then
LUCKFOX_CHIP_MEDIA_CLASS="sdmmc"
LUCKFOX_CHIP_MEDIA=/dev/mmcblk1p4
luckfox_set_pin_parameter "SDMMC" 1
elif [[ -e /dev/mtdblock3 ]]; then
LUCKFOX_CHIP_MEDIA_CLASS="spi_nand"
LUCKFOX_CHIP_MEDIA=/dev/mtdblock3
else
LUCKFOX_CHIP_MEDIA_CLASS="unknown"
echo "Do not know the storage medium of Luckfox!"
exit
fi
}
# -- Static Overlay --
function luckfox_sha256_convert() {
local sha256_hash=$1
local formatted_hash=""
for ((i = 0; i < ${#sha256_hash}; i += 8)); do
formatted_hash+="0x${sha256_hash:$i:8} "
done
echo "$formatted_hash"
}
function luckfox_update_fdt() {
# get fdt_header
local origin_fdt_size_hex origin_fdt_size
dd if=$LUCKFOX_CHIP_MEDIA of=$LUCKFOX_FDT_HDR_DTB bs=1 skip=0 count=2048 >/dev/null 2>&1
# get size
if [ ! -f $LUCKFOX_FDT_HDR_DTB ]; then
echo "$LUCKFOX_FDT_HDR_DTB can't be found!"
return
fi
origin_fdt_size_hex=$(fdtdump $LUCKFOX_FDT_HDR_DTB | grep -A 5 "fdt {" | grep "data-size" | awk '{print $3}' | tr -d ';<>')
origin_fdt_size=$(printf "%d\n" "$origin_fdt_size_hex")
# get fdt dtb
dd if=$LUCKFOX_CHIP_MEDIA of=$LUCKFOX_FDT_DTB bs=1 skip=2048 count="$origin_fdt_size" >/dev/null 2>&1
# create fdt dump
if [ ! -f $LUCKFOX_FDT_DTB ]; then
echo "$LUCKFOX_FDT_DTB can't be found!"
return
fi
fdtdump $LUCKFOX_FDT_DTB >$LUCKFOX_FDT_DUMP_TXT
}
function luckfox_fdt_overlay() {
#region
local fdt_overlay_dtbo="$1"
local fdt_dtb_size fdt_size fdt_size_hex fdt_hash_data
fdtoverlay -i $LUCKFOX_FDT_DTB -o $LUCKFOX_FDT_DTB "$fdt_overlay_dtbo" >/dev/null 2>&1
fdt_dtb_size=$(ls -la $LUCKFOX_FDT_DTB | awk '{print $5}')
kernel_offset=$(fdtdump $LUCKFOX_FDT_HDR_DTB | grep -A 2 "kernel {" | grep "data-position" | sed -n 's/.*<\(0x[0-9a-fA-F]*\)>.*/\1/p')
fdt_offset=$(fdtdump $LUCKFOX_FDT_HDR_DTB | grep -A 2 "fdt {" | grep "data-position" | sed -n 's/.*<\(0x[0-9a-fA-F]*\)>.*/\1/p')
kernel_offset_dec=$((kernel_offset))
fdt_offset_dec=$((fdt_offset))
result_dec=$((kernel_offset_dec - fdt_offset_dec))
if [ $result_dec -lt "$fdt_dtb_size" ]; then
echo "Kernel will be affected !"
fi
dd if=$LUCKFOX_FDT_DTB of=$LUCKFOX_CHIP_MEDIA bs=1 seek=2048 count="$fdt_dtb_size" >/dev/null 2>&1
# fdt header
if [ ! -f $LUCKFOX_FDT_DTB ]; then
echo "$LUCKFOX_FDT_DTB can't be found!"
return
fi
fdt_size=$(ls -la $LUCKFOX_FDT_DTB | awk '{print $5}')
fdt_size_hex=$(printf "%x\n" "$fdt_size")
fdt_hash_data=$(luckfox_sha256_convert "$(sha256sum $LUCKFOX_FDT_DTB | awk '{print $1}')")
fdt_header_content="
/dts-v1/;
/plugin/;
&{/images/fdt}{
data-size=<0x$fdt_size_hex>;
hash{
value=<$fdt_hash_data>;
};
};
"
echo "$fdt_header_content" >$LUCKFOX_FDT_HDR_OVERLAY_DTS
dtc -I dts -O dtb $LUCKFOX_FDT_HDR_OVERLAY_DTS -o $LUCKFOX_FDT_HDR_OVERLAY_DTBO
if [ ! -f $LUCKFOX_FDT_HDR_OVERLAY_DTBO ]; then
echo "$LUCKFOX_FDT_HDR_OVERLAY_DTBO can't found!"
return
fi
fdtoverlay -i $LUCKFOX_FDT_HDR_DTB -o $LUCKFOX_FDT_HDR_DTB $LUCKFOX_FDT_HDR_OVERLAY_DTBO >/dev/null 2>&1
dd if=$LUCKFOX_FDT_HDR_DTB of=$LUCKFOX_CHIP_MEDIA bs=1 seek=0 count=2048 >/dev/null 2>&1
#endregion
}
# Load the device tree dynamically
function luckfox_load_dynamic_dts() {
local dtbo_node_name
if [ ! -d ${LF_CUSTOM_DTS_PATH}/dtbo/ ]; then
exit 1
#echo "Can't find ${LF_CUSTOM_DTS_PATH}/dtbo dir !"
fi
for dts_file in ${LF_CUSTOM_DTS_PATH}/dtbo/*.dts; do
#Get DTBO name
dtbo_node_name="$(basename "$dts_file" .dts)"
#Check DTBO path
if [ -d "${SYS_OVERLAYS_PATH}/${dtbo_node_name}" ]; then
echo "Node is exist"
continue
fi
#DTS->DTBO
dtc -I dts -O dtb ${LF_CUSTOM_DTS_PATH}/dtbo/${dtbo_node_name}.dts -o \
${LF_CUSTOM_DTS_PATH}/dtbo/${dtbo_node_name}.dtbo
if [ ! -f "${LF_CUSTOM_DTS_PATH}/dtbo/${dtbo_node_name}.dtbo" ]; then
echo "${dtbo_node_name}.dts to dtbo error!"
continue
else
mkdir -p ${SYS_OVERLAYS_PATH}/${dtbo_node_name}
fi
#Load and enable DTBO
cat ${LF_CUSTOM_DTS_PATH}/dtbo/${dtbo_node_name}.dtbo > \
${SYS_OVERLAYS_PATH}/${dtbo_node_name}/dtbo
echo 1 >${SYS_OVERLAYS_PATH}/${dtbo_node_name}/status
rm ${LLF_CUSTOM_DTS_PATH}/dtbo/${dtbo_node_name}.dtbo
done
}
#Overwrite the disk device tree (requires restart)
function luckfox_load_static_dts() {
local dtbo_node_name
if [ ! -d ${LF_CUSTOM_DTS_PATH}/fdt_overlay/ ]; then
echo "Can't find ${LF_CUSTOM_DTS_PATH}/fdt_overlay dir!"
fi
for dts_file in ${LF_CUSTOM_DTS_PATH}/fdt_overlay/*.dts; do
#Get DTBO name
dtbo_node_name="$(basename "$dts_file" .dts)"
#DTS->DTBO
dtc -I dts -O dtb ${LF_CUSTOM_DTS_PATH}/fdt_overlay/${dtbo_node_name}.dts -o \
${LF_CUSTOM_DTS_PATH}/fdt_overlay/${dtbo_node_name}.dtbo
if [ ! -f "${LF_CUSTOM_DTS_PATH}/fdt_overlay/${dtbo_node_name}.dtbo" ]; then
echo "${dtbo_node_name}.dts to dtbo error!"
continue
fi
# load to disk
luckfox_update_fdt
luckfox_fdt_overlay ${LF_CUSTOM_DTS_PATH}/fdt_overlay/${dtbo_node_name}.dtbo
rm ${LUCKFOX_FDT_OVERLAY_DTBO}
done
}
case $1 in
start)
luckfox_load_dynamic_dts
;;
stop)
luckfox_tools_check
luckfox_load_static_dts
;;
*)
exit 1
;;
esac

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
libfdt.so.1.7.0

View File

@ -0,0 +1,4 @@
# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/mmcblk0p7 / ext4 rw 0 0
/dev/mmcblk0p5 /oem ext4 defaults 0 0
/dev/mmcblk0p6 /userdata ext4 defaults 0 0

View File

@ -0,0 +1,11 @@
#!/bin/bash
/usr/bin/filesystem_resize.sh
/usr/bin/wifi_bt_init.sh
/usr/bin/luckfox_switch_rgb_resolution &
/etc/init.d/S50usbdevice start
luckfox-config load
if [ -n "$(hwclock | grep "invalid")" ]; then
date -s 2024-01-01
hwclock -w
fi

View File

@ -0,0 +1,116 @@
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 192.168.0.20 #default: 192.168.0.20
end 192.168.0.254 #default: 192.168.0.254
# The interface that udhcpd will use
interface eth0 #default: eth0
# The maximim number of leases (includes addressesd reserved
# by OFFER's, DECLINE's, and ARP conficts
#max_leases 254 #default: 254
# If remaining is true (default), udhcpd will store the time
# remaining for each lease in the udhcpd leases file. This is
# for embedded systems that cannot keep time between reboots.
# If you set remaining to no, the absolute time that the lease
# expires at will be stored in the dhcpd.leases file.
#remaining yes #default: yes
# The time period at which udhcpd will write out a dhcpd.leases
# file. If this is 0, udhcpd will never automatically write a
# lease file. (specified in seconds)
#auto_time 7200 #default: 7200 (2 hours)
# The amount of time that an IP will be reserved (leased) for if a
# DHCP decline message is received (seconds).
#decline_time 3600 #default: 3600 (1 hour)
# The amount of time that an IP will be reserved (leased) for if an
# ARP conflct occurs. (seconds
#conflict_time 3600 #default: 3600 (1 hour)
# How long an offered address is reserved (leased) in seconds
#offer_time 60 #default: 60 (1 minute)
# If a lease to be given is below this value, the full lease time is
# instead used (seconds).
#min_lease 60 #defult: 60
# The location of the leases file
#lease_file /var/lib/misc/udhcpd.leases #defualt: /var/lib/misc/udhcpd.leases
# The location of the pid file
#pidfile /var/run/udhcpd.pid #default: /var/run/udhcpd.pid
# Everytime udhcpd writes a leases file, the below script will be called.
# Useful for writing the lease file to flash every few hours.
#notify_file #default: (no script)
#notify_file dumpleases # <--- usefull for debugging
# The following are bootp specific options, setable by udhcpd.
#siaddr 192.168.0.22 #default: 0.0.0.0
#sname zorak #default: (none)
#boot_file /var/nfs_root #default: (none)
# The remainer of options are DHCP options and can be specifed with the
# keyword 'opt' or 'option'. If an option can take multiple items, such
# as the dns option, they can be listed on the same line, or multiple
# lines. The only option with a default is 'lease'.
#Examles
opt dns 192.168.10.2 192.168.10.10
option subnet 255.255.255.0
opt router 192.168.10.2
opt wins 192.168.10.10
option dns 129.219.13.81 # appened to above DNS servers for a total of 3
option domain local
option lease 864000 # 10 days of seconds
# Currently supported options, for more info, see options.c
#subnet
#timezone
#router
#timesvr
#namesvr
#dns
#logsvr
#cookiesvr
#lprsvr
#bootsize
#domain
#swapsvr
#rootpath
#ipttl
#mtu
#broadcast
#wins
#lease
#ntpsrv
#tftp
#bootfile

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Check if the filesystem has been resized previously
if [ ! -f /etc/.filesystem_resized ]; then
# Perform filesystem resize
sudo resize2fs /dev/mmcblk0p5
sudo resize2fs /dev/mmcblk0p6
sudo resize2fs /dev/mmcblk0p7
# Create a marker file indicating filesystem resize has been done
sudo touch /etc/.filesystem_resized
echo "Filesystem resized successfully."
fi
if [ ! -f /etc/.filesystem_swap ]; then
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile >/dev/null
sudo swapon /swapfile >/dev/null
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab >/dev/null
sudo touch /etc/.filesystem_swap
echo "Swap successfully."
fi

View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ "$(cat /proc/device-tree/model)" == "Luckfox Pico Ultra W" ]; then
systemctl stop wpa_supplicant
if [ -d /oem/usr/ko ]; then
cd /oem/usr/ko
if [ -z "$(ifconfig | grep "wlan0")" ]; then
insmod cfg80211.ko
insmod libarc4.ko
insmod ctr.ko
insmod ccm.ko
insmod aes_generic.ko
insmod aic8800_bsp.ko
sleep 0.2
insmod aic8800_fdrv.ko
sleep 2
insmod aic8800_btlpm.ko
else
# wait systemctl
sleep 0.5
fi
else
echo "Missing ko files!"
fi
if [ -d /var/run/wpa_supplicant ]; then
rm /var/run/wpa_supplicant/ -rf
fi
if [ -f /etc/wpa_supplicant.conf ] && [ -n "$(ifconfig | grep "wlan0")" ]; then
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf >/dev/null
chmod a+x /usr/share/udhcpc/default.script
fi
else
echo "This Luckfox Pico model don't support WIFI!"
fi

View File

@ -0,0 +1,39 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
for i in $router ; do
route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0

View File

@ -0,0 +1,9 @@
#!/bin/bash
/usr/bin/filesystem_resize.sh
/etc/init.d/S50usbdevice start
luckfox-config load
if [ -n "$(hwclock | grep "invalid")" ]; then
date -s 2024-01-01
hwclock -w
fi

View File

@ -640,23 +640,6 @@ ifeq ($(SYSDRV_BUILD_RAMDISK_FLAG),YES)
endif
else
tar xf $(BUILDROOT_DIR)/$(BUILDROOT_VER)/output/images/rootfs.tar -C $(SYSDRV_DIR_OUT_ROOTFS)
#cp $(SYSDRV_DIR)/tools/board/buildroot/busybox $(SYSDRV_DIR_OUT_ROOTFS)/bin/busybox
cp $(SYSDRV_DIR)/tools/board/buildroot/shadow_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/shadow
cp $(SYSDRV_DIR)/tools/board/buildroot/sshd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/ssh/sshd_config
mkdir -p $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba
cp $(SYSDRV_DIR)/tools/board/buildroot/samba_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smb.conf
cp $(SYSDRV_DIR)/tools/board/buildroot/smbpasswd_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/samba/smbpasswd
cp $(SYSDRV_DIR)/tools/board/buildroot/profile_defconfig $(SYSDRV_DIR_OUT_ROOTFS)/etc/profile
cp $(SYSDRV_DIR)/tools/board/buildroot/iomux $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/
cp $(SYSDRV_DIR)/tools/board/buildroot/S99hciinit $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/buildroot/S99rtcinit $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/buildroot/S50sshd $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/buildroot/S99python $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/S99luckfoxconfigload $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/S99luckfoxcustomoverlay $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/luckfox-config $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/luckfox_switch_rgb_resolution $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/
cp $(SYSDRV_DIR)/tools/board/android-tools/S99usb0config $(SYSDRV_DIR_OUT_ROOTFS)/etc/init.d/
endif
buildroot_clean:
@ -680,22 +663,6 @@ ubuntu: prepare
rm $(SYSDRV_DIR_OUT_ROOTFS)/* -rf ;\
tar xzf $(SYSDRV_DIR)/tools/board/ubuntu/$(UBUNTU_VER).tar.gz -C $(SYSDRV_DIR_OUT_ROOTFS) ;\
);
cp $(SYSDRV_DIR)/tools/board/luckfox_config/luckfox-config ${SYSDRV_DIR_OUT_ROOTFS}/usr/bin/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/ubuntu/etc/* ${SYSDRV_DIR_OUT_ROOTFS}/etc/
cp $(SYSDRV_DIR)/tools/board/luckfox_config/ubuntu/usr/bin/* ${SYSDRV_DIR_OUT_ROOTFS}/usr/bin/
cp -d $(SYSDRV_DIR)/tools/board/luckfox_config/ubuntu/usr/lib/* ${SYSDRV_DIR_OUT_ROOTFS}/usr/lib/
ifeq ($(ENABLE_EMMC),YES)
cp $(SYSDRV_DIR)/tools/board/emmc/emmc_fstab $(SYSDRV_DIR_OUT_ROOTFS)/etc/fstab
cp $(SYSDRV_DIR)/tools/board/emmc/emmc_filesystem_resize.sh $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/filesystem_resize.sh
cp $(SYSDRV_DIR)/tools/board/emmc/emmc_rc.local $(SYSDRV_DIR_OUT_ROOTFS)/etc/rc.local
cp $(SYSDRV_DIR)/tools/board/emmc/emmc_wifi_bt_init.sh $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/wifi_bt_init.sh
#cp $(SYSDRV_DIR)/tools/board/emmc/emmc_wifi_ko $(SYSDRV_DIR_OUT_ROOTFS)/usr/ko -r
cp $(SYSDRV_DIR)/tools/board/emmc/udhcp/usr/bin/udhcpc $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/udhcpc
cp $(SYSDRV_DIR)/tools/board/emmc/udhcp/usr/bin/udhcpd $(SYSDRV_DIR_OUT_ROOTFS)/usr/bin/udhcpd
mkdir -p $(SYSDRV_DIR_OUT_ROOTFS)/usr/share/udhcpc
cp $(SYSDRV_DIR)/tools/board/emmc/udhcp/usr/share/udhcpc/default.script $(SYSDRV_DIR_OUT_ROOTFS)/usr/share/udhcpc/default.script
cp $(SYSDRV_DIR)/tools/board/emmc/udhcp/etc/udhcpd.conf $(SYSDRV_DIR_OUT_ROOTFS)/etc/udhcpd.conf
endif
ubuntu_clean:
$(AT)rm -rf $(SYSDRV_DIR_OUT_ROOTFS)

View File

@ -92,3 +92,5 @@ BR2_PACKAGE_BZIP2=y
BR2_PACKAGE_GZIP=y
BR2_PACKAGE_PIXZ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBDRM_INSTALL_TESTS=y