Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3b662d8
Update main.yml
al-heisner Dec 4, 2024
127888b
Update main.yml
al-heisner Dec 4, 2024
d7f42cb
Update rootfs.sh
al-heisner Dec 4, 2024
6493756
Update rootfs.sh
al-heisner Dec 4, 2024
fcba053
Update rootfs.sh
al-heisner Dec 4, 2024
f199548
Update main.yml
al-heisner Dec 4, 2024
1dbd1bd
Update main.yml
al-heisner Dec 10, 2024
01289a2
Update system.sh
al-heisner Dec 10, 2024
e849051
switch sdk
al-heisner Dec 10, 2024
1667c80
switch sdk
al-heisner Dec 10, 2024
0f267ec
switch sdk
al-heisner Dec 10, 2024
3bdccae
Update main.yml
al-heisner Dec 10, 2024
357da38
no lunch
al-heisner Dec 10, 2024
e2f2de8
Merge branch 'main' of github.com:al-heisner/luckfox-pico
al-heisner Dec 10, 2024
252bbf6
Update system.sh
al-heisner Dec 10, 2024
bb668a7
Update system.sh
al-heisner Dec 10, 2024
eec4c62
Update bootstrap.sh
al-heisner Dec 10, 2024
f9d6579
fix link_mount
al-heisner Dec 10, 2024
02f1ab1
Merge branch 'main' of github.com:al-heisner/luckfox-pico
al-heisner Dec 10, 2024
72c7203
Update link_mount
al-heisner Dec 10, 2024
f171b93
Update link_mount
al-heisner Dec 10, 2024
6e775f5
add motd
al-heisner Dec 11, 2024
52c2102
Merge branch 'main' of github.com:al-heisner/luckfox-pico
al-heisner Dec 11, 2024
8203d40
add ntp to bootstrap
al-heisner Dec 11, 2024
a5fac02
change root partition size on SD
al-heisner Dec 11, 2024
f2f26f2
debug partition size
al-heisner Dec 11, 2024
e66055e
fix grep string
al-heisner Dec 11, 2024
5244007
keep var from bootstrap
al-heisner Dec 11, 2024
5e51e9a
Fix rc boot order for ntp
al-heisner Dec 11, 2024
fec5c5b
fix /var/empty perms
al-heisner Dec 11, 2024
12315bd
Update main.yml
al-heisner Dec 12, 2024
589c0fd
update sdk
al-heisner Dec 12, 2024
25ea2b9
update sdk
al-heisner Dec 12, 2024
3716122
Update rootfs.sh
al-heisner Dec 12, 2024
b534ac9
Update rootfs.sh
al-heisner Dec 12, 2024
4b94c05
update sdk
al-heisner Dec 12, 2024
659aed9
Create resolv.conf
al-heisner Dec 13, 2024
16fcf36
Create ntp.conf
al-heisner Dec 13, 2024
32f0607
Update url for sdk submodule
bcarrella Jun 25, 2025
5123f16
Configure for building pico-ultra firmware
bcarrella Jun 25, 2025
b910c33
update sdk
bcarrella Jun 25, 2025
2e24d26
update sdk submodule
bcarrella Jun 25, 2025
a1a1af0
increase rootfs size to 256mb
bcarrella Jun 25, 2025
4ef34a6
Set tailscale config env
bcarrella Jun 25, 2025
4d3ed63
install tailscale and enable
bcarrella Jun 25, 2025
0f9a717
fix typo on tailscale service enabling
bcarrella Jun 26, 2025
abc4865
remove unuseful tailscale config
bcarrella Jun 26, 2025
84c3f69
update sdk kernel layer
bcarrella Jun 26, 2025
5ad8fae
manage emmc boot media
bcarrella Jun 27, 2025
83b5523
update sdk for iptables needed kmods
bcarrella Jun 28, 2025
30a9f97
revert workspace file size to 100
bcarrella Jun 28, 2025
4d193b6
comment CMA size override
bcarrella Jun 28, 2025
4fac0b9
fix emmc device mount names
bcarrella Jun 28, 2025
f20c16e
add startup scripts
bcarrella Jun 28, 2025
40df46f
remove filesystem resize
bcarrella Jun 28, 2025
a8997a8
remove neofetch
bcarrella Jun 28, 2025
d283893
add start extension
bcarrella Jun 28, 2025
837b9b7
config static ip address
bcarrella Jun 28, 2025
8202138
install extra packages
bcarrella Jun 28, 2025
fcca6e3
add tailscale forward config
bcarrella Jun 29, 2025
60d4e42
clean unuseful config on overlay
bcarrella Jun 29, 2025
2c6dd4b
add Pico Ultra reference on README
bcarrella Jun 29, 2025
6351d46
Add tip to build and load DKMS
bcarrella Jun 29, 2025
cb9f456
list more board models
bcarrella Jun 29, 2025
548d605
fix storage media names
bcarrella Jun 29, 2025
115730b
update sdk layer
bcarrella Jun 29, 2025
fb4bb86
new sdk layer + ethtool + sysctl start script
bcarrella Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build-system:
strategy:
matrix:
device: [ pico-mini-b, pico-plus, pico-pro-max ]
device: [ pico-ultra-flash ]
# runs-on: "cirun-aws-amd64--${{ github.run_id }}"
runs-on: ubuntu-latest
needs: build-rootfs
Expand All @@ -44,9 +44,9 @@ jobs:
python-is-python3 passwd openssl openssh-server \
openssh-client vim file cpio rsync"
- name: build system
run: ./system.sh -f rootfs-alpine.tar.gz -d ${{ matrix.device }}
run: sudo ./system.sh -f rootfs-alpine.tar.gz -d ${{ matrix.device }}
- name: upload update.img
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.device }}-sysupgrade
path: output/${{ matrix.device }}-sysupgrade.img
name: ${{ matrix.device }}
path: output/*
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "sdk"]
path = sdk
url = https://github.com/soyflourbread/luckfox-pico-sdk.git
url = https://github.com/bcarrella/luckfox-pico-sdk.git
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Linux systems for LuckFox Pico series, including
Pico Mini b, Pico Plus and Pico Pro Max (all models with SPI flash).
Pico Ultra, Pico Ultra W (with EMMC)

Currently only [Alpine Linux](https://alpinelinux.org/) is available.

Expand Down Expand Up @@ -57,3 +58,4 @@ Just fork this repo and trigger Github Actions after you made your changes!
For example,
* To add software packages, edit `bootstrap.sh`.
* To change files in the system image, edit `overlay/`.
* To load Dynamic Kernel Modules, first use scripts in sdk submodule to configure and build the Linux Kernel, then edit `/oem/usr/ko/insmod_ko.sh` to load resulting .ko modules at runtime.
40 changes: 37 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,49 @@ apk del -r shadow
# Install SSH
apk add openssh
rc-update add sshd default
chown 0:0 /var/empty

# Extra stuff
apk add mtd-utils-ubi
apk add bottom
apk add neofetch
#apk add neofetch
apk add e2fsprogs-extra

# Install iptables-legacy
apk add iptables-legacy
rc-update add iptables-legacy
ln -s /usr/sbin/iptables-legacy /usr/sbin/iptables

# Install tailscale
apk add tailscale
rc-update add tailscale default

# install wireguard
apk add wireguard-tools

# Install Chrony
apk add chrony
rc-update add chrony default

# install curl
apk add curl

# install nano
apk add nano

# install ca-certificates
apk add ca-certificates
update-ca-certificates

# install staticroute
rc-update add staticroute

# install ethtool
apk add ehtool

# Clear apk cache
rm -rf /var/cache/apk/*

# Packaging rootfs
for d in bin etc lib sbin usr; do tar c "$d" | tar x -C /extrootfs; done
for dir in dev proc root run sys var oem userdata; do mkdir /extrootfs/${dir}; done
for d in bin etc lib sbin usr var; do tar c "$d" | tar x -C /extrootfs; done
for dir in dev proc root run sys oem userdata; do mkdir /extrootfs/${dir}; done
6 changes: 6 additions & 0 deletions overlay/etc/local.d/load_modules.start
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

if [ -f /oem/usr/ko/insmod_ko.sh ]; then
chmod a+x /oem/usr/ko/insmod_ko.sh
/oem/usr/ko/insmod_ko.sh
fi
3 changes: 3 additions & 0 deletions overlay/etc/local.d/load_sysctl.start
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

sysctl -p /etc/sysctl.d/*.conf
39 changes: 39 additions & 0 deletions overlay/etc/motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Welcome to Alpine!

The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <https://wiki.alpinelinux.org/>.

You can setup the system with the command: setup-alpine

You may change this message by editing /etc/motd.



==== ====
======== ========
=========== ===========
==== =============== ====
==== ========= ====
==== ====
= =
============ ============
================================
====== ========== =======
===== ======= =====
========== === ===========
============ ============
======= ======
====== =====
============
========
====


=== === === ======= === === ========= ====== === ===
=== === === === === === === === === === === ===
=== === === === ====== === === === =====
=== === === === ====== ========= === === =====
=== === === === === === === === === === === ===
========= ====== ======= === === === ====== === ===

10 changes: 7 additions & 3 deletions overlay/etc/network/interfaces
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
udhcpc_opts -t 1
iface eth0 inet static
address 192.168.199.100
netmask 255.255.255.0
up ip route add 192.168.15.0/24 via 192.168.199.59
gateway 192.168.199.1

auto usb0
iface usb0 inet static
address 172.32.0.93
netmask 255.255.255.0
gateway 172.32.0.1

1 change: 1 addition & 0 deletions overlay/etc/sysctl.d/99-tailscale.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
net.ipv4.ip_forward = 1
86 changes: 69 additions & 17 deletions overlay/usr/bin/link_mount
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
#!/bin/sh
bootmedium=spi_nand
eval $(cat /proc/cmdline | grep -o ' storagemedia=[^ ]*')
bootmedium=$storagemedia
linkdev(){
if [ ! -d "/dev/block/by-name" ];then
mkdir -p /dev/block/by-name
cd /dev/block/by-name
ln -sf /dev/mtd0 env
ln -sf /dev/mtd1 idblock
ln -sf /dev/mtd2 uboot
ln -sf /dev/mtd3 boot
ln -sf /dev/mtd4 oem
ln -sf /dev/mtd5 userdata
ln -sf /dev/mtd6 rootfs
fi }
if [ ! -d "/dev/block/by-name" ];then
mkdir -p /dev/block/by-name
cd /dev/block/by-name
case $storagemedia in
mtd|spi_nand|slc_nand)
ln -sf /dev/mtd0 env
ln -sf /dev/mtd1 idblock
ln -sf /dev/mtd2 uboot
ln -sf /dev/mtd3 boot
ln -sf /dev/mtd4 oem
ln -sf /dev/mtd5 userdata
ln -sf /dev/mtd6 rootfs
;;
sd)
ln -sf /dev/mmcblk1p1 env
ln -sf /dev/mmcblk1p2 idblock
ln -sf /dev/mmcblk1p3 uboot
ln -sf /dev/mmcblk1p4 boot
ln -sf /dev/mmcblk1p5 oem
ln -sf /dev/mmcblk1p6 userdata
ln -sf /dev/mmcblk1p7 rootfs
;;
emmc)
ln -sf /dev/mmcblk0p1 env
ln -sf /dev/mmcblk0p2 idblock
ln -sf /dev/mmcblk0p3 uboot
ln -sf /dev/mmcblk0p4 boot
ln -sf /dev/mmcblk0p5 oem
ln -sf /dev/mmcblk0p6 userdata
ln -sf /dev/mmcblk0p7 rootfs
;;

esac
fi
}
mount_part(){
if [ -z "$1" -o -z "$2" -o -z "$3" ];then
echo "Invalid paramter, exit !!!"
Expand All @@ -25,8 +50,15 @@ mountpt=$2
part_fstype=$3
part_realdev=$(realpath $part_dev)
if [ ! -d $mountpt ]; then
if [ "$mountpt" = "IGNORE" -a "emmc" = "$bootmedium" ];then
if [ "$mountpt" = "IGNORE" -a "sd" = "$bootmedium" ];then
if [ "$root_dev" = "$part_realdev" ];then
mount -o remount,rw /
resize2fs $part_dev
fi
return 0;
elif [ "$mountpt" = "IGNORE" -a "emmc" = "$bootmedium" ];then
if [ "$root_dev" = "$part_realdev" ];then
mount -o remount,rw /
resize2fs $part_dev
fi
return 0;
Expand All @@ -37,6 +69,21 @@ if [ ! -d $mountpt ]; then
fi
if test -h $part_dev; then
case $bootmedium in
sd)
if [ "$root_dev" = "$part_realdev" ];then
resize2fs $part_dev
else
e2fsck -y $part_dev
mount -t $part_fstype $part_dev $mountpt
if [ $? -eq 0 ]; then
resize2fs $part_dev
tune2fs $part_dev -L $partname
else
echo "mount $partname error, try to format..."
mke2fs -F -L $partname $part_dev && tune2fs -c 0 -i 0 $part_dev && mount -t $part_fstype $part_dev $mountpt
fi
fi
;;
emmc)
if [ "$root_dev" = "$part_realdev" ];then
resize2fs $part_dev
Expand All @@ -52,7 +99,7 @@ case $bootmedium in
fi
fi
;;
spi_nand|slc_nand)
mtd|spi_nand|slc_nand)
if [ $partname = "rootfs" ];then
echo "rootfs mount on $root_dev"
elif [ "$part_fstype" = "ubifs" ]; then
Expand Down Expand Up @@ -153,9 +200,14 @@ case $bootmedium in
esac
fi
}
case $bootmedium in
sd) fstype=ext4 ;;
emmc) fstype=ext4 ;;
mtd|spi_nand|slc_nand) fstype=ubifs ;;
esac
case $1 in start) linkdev;
mount_part rootfs IGNORE ubifs ;
mount_part oem /oem ubifs ;
mount_part userdata /userdata ubifs ;
mount_part rootfs IGNORE $fstype ;
mount_part oem /oem $fstype ;
mount_part userdata /userdata $fstype ;
;; linkdev) linkdev ;
;; stop) printf stop $0 finished\n ;; *) echo Usage: $0 {start|stop} exit 1 ;; esac
7 changes: 6 additions & 1 deletion rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create docker
docker container rm -f armv7alpine
docker run \
--platform=linux/arm/v7 \
--name armv7alpine \
--net host \
--mount type=bind,source=./bootstrap.sh,target=/bootstrap.sh \
Expand All @@ -47,9 +48,13 @@ overlay() {
sed -i -e "s/{TTY_PORT}/$TTY_PORT/g" "$OVERLAY_WORKSPACE/etc/securetty"
sed -i -e "s/{TTY_PORT}/$TTY_PORT/g" "$OVERLAY_WORKSPACE/etc/inittab"

chown -R 0:0 $OVERLAY_WORKSPACE
echo "ARH DEBUG: ls -la $OVERLAY_WORKSPACE"
ls -la $OVERLAY_WORKSPACE
rsync -a "$OVERLAY_WORKSPACE/" "$ROOTFS_WORKSPACE_MNT/"
rm -rf "$OVERLAY_WORKSPACE"

echo "ARH DEBUG: ls -la $ROOTFS_WORKSPACE_MNT"
ls -la $ROOTFS_WORKSPACE_MNT
echo "Include /etc/ssh/sshd_config.d/*.conf" >> \
"$ROOTFS_WORKSPACE_MNT/etc/ssh/sshd_config"

Expand Down
2 changes: 1 addition & 1 deletion sdk
Submodule sdk updated from 8dde6a to 63c667
40 changes: 26 additions & 14 deletions system.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

ROOTFS_NAME="rootfs-alpine.tar.gz"
DEVICE_NAME="pico-mini-b"
DEVICE_NAME="pico-ultra-flash"

while getopts ":f:d:" opt; do
case ${opt} in
Expand All @@ -14,16 +14,6 @@ while getopts ":f:d:" opt; do
esac
done

DEVICE_ID="6"
case $DEVICE_NAME in
pico-mini-b) DEVICE_ID="6" ;;
pico-plus) DEVICE_ID="7" ;;
pico-pro-max) DEVICE_ID="8" ;;
*)
echo "Invalid device: ${DEVICE_NAME}."
exit 1
;;
esac

rm -rf sdk/sysdrv/custom_rootfs/
mkdir -p sdk/sysdrv/custom_rootfs/
Expand All @@ -36,9 +26,31 @@ source env_install_toolchain.sh
popd || exit

rm -rf .BoardConfig.mk
echo "$DEVICE_ID" | ./build.sh lunch
case $DEVICE_NAME in
pico-mini-sd) ln -s project/cfg/BoardConfig_IPC/BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_Mini-IPC.mk .BoardConfig.mk ;;
pico-mini-flash) ln -s project/cfg/BoardCnfig_IPC/BoardConfig-SPI_NAND-Buildroot-RV1103_Luckfox_Pico_Mini-IPC.mk .BoardConfig.mk ;;
pico-plus-sd) ln -s project/cfg/BoardConfig_IPC/BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_Plus-IPC.mk .BoardConfig.mk ;;
pico-plus-flash) ln -s project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Buildroot-RV1103_Luckfox_Pico_Plus-IPC.mk .BoardConfig.mk ;;
pico-ultra-flash) ln -s project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Ultra-IPC.mk .BoardConfig.mk ;;
pico-ultra-w-flash) ln -s project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Ultra_W-IPC.mk .BoardConfig.mk ;;
pico-pro-max-flash) ln -s project/cfg/BoardConfig_IPC/BoardConfig-SPI_NAND-Busybox-RV1106_Luckfox_Pico_Pro_Max-IPC_FASTBOOT.mk .BoardConfig.mk ;;
pico-pro-max-sd) ln -s project/cfg/BoardConfig_IPC/BoardConfig-SD_CARD-Buildroot-RV1106_Luckfox_Pico_Pro_Max-IPC.mk .BoardConfig.mk ;;
*)
echo "Invalid device: ${DEVICE_NAME}."
exit 1
;;
esac

#echo "$DEVICE_ID" | ./build.sh lunch
echo "export RK_CUSTOM_ROOTFS=../sysdrv/custom_rootfs/$ROOTFS_NAME" >> .BoardConfig.mk
echo "export RK_BOOTARGS_CMA_SIZE=\"1M\"" >> .BoardConfig.mk
#echo "export RK_BOOTARGS_CMA_SIZE=\"1M\"" >> .BoardConfig.mk

#change size on SD
if echo "$DEVICE_NAME" | grep -q "\-sd"; then
echo "export RK_PARTITION_CMD_IN_ENV=\"32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),30G(rootfs)\"" >> .BoardConfig.mk
fi

#cat .BoardConfig.mk

# build sysdrv - rootfs
./build.sh uboot
Expand All @@ -54,4 +66,4 @@ popd || exit

rm -rf output
mkdir -p output
cp sdk/output/image/update.img "output/$DEVICE_NAME-sysupgrade.img"
cp sdk/output/image/* "output/"