mirror of
https://github.com/femtofox/femtofox.git
synced 2026-10-26 19:02:00 -04:00
Add Lyra Zero W migration builder and update WARP.md
- Created foxbuntu-lyra-builder.sh for Luckfox Lyra Zero W migration - Preserves Ubuntu rootfs and femto utilities from Pico Mini build - Integrates with Luckfox-Lyra-SDK for RK3506 platform - Updated WARP.md with Ubuntu 24.04.3 LTS environment info - Added comprehensive migration strategy and workflow documentation
This commit is contained in:
parent
dbffab7245
commit
037ff4e728
2 changed files with 259 additions and 0 deletions
57
WARP.md
57
WARP.md
|
|
@ -384,3 +384,60 @@ This project builds a complete embedded Linux distribution. Key integration poin
|
|||
- Target: Integrated WiFi/BT module with native drivers
|
||||
- **IoT Applications**: GPIO, I2C, and UART interfaces for sensors and peripherals
|
||||
- **Cross-Platform Compatibility**: Maintain Femtofox utilities across hardware platforms
|
||||
|
||||
## Lyra Zero W Migration Builder
|
||||
|
||||
A new migration builder script has been created specifically for transitioning from the Luckfox Pico Mini to the Luckfox Lyra Zero W:
|
||||
|
||||
### Script Location
|
||||
- **`environment-setup/foxbuntu-lyra-builder.sh`**: Lyra Zero W migration builder
|
||||
|
||||
### Key Features
|
||||
- **Ubuntu Rootfs Preservation**: Automatically backs up the existing Ubuntu rootfs from the Pico Mini build
|
||||
- **Lyra SDK Integration**: Initializes and works with the Luckfox-Lyra-SDK for RK3506
|
||||
- **Toolchain Management**: Sets up RK3506 cross-compilation environment
|
||||
- **Migration Validation**: Tests setup status and identifies missing components
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Interactive migration menu
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh
|
||||
|
||||
# Individual migration steps
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh preserve_ubuntu_rootfs
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh analyze_lyra_sdk
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh test_migration_setup
|
||||
|
||||
# Initialize Lyra SDK (requires repo tool)
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh init_lyra_sdk
|
||||
```
|
||||
|
||||
### Migration Status Verification
|
||||
|
||||
```bash
|
||||
# Check preserved Ubuntu assets
|
||||
ls -la /home/hellz/femtofox-ubuntu-rootfs-backup/usr/local/bin/femto-*
|
||||
|
||||
# Verify femto utilities count (should be 16+ scripts)
|
||||
sudo ./environment-setup/foxbuntu-lyra-builder.sh test_migration_setup
|
||||
```
|
||||
|
||||
### Current Migration Progress
|
||||
|
||||
✅ **Completed**:
|
||||
- Ubuntu rootfs backup created (`/home/hellz/femtofox-ubuntu-rootfs-backup/`)
|
||||
- All 16 femto utility scripts preserved
|
||||
- Lyra migration builder script created and tested
|
||||
- Build environment analysis framework established
|
||||
|
||||
⚠️ **Next Steps**:
|
||||
- Initialize Luckfox-Lyra-SDK (requires `repo` tool setup)
|
||||
- Set up RK3506 cross-compilation toolchain
|
||||
- Adapt kernel device trees from RV1103/RV1106 to RK3506
|
||||
- Modify WiFi stack for integrated WiFi/BT vs USB adapter
|
||||
- Test build process with preserved Ubuntu rootfs
|
||||
|
||||
### Migration Philosophy
|
||||
|
||||
The migration preserves the valuable Ubuntu-based Foxbuntu system (no longer available in newer Luckfox SDKs) while adapting the hardware platform to the more capable Luckfox Lyra Zero W with integrated WiFi/BT and the RK3506 SoC.
|
||||
|
|
|
|||
202
environment-setup/foxbuntu-lyra-builder.sh
Executable file
202
environment-setup/foxbuntu-lyra-builder.sh
Executable file
|
|
@ -0,0 +1,202 @@
|
|||
#!/bin/bash
|
||||
|
||||
################ LYRA MIGRATION BUILDER ################
|
||||
# Foxbuntu Lyra Zero W Builder
|
||||
# Migrates existing Ubuntu-based Foxbuntu to Luckfox Lyra Zero W (RK3506)
|
||||
# Preserves Ubuntu rootfs and femto utilities from original Pico Mini build
|
||||
##########################################################
|
||||
|
||||
if [[ $(id -u) != 0 ]]; then
|
||||
echo "This script must be run as root; use sudo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudoer=$(echo $SUDO_USER)
|
||||
|
||||
# Environment variables for Lyra SDK
|
||||
export RK_KERNEL_VERSION=6.1
|
||||
export RK_TARGET_SOC=rk3506
|
||||
export RK_TARGET_PRODUCT=lyra_zero_w
|
||||
|
||||
echo "=============================================="
|
||||
echo " Foxbuntu Lyra Zero W Migration Builder"
|
||||
echo "=============================================="
|
||||
echo "Target: Luckfox Lyra Zero W (RK3506)"
|
||||
echo "Kernel: Linux 6.1"
|
||||
echo "Base: Ubuntu 22.04 LTS (preserved from Pico build)"
|
||||
echo "=============================================="
|
||||
|
||||
# Check if 'dialog' is installed, install it if missing
|
||||
if ! command -v dialog &> /dev/null; then
|
||||
echo "The 'dialog' package is required to run this script. Press any key to install it."
|
||||
read -n 1 -s -r
|
||||
apt update && apt install -y dialog
|
||||
fi
|
||||
|
||||
install_prerequisites() {
|
||||
echo "Setting up Foxbuntu Lyra build environment..."
|
||||
echo "Note: Adding Python 2.7 for repo tool compatibility"
|
||||
apt update
|
||||
apt install -y git ssh make gcc gcc-multilib g++-multilib module-assistant expect g++ gawk texinfo libssl-dev bison flex fakeroot cmake unzip gperf autoconf device-tree-compiler libncurses5-dev pkg-config bc python-is-python3 python2.7 passwd openssl openssh-server openssh-client vim file cpio rsync qemu-user-static binfmt-support dialog repo
|
||||
}
|
||||
|
||||
init_lyra_sdk() {
|
||||
echo "Initializing Luckfox Lyra SDK..."
|
||||
cd /home/${sudoer}/femtofox/Luckfox-Lyra-SDK || {
|
||||
echo "Error: Luckfox-Lyra-SDK directory not found!"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Try to use system repo tool first, fallback to local
|
||||
if command -v repo >/dev/null 2>&1; then
|
||||
echo "Using system repo tool..."
|
||||
repo sync
|
||||
else
|
||||
echo "Using local repo tool..."
|
||||
python2.7 repo/repo sync || {
|
||||
echo "Repo sync failed. SDK may need manual initialization."
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
setup_lyra_toolchain() {
|
||||
echo "Setting up RK3506 cross-compilation toolchain..."
|
||||
LYRA_SDK_PATH="/home/${sudoer}/femtofox/Luckfox-Lyra-SDK"
|
||||
TOOLCHAIN_PATH="$LYRA_SDK_PATH/prebuilts/gcc/linux-x86/arm/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin"
|
||||
|
||||
if [ -d "$TOOLCHAIN_PATH" ]; then
|
||||
export PATH="$TOOLCHAIN_PATH:$PATH"
|
||||
echo "Toolchain path: $TOOLCHAIN_PATH"
|
||||
echo "Testing toolchain..."
|
||||
arm-none-linux-gnueabihf-gcc --version | head -2
|
||||
else
|
||||
echo "Warning: RK3506 toolchain not found at expected path"
|
||||
echo "Expected: $TOOLCHAIN_PATH"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
preserve_ubuntu_rootfs() {
|
||||
echo "Preserving existing Ubuntu rootfs from Pico build..."
|
||||
PICO_ROOTFS="/home/${sudoer}/luckfox-pico/sysdrv/out/rootfs_uclibc_rv1106"
|
||||
BACKUP_ROOTFS="/home/${sudoer}/femtofox-ubuntu-rootfs-backup"
|
||||
|
||||
if [ -d "$PICO_ROOTFS" ]; then
|
||||
echo "Creating backup of Ubuntu rootfs..."
|
||||
rsync -aHAXv --progress "$PICO_ROOTFS/" "$BACKUP_ROOTFS/"
|
||||
echo "Ubuntu rootfs backed up to: $BACKUP_ROOTFS"
|
||||
else
|
||||
echo "Warning: Original Ubuntu rootfs not found at $PICO_ROOTFS"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
analyze_lyra_sdk() {
|
||||
echo "Analyzing Luckfox Lyra SDK structure..."
|
||||
LYRA_SDK_PATH="/home/${sudoer}/femtofox/Luckfox-Lyra-SDK"
|
||||
cd "$LYRA_SDK_PATH" || return 1
|
||||
|
||||
echo "=== SDK Components ==="
|
||||
find . -maxdepth 2 -type d -name "*rk3506*" -o -name "*lyra*" | sort
|
||||
|
||||
echo "=== Available Device Configurations ==="
|
||||
find . -name "*.mk" -exec grep -l "rk3506\|lyra" {} \; 2>/dev/null | head -10
|
||||
|
||||
echo "=== Kernel Device Trees ==="
|
||||
find . -name "*.dts*" -path "*/rk3506*" -o -name "*lyra*.dts*" 2>/dev/null | head -10
|
||||
|
||||
echo "=== Build Scripts ==="
|
||||
find . -name "build.sh" -o -name "envsetup.sh" | head -10
|
||||
}
|
||||
|
||||
test_migration_setup() {
|
||||
echo "Testing migration setup..."
|
||||
|
||||
echo "1. Checking Ubuntu rootfs backup..."
|
||||
if [ -d "/home/${sudoer}/femtofox-ubuntu-rootfs-backup/usr/local/bin" ]; then
|
||||
echo " ✓ Ubuntu rootfs preserved"
|
||||
echo " ✓ Femto utilities found: $(ls /home/${sudoer}/femtofox-ubuntu-rootfs-backup/usr/local/bin/femto-* | wc -l) scripts"
|
||||
else
|
||||
echo " ✗ Ubuntu rootfs backup incomplete"
|
||||
fi
|
||||
|
||||
echo "2. Checking Lyra SDK..."
|
||||
if [ -d "/home/${sudoer}/femtofox/Luckfox-Lyra-SDK/buildroot" ]; then
|
||||
echo " ✓ Lyra SDK initialized"
|
||||
else
|
||||
echo " ⚠ Lyra SDK may need initialization (run init_lyra_sdk)"
|
||||
fi
|
||||
|
||||
echo "3. Checking toolchain..."
|
||||
if command -v arm-none-linux-gnueabihf-gcc >/dev/null 2>&1; then
|
||||
echo " ✓ RK3506 toolchain available"
|
||||
else
|
||||
echo " ⚠ RK3506 toolchain not in PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Foxbuntu Lyra Zero W Migration Builder"
|
||||
echo ""
|
||||
echo "Available functions:"
|
||||
echo " install_prerequisites - Install build dependencies"
|
||||
echo " init_lyra_sdk - Initialize the Luckfox Lyra SDK"
|
||||
echo " setup_lyra_toolchain - Set up RK3506 cross-compilation"
|
||||
echo " preserve_ubuntu_rootfs - Backup existing Ubuntu rootfs"
|
||||
echo " analyze_lyra_sdk - Analyze SDK structure"
|
||||
echo " test_migration_setup - Test current setup status"
|
||||
echo ""
|
||||
echo "Example: sudo ./foxbuntu-lyra-builder.sh install_prerequisites"
|
||||
exit 0
|
||||
}
|
||||
|
||||
################### MENU SYSTEM ###################
|
||||
|
||||
if [[ -z ${1} ]]; then
|
||||
if ! command -v dialog &> /dev/null; then
|
||||
echo "The 'dialog' package is required to load the menu."
|
||||
echo "Please install it using: sudo apt install dialog"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while true; do
|
||||
CHOICE=$(dialog --clear --no-cancel --backtitle "Foxbuntu Lyra Zero W Migration Builder" \
|
||||
--title "Main Menu" \
|
||||
--menu "Choose an action:" 20 80 12 \
|
||||
1 "Install Prerequisites" \
|
||||
2 "Initialize Lyra SDK" \
|
||||
3 "Set up Lyra Toolchain" \
|
||||
4 "Preserve Ubuntu Rootfs" \
|
||||
5 "Analyze Lyra SDK Structure" \
|
||||
6 "Test Migration Setup" \
|
||||
7 "Exit" \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
clear
|
||||
|
||||
case $CHOICE in
|
||||
1) install_prerequisites ;;
|
||||
2) init_lyra_sdk ;;
|
||||
3) setup_lyra_toolchain ;;
|
||||
4) preserve_ubuntu_rootfs ;;
|
||||
5) analyze_lyra_sdk ;;
|
||||
6) test_migration_setup ;;
|
||||
7) echo "Exiting..."; break ;;
|
||||
*) echo "Invalid option, please try again." ;;
|
||||
esac
|
||||
|
||||
echo "Menu selection completed. Press any key to return to the menu."
|
||||
read -n 1 -s -r
|
||||
done
|
||||
else
|
||||
if declare -f "${1}" > /dev/null; then
|
||||
"${1}"
|
||||
else
|
||||
echo "Error: Function '${1}' not found."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue