How to share a zephyr build for the Q from one Q to another?

Suppose I wish to share a zephyr build that I built on my Uno Q4 on my Uno Q2,
what do I need to do.

Option 1 does not work for me: Which is to go through the full process of installing the build environment on the Q2 as well. It runs out of space when it tries to git clone of the zephyr project within the bootstrap.sh step

Option 2 copy bits from the Q4 to the Q2, so far not running yet. What I am currently trying is:
full setup to build on Q4 - Note: I cloned GitHub - KurtE/ArduinoCore-zephyr: Arduino Core based on Zephyr+llext · GitHub and then checked out the branch of my current PR: llext_long_exports.

source ./venv/bin/activate
west update
deactivate
./extras/build.sh unoq

I already have it setup with ~/arduino/hardware/arduino/zephyr pointing to this and the
main build with .arduino15 disabled.
I can flash and build with it:

On the Q2: I have also git cloned the same URL and checkout the same branch, and setup. I already have it setup with ~/arduino/hardware/arduino/zephyr pointing to this and the main build with .arduino15 disabled.

From the Q4, I copied the ~/git/ArduinoCore-zephyr/firmwares directory to a newly created firmwares directory.

From the Q4, I copied the file :~/git/ArduinoCore-zephyr/variants/arduino_uno_q_stm32u585xx/llext-edk.tar.Z
to the same location on the q2, I then used, the command line:
tar -xvf llext-edk.tar.Z
to expand it into place in the variant.

I was then able to burn the bootloader using the command:
arduino-cli burn-bootloader -b arduino:zephyr:unoq -P jlink

But when I try to build the same sketch using arduino-cli on the Q2

arduino@Uno-q2:~/gamepad_test$ cat ./compile_sketch
arduino-cli compile --fqbn arduino:zephyr:unoq --upload sketch/
arduino@Uno-q2:~/gamepad_test$ ./compile_sketch
The library Arduino_RPClite has been automatically added from sketch project.
arm-zephyr-eabi-g++: fatal error: cannot specify '-o' with '-c', '-S' or '-E' with multiple files
compilation terminated.
The library Arduino_RouterBridge has been automatically added from sketch project.
The library ArxContainer has been automatically added from sketch project.
The library ArxTypeTraits has been automatically added from sketch project.
The library DebugLog has been automatically added from sketch project.
The library Dynamixel2Arduino has been automatically added from sketch project.
The library MsgPack has been automatically added from sketch project.

Used library         Version Path
Arduino_RPClite      0.2.1   /home/arduino/.arduino15/internal/Arduino_RPClite_0.2.1_ce72ff552a496aef/Arduino_RPClite
Arduino_RouterBridge 0.4.1   /home/arduino/.arduino15/internal/Arduino_RouterBridge_0.4.1_d378119a47d2c8c4/Arduino_RouterBridge
ArxContainer         0.7.0   /home/arduino/.arduino15/internal/ArxContainer_0.7.0_007f0bb2a1cdefe3/ArxContainer
ArxTypeTraits        0.3.2   /home/arduino/.arduino15/internal/ArxTypeTraits_0.3.2_d65e2aabfeed7838/ArxTypeTraits
DebugLog             0.8.4   /home/arduino/.arduino15/internal/DebugLog_0.8.4_c199e2cf6415ecc8/DebugLog
Dynamixel2Arduino    0.8.1   /home/arduino/.arduino15/internal/Dynamixel2Arduino_0.8.1_8b0e8df6a1581977/Dynamixel2Arduino
MsgPack              0.4.2   /home/arduino/.arduino15/internal/MsgPack_0.4.2_a0d4adc5044d022c/MsgPack

Used platform  Version Path
arduino:zephyr 9.9.9   /home/arduino/Arduino/hardware/arduino/zephyr
Error during build: exit status 1

So what am I missing? My guess is something within the bootstrap.sh
(west update) probably changed some of the tools?

Or is this something better asked on Github?

Thanks in advance
Kurt

@ptillisch and all made some progress...

Decided to copy the whole variant over instead of just using lltext...

Then the compile failed as missing api... file.

So needed to:

mkdir -p ~/git/modules/lib
cd  ~/git/modules/lib
git clone  https://github.com/arduino/ArduinoCore-API

