From 4913f3da5096918e23382cc98d56bc0888f2db2d Mon Sep 17 00:00:00 2001 From: jcomas Date: Thu, 9 Jan 2025 18:45:07 +0100 Subject: [PATCH] Add Alpine Linux support for the Luckfox Pico Max board using NAND flash --- project/build.sh | 42 +++++- ...NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk | 127 ++++++++++++++++++ .../BoardConfig_IPC/luckfox-alpine-post.sh | 23 ++++ .../etc/crontabs/root | 9 ++ .../etc/firstboot | 0 .../overlay-luckfox-alpine-spi_nand/etc/fstab | 20 +++ .../etc/hostname | 1 + .../overlay-luckfox-alpine-spi_nand/etc/hosts | 2 + .../etc/init.d/ubiattach | 13 ++ .../etc/inittab | 24 ++++ .../etc/local.d/crond.start | 26 ++++ .../overlay-luckfox-alpine-spi_nand/etc/motd | 1 + .../etc/network/interfaces | 2 + .../etc/ntp.conf | 4 + .../etc/resolv.conf | 2 + .../etc/securetty | 1 + .../etc/timezone | 1 + .../sbin/firstboot.sh | 92 +++++++++++++ .../usr/bin/iomux | Bin 0 -> 10568 bytes 19 files changed, 386 insertions(+), 4 deletions(-) create mode 100755 project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk create mode 100755 project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/crontabs/root create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/firstboot create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/fstab create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hostname create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hosts create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/init.d/ubiattach create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/inittab create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/local.d/crond.start create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/motd create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/network/interfaces create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/ntp.conf create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/resolv.conf create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/securetty create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/timezone create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/sbin/firstboot.sh create mode 100644 project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/usr/bin/iomux diff --git a/project/build.sh b/project/build.sh index 9779b91fa..891980a31 100755 --- a/project/build.sh +++ b/project/build.sh @@ -159,7 +159,7 @@ function choose_target_board() { "RV1106_Luckfox_Pico_Ultra" "RV1106_Luckfox_Pico_Ultra_W") local LF_BOOT_MEDIA=("SD_CARD" "SPI_NAND" "EMMC") - local LF_SYSTEM=("Buildroot" "Ubuntu" "Custom") + local LF_SYSTEM=("Buildroot" "Alpine" "Ubuntu" "Custom") local cnt=0 space8=" " # Get Hardware Version @@ -313,8 +313,13 @@ function choose_target_board() { if (("$BM_INDEX" == 1)); then echo "${space8}${space8}[0] Buildroot(Support Rockchip official features) " + if [[ "$HW_INDEX" == 6 ]]; then + echo "${space8}${space8}[1] Alpine Linux (Support for the apk package keeper tool)" + MAX_SYS_INDEX=1 + else + MAX_SYS_INDEX=0 + fi read -p "Which would you like? [0~1][default:0]: " SYS_INDEX - MAX_SYS_INDEX=0 elif (("$BM_INDEX" == 0)); then echo "${space8}${space8}[0] Buildroot(Support Rockchip official features) " echo "${space8}${space8}[1] Ubuntu(Support for the apt package management tool)" @@ -885,7 +890,36 @@ function build_kernel() { function build_rootfs() { check_config RK_BOOT_MEDIUM || return 0 - make rootfs -C ${SDK_SYSDRV_DIR} + if [ "$LF_TARGET_ROOTFS" = "alpine" ]; then + mkdir -p ${SDK_SYSDRV_DIR}/source/alpine + cd ${SDK_SYSDRV_DIR}/source/alpine + + # Get YAML content from the latest stable release + local yaml_url="https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armv7/latest-releases.yaml" + local yaml_content=$(wget -q -O - $yaml_url) + + # Extract minirootfs information from YAML + local start_line=$(echo "$yaml_content" | grep -n "Mini root filesystem" | cut -d: -f1) + local file_name=$(echo "$yaml_content" | tail -n +$start_line | grep "file:" | head -n 1 | cut -d: -f2 | tr -d ' ') + local file_sha256=$(echo "$yaml_content" | tail -n +$start_line | grep "sha256:" | head -n 1 | cut -d: -f2 | tr -d ' ') + local file_url="https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armv7/${file_name}" + + # Download minirootfs + wget $file_url + + # Verify checksum + if ! echo "${file_sha256} ${file_name}" | sha256sum -c --status; then + msg_error "SHA256 verification failed for ${file_name}" + exit 1 + fi + + mkdir -p tmp/rootfs_${RK_LIBC_TPYE}_${RK_CHIP} + tar xf ${file_name} -C tmp/rootfs_${RK_LIBC_TPYE}_${RK_CHIP} + tar czf $RK_PROJECT_PATH_SYSDRV/rootfs_${RK_LIBC_TPYE}_${RK_CHIP}.tar -C tmp . + rm -rf tmp ${file_name} + else + make rootfs -C ${SDK_SYSDRV_DIR} + fi __LINK_DEFCONFIG_FROM_BOARD_CFG @@ -2595,8 +2629,8 @@ function build_firmware() { rm -rf $RK_PROJECT_PACKAGE_OEM_DIR fi - __RUN_POST_BUILD_SCRIPT post_overlay + __RUN_POST_BUILD_SCRIPT if [ -n "$GLOBAL_INITRAMFS_BOOT_NAME" ]; then build_mkimg boot $RK_PROJECT_PACKAGE_ROOTFS_DIR diff --git a/project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk b/project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk new file mode 100755 index 000000000..6aa1b9bf0 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk @@ -0,0 +1,127 @@ +#!/bin/bash + +################################################# +# Board Config +################################################# +export LF_ORIGIN_BOARD_CONFIG=BoardConfig-SPI_NAND-Alpine-RV1106_Luckfox_Pico_Max-IPC.mk +# Target CHIP +export RK_CHIP=rv1106 + +# app config +#export RK_APP_TYPE=RKIPC_RV1106 + +# Config CMA size in environment +export RK_BOOTARGS_CMA_SIZE="1M" + +# Kernel dts +export RK_KERNEL_DTS=rv1106g-luckfox-pico-max.dts + +################################################# +# BOOT_MEDIUM +################################################# + +# Target boot medium: emmc/spi_nor/spi_nand +export RK_BOOT_MEDIUM=spi_nand + +# Uboot defconfig fragment +export RK_UBOOT_DEFCONFIG_FRAGMENT=rk-sfc.config + +# specify post.sh for delete/overlay files +# export RK_PRE_BUILD_OEM_SCRIPT=rv1103-spi_nor-post.sh + +# config partition in environment +# RK_PARTITION_CMD_IN_ENV format: +# [,] +# := [@](part-name) +# Note: +# If the first partition offset is not 0x0, it must be added. Otherwise, it needn't adding. +export RK_PARTITION_CMD_IN_ENV="256K(env),256K@256K(idblock),512K(uboot),4M(boot),30M(oem),10M(userdata),210M(rootfs)" + +# config partition's filesystem type (squashfs is readonly) +# emmc: squashfs/ext4 +# nand: squashfs/ubifs +# spi nor: squashfs/jffs2 +# RK_PARTITION_FS_TYPE_CFG format: +# AAAA:/BBBB/CCCC@ext4 +# AAAA ----------> partition name +# /BBBB/CCCC ----> partition mount point +# ext4 ----------> partition filesystem type +export RK_PARTITION_FS_TYPE_CFG=rootfs@IGNORE@ubifs,oem@/oem@ubifs,userdata@/userdata@ubifs + +# config filesystem compress (Just for squashfs or ubifs) +# squashfs: lz4/lzo/lzma/xz/gzip, default xz +# ubifs: lzo/zlib, default lzo +# export RK_SQUASHFS_COMP=xz +# export RK_UBIFS_COMP=lzo + +################################################# +# TARGET_ROOTFS +################################################# + +# Target rootfs : ubuntu(only emmc)/buildroot/busybox +export LF_TARGET_ROOTFS=alpine + +# SUBMODULES : github/gitee +#export LF_SUBMODULES_BY=github + +# Buildroot defconfig +export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig + +################################################# +# Defconfig +################################################# + +# Target arch +export RK_ARCH=arm + +# Target Toolchain Cross Compile +export RK_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf + +#misc image +export RK_MISC=wipe_all-misc.img + +# Uboot defconfig +export RK_UBOOT_DEFCONFIG=luckfox_rv1106_uboot_defconfig + +# Kernel defconfig +export RK_KERNEL_DEFCONFIG=luckfox_rv1106_linux_defconfig + +# Config sensor IQ files +# RK_CAMERA_SENSOR_IQFILES format: +# "iqfile1 iqfile2 iqfile3 ..." +# ./build.sh media and copy /output/out/media_out/isp_iqfiles/$RK_CAMERA_SENSOR_IQFILES +export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json" +#export RK_CAMERA_SENSOR_IQFILES="sc4336_OT01_40IRC_F16.json sc3336_CMK-OT2119-PC1_30IRC-F16.json sc530ai_CMK-OT2115-PC1_30IRC-F16.json" + +# Config sensor lens CAC calibrattion bin files +export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16" +#export RK_CAMERA_SENSOR_CAC_BIN="CAC_sc4336_OT01_40IRC_F16 CAC_sc530ai_CMK-OT2115-PC1_30IRC-F16" + +# build ipc web backend +#export RK_APP_IPCWEB_BACKEND=y + +# enable install app to oem partition +export RK_BUILD_APP_TO_OEM_PARTITION=y + +# enable rockchip test +export RK_ENABLE_ROCKCHIP_TEST=y + +################################################# +# PRE and POST +################################################# + +# specify pre.sh for delete/overlay files +#export RK_PRE_BUILD_OEM_SCRIPT=luckfox-alpine-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-alpine-config overlay-luckfox-alpine-max" +export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-alpine-spi_nand" + +# Configure custom image directory +#export RK_CUSTOM_ROOTFS=../sysdrv/custom_rootfs/alpine.tar.gz + +# specify post.sh for delete/overlay files +export RK_POST_BUILD_SCRIPT=luckfox-alpine-post.sh diff --git a/project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh b/project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh new file mode 100755 index 000000000..824932355 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#function copy_data() { + # for writable, package them to userdata parition +# mkdir -p $RK_PROJECT_PACKAGE_USERDATA_DIR + #cp -r $RK_PROJECT_PATH_APP/userdata/* $RK_PROJECT_PACKAGE_USERDATA_DIR +#} + +function change_mode() { + chmod +x $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/firstboot + chmod +x $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/init.d/ubiattach + chmod +x $RK_PROJECT_PACKAGE_ROOTFS_DIR/etc/local.d/crond.start + chmod +x $RK_PROJECT_PACKAGE_ROOTFS_DIR/sbin/firstboot.sh + chmod +x $RK_PROJECT_PACKAGE_ROOTFS_DIR/usr/bin/iomux +} + +#========================= +# post +#========================= +#remove_data +#copy_data +change_mode +#rewrite_script diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/crontabs/root b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/crontabs/root new file mode 100644 index 000000000..69b132234 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/crontabs/root @@ -0,0 +1,9 @@ +# do daily/weekly/monthly maintenance +# min hour day month weekday command +*/15 * * * * run-parts /etc/periodic/15min +0 * * * * run-parts /etc/periodic/hourly +0 2 * * * run-parts /etc/periodic/daily +0 3 * * 6 run-parts /etc/periodic/weekly +0 5 1 * * run-parts /etc/periodic/monthly + +0 */6 * * * /usr/sbin/ntpd -q && /sbin/hwclock -w diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/firstboot b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/firstboot new file mode 100644 index 000000000..e69de29bb diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/fstab b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/fstab new file mode 100644 index 000000000..1b9cf8b8d --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/fstab @@ -0,0 +1,20 @@ +# Storage devices +/dev/cdrom /media/cdrom iso9660 noauto,ro 0 0 +/dev/usbdisk /media/usb vfat noauto,ro 0 0 +/dev/mmcblk1p1 /mnt/sd auto defaults 0 0 + +# UBI and storage volumes +ubi0:rootfs / ubifs rw,relatime 0 0 +ubi1:userdata /userdata ubifs rw,noatime 0 0 +ubi2:oem /oem ubifs rw,noatime 0 0 + +# System mounts +devtmpfs /dev devtmpfs rw,nosuid,noexec,mode=755 0 0 +proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 +tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0 +devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620,ptmxmode=000 0 0 +tmpfs /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0 +sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0 + +# Temp storage +tmpfs /tmp tmpfs rw,nosuid,nodev 0 0 diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hostname b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hostname new file mode 100644 index 000000000..f97e5ce09 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hostname @@ -0,0 +1 @@ +Luckfox diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hosts b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hosts new file mode 100644 index 000000000..c5660309a --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/hosts @@ -0,0 +1,2 @@ +127.0.0.1 localhost localhost.localdomain luckfox +::1 localhost localhost.localdomain luckfox diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/init.d/ubiattach b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/init.d/ubiattach new file mode 100644 index 000000000..fdef91e41 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/init.d/ubiattach @@ -0,0 +1,13 @@ +#!/sbin/openrc-run + +depend() { + need devfs + before localmount +} + +start() { + ebegin "Attaching UBI volumes" + ubiattach /dev/ubi_ctrl -m 5 + ubiattach /dev/ubi_ctrl -m 4 + eend $? "Failed to attach UBI volumes" +} diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/inittab b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/inittab new file mode 100644 index 000000000..9197012cf --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/inittab @@ -0,0 +1,24 @@ +# /etc/inittab + +::sysinit:/sbin/firstboot.sh +::sysinit:/sbin/openrc sysinit +::sysinit:/sbin/openrc boot +::wait:/sbin/openrc default + +# Set up a couple of getty's +#tty1::respawn:/sbin/getty 38400 tty1 +#tty2::respawn:/sbin/getty 38400 tty2 +#tty3::respawn:/sbin/getty 38400 tty3 +#tty4::respawn:/sbin/getty 38400 tty4 +#tty5::respawn:/sbin/getty 38400 tty5 +#tty6::respawn:/sbin/getty 38400 tty6 + +# Put a getty on the serial port +#ttyS0::respawn:/sbin/getty -L 115200 ttyS0 vt100 +ttyFIQ0::respawn:/bin/sh -l + +# Stuff to do for the 3-finger salute +::ctrlaltdel:/sbin/reboot + +# Stuff to do before rebooting +::shutdown:/sbin/openrc shutdown diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/local.d/crond.start b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/local.d/crond.start new file mode 100644 index 000000000..7e56670c4 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/local.d/crond.start @@ -0,0 +1,26 @@ +#!/bin/sh + +# Start the cron daemon +crond + +# Maximum wait time in seconds +MAX_WAIT=30 + +# Time counter +SECONDS=0 + +# Wait for the eth0 interface to get an IP address, but no more than MAX_WAIT seconds +while ! ip a show eth0 | grep 'inet ' > /dev/null 2>&1; do + sleep 1 + SECONDS=$((SECONDS + 1)) + if [ $SECONDS -ge $MAX_WAIT ]; then + echo "Timeout. The eth0 interface did not obtain an IP address." + break + fi +done + +# Synchronize system time with NTP server +ntpd -q && hwclock -w || (hwclock -r && hwclock -s) + +# Turn off work LED to indicate process completion +echo 0 > /sys/class/leds/work/brightness diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/motd b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/motd new file mode 100644 index 000000000..8ee487347 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/motd @@ -0,0 +1 @@ +Welcome to Alpine for Luckfox! diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/network/interfaces b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/network/interfaces new file mode 100644 index 000000000..81922cea6 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/network/interfaces @@ -0,0 +1,2 @@ +auto eth0 +iface eth0 inet dhcp diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/ntp.conf b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/ntp.conf new file mode 100644 index 000000000..f8c94fc61 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/ntp.conf @@ -0,0 +1,4 @@ +server 0.es.pool.ntp.org iburst +server 1.es.pool.ntp.org iburst +server 2.es.pool.ntp.org iburst +server 3.es.pool.ntp.org iburst diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/resolv.conf b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/resolv.conf new file mode 100644 index 000000000..276c26b19 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/resolv.conf @@ -0,0 +1,2 @@ +nameserver 8.8.8.8 +nameserver 8.8.4.4 diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/securetty b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/securetty new file mode 100644 index 000000000..879af3705 --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/securetty @@ -0,0 +1 @@ +ttyFIQ0 diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/timezone b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/timezone new file mode 100644 index 000000000..7fc0e6c6a --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/etc/timezone @@ -0,0 +1 @@ +Europe/Madrid diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/sbin/firstboot.sh b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/sbin/firstboot.sh new file mode 100644 index 000000000..fc77ca47f --- /dev/null +++ b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/sbin/firstboot.sh @@ -0,0 +1,92 @@ +#!/bin/sh + +FILE_TO_CHECK="/etc/firstboot" + +update_config() { + # Mount essential filesystems + mount -t proc proc /proc + + # Remount root filesystem with read-write permissions + mount -o remount,rw / + + # Configure network + ifconfig eth0 up + udhcpc -i eth0 + + # Wait for network connectivity + while ! ip a show eth0 | grep 'inet ' > /dev/null 2>&1; do + sleep 1 + done + + # Sync system time + ntpd -q && hwclock -w + + # Update package repositories and system + sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + apk update + + # Install and configure OpenRC + apk add openrc + rc-update add devfs boot + rc-update add procfs boot + rc-update add sysfs boot + rc-update add ubiattach boot + chmod a+x /etc/local.d/crond.start + rc-update add local default + rc-update add networking default + + # Start essential services + #rc-service devfs start + #rc-service procfs start + #rc-service sysfs start + #rc-service local start + + # Configure timezone + apk add tzdata && \ + if [ -f "/etc/timezone" ]; then + TIMEZONE=$(cat /etc/timezone) + cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime && apk del tzdata + fi + + # Configure terminal + apk add agetty && printf "luckfox\nluckfox\n" | passwd root && \ + sed -i 's|ttyFIQ0::respawn:/bin/sh -l|ttyFIQ0::respawn:/sbin/agetty --noclear ttyFIQ0 115200|' /etc/inittab +# cat > /etc/profile.d/terminal.sh << 'EOF' +##!/bin/sh +#if [ -t 0 ]; then +# stty rows 24 cols 80 +#fi +#EOF +# chmod +x /etc/profile.d/terminal.sh + + # Install and configure bash + apk add bash bash-completion && \ + sed -i 's|root:x:0:0:root:/root:/bin/sh|root:x:0:0:root:/root:/bin/bash|' /etc/passwd + + # Install and configure SSH + apk add openssh && \ + sed -i 's/#PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && \ + sed -i 's/#PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config && \ + rc-update add sshd default + + # Install additional utilities + apk add util-linux dialog dtc i2c-tools mtd-utils e2fsprogs e2fsprogs-extra + apk add btop ncurses ncurses-terminfo-base terminus-font musl-locales + apk add sqlite + apk add python3 py3-pip py3-smbus + #apk add gcc musl-dev build-base gcompat linux-headers + apk add speedtest-cli + + # Remove dev dependency + sed -i 's/need sysfs dev/need sysfs/' /etc/init.d/hwdrivers + sed -i 's/need sysfs dev/need sysfs/' /etc/init.d/machine-id + + # Clean and reboot + rm $FILE_TO_CHECK + sync + reboot +} + +if [ -f "$FILE_TO_CHECK" ]; then + update_config +fi diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/usr/bin/iomux b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-alpine-spi_nand/usr/bin/iomux new file mode 100644 index 0000000000000000000000000000000000000000..620a4a80907b3a945bf505850a4ee6b1608f0cab GIT binary patch literal 10568 zcmeHNdyG`qc|UjV%;-H-Ne{;@66oU8JJgR z?$BMp4QZ?@vJyX9RM9pyQH@*6P8AcyGOi(zh(@%f5-4uuM5(e$iekml0x2z9Q+50M zoqNyh-8Gh+{#B{|wBLN^dz|ll_uO;O`OZ1}#qJ$Fnx+W_x>zpAHHL&(4?4aSKS2>% zFANceZi!edY9OLcp{#&PL1`+4P91oKE#QgN(>Ku%XX}I@qDdi|T>aSyWcRta6%~>| zwo82gG7*{D^@rBktTA+|>9=RnWr@7?vdxRm;no6kM8r(ugTSNy8+^?ROv;Z!eUp9Q2J z`Mj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