Preparing native Raspberry Pi OS for LinuxCNC

More
2 years 8 months ago #294309 by Cant do this anymore bye all
Small correction it’s not the amount of memory used to build the image it’s the size of the file on disk used to create the boot & root partitions and file systems in, later on during the process these are mounted, as you would a physical disk partition, as well as some of the “virtual” file systems, and qemu “boots” and your have your virtual arm64 machine, and this is the environment that everything is installed for the final file system.
Actually after the image has been finalised you can start a qemu session with it and make any fine adjustments and these will be in the image after you exit the qemu session. I haven’t attempted a full GUI session but a text mode session is fine. Of course you need to setup and mount the image and add the virtual file systems before hand, but if you look through the code you’ll see how this is done.
Basically the same as when you create a virtual machine with say for example VirtualBox. You’re asked how big you want your disk to be. Then a file is created (can be a fixed size or dynamically allocated) and when you boot partitions and file systems are created in the file.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #294322 by rodw

Small correction it’s not the amount of memory used to build the image it’s the size of the file on disk used to create the boot & root partitions and file systems in, later on during the process these are mounted, as you would a physical disk partition, as well as some of the “virtual” file systems, and qemu “boots” and your have your virtual arm64 machine, and this is the environment that everything is installed for the final file system.
Actually after the image has been finalised you can start a qemu session with it and make any fine adjustments and these will be in the image after you exit the qemu session. I haven’t attempted a full GUI session but a text mode session is fine. Of course you need to setup and mount the image and add the virtual file systems before hand, but if you look through the code you’ll see how this is done.
Basically the same as when you create a virtual machine with say for example VirtualBox. You’re asked how big you want your disk to be. Then a file is created (can be a fixed size or dynamically allocated) and when you boot partitions and file systems are created in the file.
I suspect you missed the pain caused by buggy changes made by upstream that broke my build....

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #294324 by Cant do this anymore bye all
What changes were they ?
Even from the beginning that number referred to file size for the that the partitions and file systems .

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #294344 by rodw

What changes were they ?
Even from the beginning that number referred to file size for the that the partitions and file systems .
 
In their changed scripts they attempted to do some maths to work out the size to use and they got it way wrong.  And of course i was the crash dummy that found the bug which was painful for a few days... But they fixed it.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #294356 by Cant do this anymore bye all
Bugger hey, but like I said the value isn't a "memory" value but a disk image value.

Once I get this effing diabetes under control I'll pop down in the garage and start doing some real world testing of Linuxcnc on the Raspberry Pi image and the image built via the image maker....and see if the gvfs modules and network manager are an issue, from previous experience I don't see it being such an issue to make it unusable with mesa hardware, maybe direct gpio with a base & servo thread maybe a different kettle of fish . Wont be on the mill as I don't want to delve into the control box, but on the Frankenstein Myford ML7/Super 7. Reminds me I'll have to jerry rig something up for the spindle encoder.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #294446 by ago_tm

Yes, I used 20 cores....
You need to read and understand userdata.txt.
There are basically 3 steps.
1. Get the Pi kernel source and build the lernel
2. Build the root file system
3. Build the image.

The relevant preempt_rt patch 6.1.69-rt21 from kernel.org  is in userpatches
The commit is from the Raspberry 6.1.y kernel source  github.com/raspberrypi/linux
This is the very next commit after the 6.1.69 kernel was merged into the raspberry kernel repo
This is important because without locking in the commit to get, the kernel can diverge a lot and it will become unstable with that patch
You could look for later  RT patches and find a later kernel release that matches it.
After the Pi5 was released it took a long time before such a merge happened or the happened out of step. The current version  is common for both the Pi5 and Pi4

Also from userdata.txt
### CUSTOM KERNEL - Comment out the one not required
CUSTOM_DEFCONFIG="0"
#MYCONFIG="linuxcnc-pi4_defconfig"
#MYCONFIG="linuxcnc-pi5_defconfig"
Once you configure the kernel with menuconfig, you can save the generated defconfig and tell it to use that. This means that on future builds, it skips menuconfig.

Also in custom.txt, try changing the image size to 12288MB. (12gb) This is how much memory is used when building the image. This might let you use the pi imager to burn the image. I found some bugs in their IMG shrink routine so made it big. I can't remember if the upstream changes have been merged in to fix this.

I installed network manager but Andy observed latency got worse so I took it out. You could add it to USER_PKGS 
github.com/rodw-au/rpi-img-builder-lcnc/...ata.txt#L24C1-L24C11

I deliberately kept the image as standard as possible to stay as close to what the x86 installer offers
 
Hello, today I have a pleasure to test your build system. First of all - it is really great work, thanks again!
I started with the default settings (mostly) and successfully built the image, but I cannot write it to the SD Card as RPI Imager says something like "Input file is not a valid image file. File size 3,795,000,000 is not aligned by 512 bytes" (it isn't the exact error message, my translation from my localized version, not sure how to change UI language there). RPI Imager v.1.8.5 (latest available).
Very probably something wrong with my settings or steps.

Configuration changes:
custom.txt:

HOSTNAME="pi-cnc"

userdata.txt
NAME="Andrey"
USERNAME="ago"
PASSWORD="*"
VERBOSE="1"
COMPRESS_IMG="1"
ENABLE_COMMIT="1"
COMMIT="342c7ee49e862edc30c893f141f55b9211b7a43b"
KBUSER="ago"
KBHOST="pc-cnc"

After preparing these files manually and ensuring that the board.txt file created 


I also received file .cache/git_fast.linux-rpi-6.1.y
GIT_FAST="true"
GIT_COMMIT="afd5f659b0453e4c710ce5cf74c577563ff16239"

Output files:
rpi-4-debian-bookworm-6.1.77-rt21-arm64-ext4-2024-02-25-2312.img.xz
rpi-4-debian-bookworm-6.1.77-rt21-arm64-ext4-2024-02-25-2312.img.xz.sha256
output/bcm2711/linux-headers-bcm2711-rpi-4_6.1.77-rt21-1_arm64.deb
output/bcm2711/linux-image-bcm2711-rpi-4_6.1.77-rt21-1_arm64.deb
output/logs (attached)

I will be very pleased if you can suggest something to move on.
Thank you!

 

Please Log in or Create an account to join the conversation.

Time to create page: 0.478 seconds
Powered by Kunena Forum