Then build is starting to work. Now need to edit
Serial to be Serial1... but that is a different story

Edit: With this core if I try to build different Apps, like my weather2 it is also
failing to build, like it did on Q4

Starting app "Weather2"
Sketch profile configured: Name="default", Port=""
The library ArduinoGraphics has been automatically added from sketch project.
The library Arduino_HS300x has been automatically added from sketch project.
The library Arduino_LPS22HB has been automatically added from sketch project.
The library Arduino_LSM6DSOX has been automatically added from sketch project.
The library Arduino_LTR381RGB has been automatically added from sketch project.
The library Arduino_Modulino has been automatically added from sketch project.
The library Arduino_RPClite has been automatically added from sketch project.
The library Arduino_RouterBridge has been automatically added from sketch project.
The library ArxContainer has been automatically added from sketch project.
The library ArxTypeTraits has been automatically added from sketch project.
The library DebugLog has been automatically added from sketch project.
The library MsgPack has been automatically added from sketch project.
The library STM32duino VL53L4CD has been automatically added from sketch project.
The library STM32duino VL53L4ED has been automatically added from sketch project.
The library SparkFun Qwiic Button and Qwiic Switch Library has been automatically added from sketch project.
WARNING: library ArduinoGraphics claims to run on samd, renesas_uno architecture(s) and may be incompatible with your current board which runs on zephyr architecture(s).
/home/arduino/.arduino15/packages/zephyr/tools/arm-zephyr-eabi/0.16.8/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/arduino/ArduinoApps/weather2/.cache/sketch/core/core.a(main.cpp.o): in function `main':
/home/arduino/Arduino/hardware/arduino/zephyr/cores/arduino/main.cpp:39: undefined reference to `setup'
/home/arduino/.arduino15/packages/zephyr/tools/arm-zephyr-eabi/0.16.8/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/arduino/Arduino/hardware/arduino/zephyr/cores/arduino/main.cpp:39: undefined reference to `loop'
collect2: error: ld returned 1 exit status
exit status 1

Like I showed in the other thread which points to the issue:
Current sources RC2... Build failing for building UNOQ sketches... · Issue #452 · arduino/ArduinoCore-zephyr

maybe try to delete the .cache folder for the app..
do believe it will be rebuilt using new core..
haven't tried it myself but was thinking need to burn the new firmware and copy the /hardware/zephyr/newversionfolder from the 4g that was used to compile new firmware..

good luck.. ~q

Thanks, I am running into two issues, one is what/how to copy the stuff from
one build to another, and the other is that I think the current sources for the Q has
some issues, which hopefully will be addressed before the next release.

@ptillisch and all:

Back to the copy. I tried to emulate some of what is mentioned on the Readme file

If you are only interested in developing features in the core or libraries, and do not want to set up a full Zephyr build environment, you can use the sync-zephyr-artifacts utility to download a pre-built version of the files needed to compile sketches and flash the loader.

To do so, after cloning this repo, compile the sync-zephyr-artifacts utility via go build and run it as sync-zephyr-artifacts . to retrieve the precompiled files for the current revision of the core.

I have never used GO before but looking at the sources it looked like it copied the firmware directory, which I did, and it copied the variants ltext-edk directory which it had compressed into a .tar.Z file, which I copied and then used the tar command to expand.

But when I first tried to build with it, I received some strange compiler error. I then went and looked at the Q's variant directory and noticed that the ones I have built have several other files in them. If you look at the screen show below the directory on the left is from my github clone (untouched), the one on the right is the whole directory I copied back from the Q4, notice all of the new files that are not part of github here that I highlighted.
So when I copied the whole directory the compiler got farther...

So first question is: Does the sync-zephyr-artifacts command (and the build process) save these additional files and install them as well? If not probably should.

EDIT - It appears to copy/create thos additional files. will try more later - Note the instructions for this command are
not great. The readme in the tools directory is a better than the top level README file, in that there is a prebuilt tool if you have zephyr boards ... Also the command:
sync-zephyr-artifacts .
Should say
`sync-zephyr-artifacts dir_where_ArduinoCore-zephyr_is_installed'

