Merge 4913f3da50 into a4230afbf4
This commit is contained in:
commit
e78200bd08
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
# <partdef>[,<partdef>]
|
||||
# <partdef> := <size>[@<offset>](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 <SDK root dir>/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
|
||||
23
project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh
Executable file
23
project/cfg/BoardConfig_IPC/luckfox-alpine-post.sh
Executable file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1 @@
|
|||
Luckfox
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
127.0.0.1 localhost localhost.localdomain luckfox
|
||||
::1 localhost localhost.localdomain luckfox
|
||||
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1 @@
|
|||
Welcome to Alpine for Luckfox!
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
|
|
@ -0,0 +1 @@
|
|||
ttyFIQ0
|
||||
|
|
@ -0,0 +1 @@
|
|||
Europe/Madrid
|
||||
|
|
@ -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
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user