Solely M-Series cross-compiling for Luckfox Pico Max solution has been achieved. Here are the details of one solution that avoids any actual (real) X86 hardware.
Used:
- Mac M-Series (tested with MacOS Sequoia).
- UTM (https://mac.getutm.app) with "Emulate" X86-64 Ubuntu Server 8GB(RAM)/30GB(virtual disk)/2 cores (ubuntu-22.04.5-live-server-amd64.iso). I chose the server (all CLI) to avoid having to run a GUI desktop, which is *very* slow.
- Parallels with virtual X86 Windows 11
Steps: (from
https://wiki.luckfox.com/Luckfox-Pico/Luckfox-Pico-SDK)
Start UTM install and boot Emulated X-86-64 Ubuntu Server 22.04.5.
Configure for 8GB RAM, 30GB virtual disk and, in my case a user "alien".
Once logged in, to the newly booted server, the command:
(shell commands, "$ " is the bash prompt (not typed))
$ ip a
shows the current UTM server's IP number, which was also magically auto configured into the Mac's TCP-IP remote ssh access. e.g. From my Mac's Terminal.app I could type:
$ ssh alien@192.168.64.9
to get remote CLI access to the Ubuntu server via as many Mac terminal windows as I wanted.
As a crosscheck, I installed "neofetch" on the server by typing:
$ sudo apt install neofetch
$ neofetch
outputs:
Code: Select all
.-/+oossssoo+/-. alien@ubuntuutm
`:+ssssssssssssssssss+:` ---------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 22.04.5 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: KVM/QEMU (Standard PC (Q35 + ICH9, 2009) pc-q35-9.1)
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.15.0-136-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 2 hours, 14 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 830 (dpkg), 4 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: bash 5.1.16
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 1280x800
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Terminal: /dev/pts/3
ossyNMMMNyMMhsssssssssssssshmmmhssssssso CPU: Intel (Skylake) (2) @ 1.000GHz
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ GPU: 00:02.0 Red Hat, Inc. Virtio GPU
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Memory: 297MiB / 7934MiB
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
+sssssssssdmydMMMMMMMMddddyssssssss+
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.
Starting the cross compiler:
$ sudo apt update
$ sudo apt upgrade
The next apt-get is all on one line from "git" to "rsync"
$ sudo apt-get 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 passwd openssl openssh-server openssh-client vim file cpio rsync
$ cd ${HOME}; git clone
https://github.com/LuckfoxTECH/luckfox-pico.git
$ export SDK_PATH=${HOME}/luckfox-pico
Here I edited the file:
"BoardConfig-SD_CARD-Buildroot-RV1106_Luckfox_Pico_Max-IPC.mk"
in the directory:
"${HOME}/luckfox-pico/project/cfg/BoardConfig_IP"
changing 6G to 56G to accommodate a larger 64GB SD card rootfs.img "/" partition. I probably could have gone larger (perhaps to 62GB) but did not push it.
The next ./build.sh I chose [6] RV1106_Luckfox_Pico_Max, [0] SD_CARD, and [1] Ubuntu
$ sudo ./build.sh lunch
$ date; sudo ./build.sh; date
After an initial short delay, followed by 1 hour and 45 mins of build progress, finally ending with these 2 green lines of output:
[build.sh:info] Running build_save succeeded.
[build.sh:info] Running build_allsave succeeded.
The configured 30GB of allocated drive started with 22GB free and ended with 4.1GB free. The build script appears to make 2 full copies of the SD card images on the Ubuntu filestore. One in:
Code: Select all
~/luckfox-pico/IMAGE/IPC_SD_CARD_UBUNTU_RV1106_LUCKFOX_PICO_MAX_20250401.0558_RELEASE_TEST/IMAGES/
and the other in:
the latter being the only directory containing a hidden file named:
Having generated the SD ".img" files, the next task is to write them to the SD card. I'm using MicroSDXC UHS-I Class 10 Memory Cards, (A2, U3, V30). They usually get around 90MB/seconds read and write speeds.
The Linux version of the tool that writes the images to an SD card (SocToolKit) fails to launch with a silent GUI error. There is a python CLI version of the writer found here:
https://gist.github.com/Spiritdude/da36 ... 0a8b9f972f
(thanks Spiritdude) but that takes more than 20 minutes to complete (it writes to the device in 1kB chunks).
Parallels-hosted X86 Windows 11 runs the official version of SocToolKit, documented here:
https://wiki.luckfox.com/Luckfox-Pico/L ... d-flashing (make sure to right-click and run as admin).
To allow Windows to gain access to the images, I need to copy them to my Mac's filestore. Given I know the IP number assigned to the virtual Ubuntu machine using
$ ip a
which, on my VM gives:
Code: Select all
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 1a:73:a4:80:96:ef brd ff:ff:ff:ff:ff:ff
inet 192.168.64.9/24 metric 100 brd 192.168.64.255 scope global dynamic enp0s1
valid_lft 3042sec preferred_lft 3042sec
inet6 fd25:88f4:cbeb:a033:1873:a4ff:fe80:96ef/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591931sec preferred_lft 604731sec
inet6 fe80::1873:a4ff:fe80:96ef/64 scope link
valid_lft forever preferred_lft forever
I was able to recursively copy the ".img" files running "scp" using my Mac terminal with this command:
Code: Select all
scp -r alien@192.168.64.9:luckfox-pico/output/image .
which created and filled a new "image" folder in the current working directory on my Mac's terminal. Having set up my Windows VM to share access to my Mac's files, I was able to access the Mac copy of the images from within the Windows SocToolKit app and write them to a new SD device just plugged in and assigned to Windows 11 via a Parallels popup.
Logging in to Luckfox pico max board from a Mac:
Just in case this is of use, there are two main methods to actually talk to the booted Ubuntu on the Luckfox board:
1. Direct Ethernet connection using ssh over TCP-IP (as many simultaneous connections as you like, including Samba volume mounting, scb, sftp, etc.).
Connecting the Luckfox board using an Ethernet RJ45 cable, to your router, works without any further software setup. The trick is to discover the DHCP-allocated IP number assigned to the Luckfox board upon connection. I cheat by using the LAN/Scan action provided by the iOS and Android application called "Net Analyzer" found at
https://techet.net/netanalyzer/. The Luckfox board's IP number is labeled with the name "LUCKFOX" or "luckfox" once the Net Analyzer LAN->Scan operation is complete. Once you know the Luckfox board's IP number you can use a terminal from any device on your subnet with:
$ ssh pico@<IP number>
(with default password luckfox (case sensitive)). The discovered <IP number> is of the form 192.168.1.99 (no angle brackets and your numbers will likely be different). As before, "$ " represents the terminal app's shell prompt (don't type it).
Normal Ubuntu mechanisms to set up and use a static IP number ("interfaces" file, "netplan" application) don't seem to be configured in the supported Luckfox Ubuntu distribution. The recommended mechanism to set up, and use, a static IP number (that works) is documented here:
https://wiki.luckfox.com/Luckfox-Pico/L ... nvironment
2. 3-wire UART<->USB, single terminal connection. e.g.
https://www.aliexpress.us/item/2251832450947101.html
and
https://wiki.luckfox.com/Luckfox-Pico/L ... trol-shell
With or without a connected RJ45 Ethernet cable you can achieve a console terminal connection by attaching a USB UART board using 3 wires. i.e. board-pin#1->UART-rx, board-pin#2->UART-tx, and board-pin#3->UART-ground. I would not power the board from the USB UART in case your UART provides 5V and you connect that to a Luckfox 3.3V board-pin. I usually power the Luckfox board from the USB-C cable. This also means you can see the early booting-activity console messages by having the console connected while plugging in the USB-C cable. Lots and lots of info.
Running a Luckfox console terminal via the correct Mac device is also an interesting exercise. If you connect the USB UART board to the Mac, the UART should auto configure itself on your Mac and create two new /dev entries. Just after I plug in the USB UART board I type:
$ ls -latr /dev | tail -20
That command reverse orders the most recently modified /dev entries at the bottom of its output and displays just the last 20 entries. Within those last 20 entries two lines should appear that look similar to these:
Code: Select all
crw-rw-rw- 1 root wheel 0x9000008 Apr 4 02:11 tty.usbserial-0001
crw-rw-rw- 1 root wheel 0x9000009 Apr 4 02:11 cu.usbserial-0001
The important info in that command is just the names of the newly created devices. You can probably use either device nowadays as "cu" stands for call-unit and used to mean that hardware modem flow-control signals were implemented (CTS/RTS/DTS). Modern UARTs and CPUs should be fast enough so that flow control should be irrelevant especially since we're just using 3-wires here and modem control signals have nowhere to go.
The Mac has a built in terminal (CLI) command to connect the terminal to a serial device. Given my USB UART device names as shown above, I would use:
$ screen /dev/tty.usbserial-0001 115200
(to quit type "^a" followed by "k" and a "y" to confirm the quit ("^a" means control+a, and again, don't type the quote marks)).
$ man screen
Should be sufficiently confusing for anyone. I usually use the 3rd party command "tio"
https://github.com/tio/tio instead of "screen".
All done on an M-series Mac (avoiding having to run on "real" X86 kit).
ASIDE @Crocodile: I understand how difficult it can be to support a broader development tool base. I too am a developer with my own GUI-based toolset that has migrated across many OSs and platform-independent presentation layers (Classic Mac->MacOSX and iOS, ThinkC->Symantec-C->Metrowerks->Xcode, 68000->PowerPC->X86->Arm, XVT->SDL->SDL-2->SDL-3). Oddly the X86 environment has always been more work-intensive to keep it running as a development/support platform and in my environment has been relegated to purely a delivery platform. A long-standing practical decision that I keep revisiting in the hope of discovering increased development leverage but have always been disappointed (except to keep my room warm during the winter, for which X86 hardware excels).
FWIW luckfox paired with Ubuntu is currently the most reliable, versatile, cost-effective, well documented, low power-consumption, & supported, micro delivery platform. Kudos.