Second maybe issue for README.md file: cores/arduino/api directory is saved in the ArduinoCore-zephyr github is stored as a symbolic link to: ../../../modules/lib/ArduinoCore-API/api/ which does not exist if you simply cloned the ArduinoCore-zephyr github project.

I solved it here for a linux machine by simply cloning the project into the right space:

mkdir -p ~/git/modules/lib
cd  ~/git/modules/lib
git clone  https://github.com/arduino/ArduinoCore-API

Note: ~/git is the directory that cloned ArduinoCore-zephyr into.

If you were trying to do this to run on a Windows machine, I have had issues with these
symbolic links, so I usually do similar to the linux steps plus regenerate a link. Something like:

d:
mkdir \github\modules\lib
cd  \github\modules\lib
git clone  https://github.com/arduino/ArduinoCore-API

cd \github\ArduinoCore-zephyr\cores
rm api
mklink /J api d:\github\ArduinoCore-API\api

Have you enabled the Windows "Developer Mode" setting:

I haven't tried it (I try to keep my machine as "vanilla" as possible in order to most closely emulate the environment of the users I am supporting), but it is my understanding that this will allow creating symlinks without administrative privileges.

The problems I encounter using symlinks on Windows is when I try to create one without administrative privileges. I always remember to open a terminal running as administrator when I am creating a symlink directly, but I sometimes neglect to do so in more nuanced instances:

  • moving a folder that is, or contains, a symlink
  • cloning a Git repository that contains symlinks
  • checking out a ref in a Git repository that should result in the creation or movement of a symlink

Otherwise I find they work perfectly. So I think that enabling "Developer Mode" would eliminate the pain points of working with symlinks on Windows. Of course you must evaluate whether you feel this setting is appropriate for you.

Thanks @ptillisch

I think I know what is happening with the API links. I believe that
github converts them to symbolic directory links.

I believe there are differences in how some symbolic links work.
Before I had better luck with Junction links /J

d:\temp\Arduino\hardware\arduino>mklink
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.

But it appears like in some cases the directory symbolic link works best.

I have a directory pointing to my clean fork of ArduinoCore-zephyr, both ways

d:\temp\Arduino\hardware\arduino>dir
 Volume in drive D is DATA
 Volume Serial Number is 5C92-8524

 Directory of d:\temp\Arduino\hardware\arduino

04/28/2026  06:49 AM    <DIR>          .
04/28/2026  06:39 AM    <DIR>          ..
04/28/2026  06:49 AM    <SYMLINKD>     zephrd [d:\github\ArduinoCore-zephyr-clean]
04/28/2026  06:39 AM    <JUNCTION>     zephyr [d:\github\ArduinoCore-zephyr-clean]
               0 File(s)              0 bytes
               4 Dir(s)  576,755,994,624 bytes free

If I try to list the api directory with these two links, first the junction type which I have used in the actual hardware directory.

You can see it does not go through the api symbolic link, but it does see it:

d:\temp\Arduino\hardware\arduino>dir zephyr\cores\arduino\api
 Volume in drive D is DATA
 Volume Serial Number is 5C92-8524

 Directory of d:\temp\Arduino\hardware\arduino\zephyr\cores\arduino\api

File Not Found

d:\temp\Arduino\hardware\arduino>dir zephyr\cores\arduino\a*
 Volume in drive D is DATA
 Volume Serial Number is 5C92-8524

 Directory of d:\temp\Arduino\hardware\arduino\zephyr\cores\arduino

04/17/2026  09:15 AM               450 abi.cpp
04/17/2026  06:40 AM    <SYMLINKD>     api [..\..\..\modules\lib\ArduinoCore-API\api\]
04/20/2026  02:23 PM             6,400 Arduino.h
               2 File(s)          6,850 bytes
               1 Dir(s)  576,745,836,544 bytes free

d:\temp\Arduino\hardware\arduino>

However if I use the directory symbolic link one, it works.

d:\temp\Arduino\hardware\arduino>dir zephrd\cores\arduino\api
 Volume in drive D is DATA
 Volume Serial Number is 5C92-8524

 Directory of d:\temp\Arduino\hardware\arduino\zephrd\cores\arduino\api

07/18/2025  02:03 PM    <DIR>          .
01/16/2025  09:49 AM    <DIR>          ..
07/18/2025  02:03 PM             1,525 ArduinoAPI.h
07/18/2025  02:03 PM            23,145 Binary.h
07/18/2025  02:03 PM             1,858 CanMsg.cpp
07/18/2025  02:03 PM             4,804 CanMsg.h
07/18/2025  02:03 PM             2,367 CanMsgRingbuffer.cpp
07/18/2025  02:03 PM             2,475 CanMsgRingbuffer.h
07/18/2025  02:03 PM             1,550 Client.h
07/18/2025  02:03 PM             1,158 Common.cpp
07/18/2025  02:03 PM             5,365 Common.h
07/18/2025  02:03 PM             1,142 Compat.h
07/18/2025  02:03 PM    <DIR>          deprecated
07/18/2025  02:03 PM    <DIR>          deprecated-avr-comp
07/18/2025  02:03 PM             9,450 DMAPool.h
07/18/2025  02:03 PM             4,122 HardwareCAN.h
07/18/2025  02:03 PM             1,568 HardwareI2C.h
07/18/2025  02:03 PM             5,761 HardwareSerial.h
07/18/2025  02:03 PM             3,729 HardwareSPI.h
07/18/2025  02:03 PM             2,118 Interrupts.h
07/18/2025  02:03 PM            12,181 IPAddress.cpp
07/18/2025  02:03 PM             4,287 IPAddress.h
07/18/2025  02:03 PM             1,363 itoa.h
07/18/2025  02:03 PM             2,504 PluggableUSB.cpp
07/18/2025  02:03 PM             2,317 PluggableUSB.h
07/18/2025  02:03 PM             8,255 Print.cpp
07/18/2025  02:03 PM             3,200 Print.h
07/18/2025  02:03 PM             1,357 Printable.h
07/18/2025  02:03 PM             3,265 RingBuffer.h
07/18/2025  02:03 PM               992 Server.h
07/18/2025  02:03 PM             9,195 Stream.cpp
07/18/2025  02:03 PM             6,347 Stream.h
07/18/2025  02:03 PM            17,915 String.cpp
07/18/2025  02:03 PM            11,341 String.h
07/18/2025  02:03 PM             4,477 Udp.h
07/18/2025  02:03 PM             2,045 USBAPI.h
07/18/2025  02:03 PM             4,692 WCharacter.h
              33 File(s)        167,870 bytes
               4 Dir(s)  576,745,836,544 bytes free

d:\temp\Arduino\hardware\arduino>dir zephr\cores\arduino\api

Will have to try updating my real setups to see if it works with the normal directory symbolic links...

I am going to mark this one as partially solved and the current issue
was closed:
sync-zephyr-artifacts not working on Windows · Issue #456 · arduino/ArduinoCore-zephyr

And several issues were resolved :smiley:

On last issue, I have with using the sync-zephyr-artifacts to sync up my Q2 to the current release is I run out of space on the Q2. The issue I believe is:

It first downloads a .tar.bz2 file from the server, it then I believe it expands the whole archive into a directory, which I think does fit in that it is in a different partition: (Disregard the size here is this is the Q4)
/dev/mmcblk0p68 10195512 7758280 1923320 81% /

It then updates ALL of the zephyr variants, which if I look at my Q4 board at the size of variants:

arduino@Uno-Q4:~/git/ArduinoCore-zephyr$ du -sh variants
732M    variants
arduino@Uno-Q4:~/git/ArduinoCore-zephyr$

And if I look at my Windows 11 machine that I ran the sync-zephyr-artifacts on I see:


And firmwares takes up another about 84.4mb

Which is a lot of space to take up on the little Q2 :wink:

Will probably create a new issue, with suggestion on having the ability to only update some variants, some possible options might include:

a) Only those in the boards.txt or variants in the variants directory...
(Might want/need simple instruction or cmd to update your git clone to setup for this...

b) Maybe command line option like:
sync-zephyr-artifacts [ALL, or IDE, APPLAB, ...]
List could be also like: [Q, Zephyr, contributed]

c) Or maybe can specify by list?
sync-zephyr-artifacts unoq portentah7 giga

d) Interactive mode? where it asks for each one?

...

Note with some of these options: maybe makes sense if the .tar.bz2 might be split into multiple files?