Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build script to enable building on Podman #378

Open
wants to merge 485 commits into
base: main
Choose a base branch
from

Conversation

JoonasOnatsu
Copy link

Podman needs the '--usens=keep-id' argument to properly map
the directory permissions of the '/px4-firmware/sources' mount
when building with unprivileged/non-root Podman containers.

Without this, the '/px4-firmware' directory in the container has the
proper owner 'builder:builder', but the '/px4-firmware/sources'
mounted by '-v' argument will not, it will be owned by root and
the build script crashes & burns with permission errors.

NOTE: I haven't yet checked if there are other permission issues
hidden somewhere else when building the image with Podman.
At least this enables building in the first place.

jlaitine and others added 30 commits December 14, 2022 13:24
…errupt when jumping out of the bootloader

Leaving interrupt on here will break the USB in random ways after booting

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This allows signinig the protected mode binary, by encapsulating the
firmware between a header (the ToC) and the signature, instead of placing
the ToC inside of the firmware itself.

The problem was that the ToC went to the kernel binary, while the
signature is appended to the user binary. The ToC needs the location of
the signature which cannot be known at the time when the kernel is linked.

For ToC integrity protection, the ToC itself is also signed and verified.
Removed, as it is not needed
We'll do this for now, until some better solution is found. Currently disabling mag #0 by
parameters doesn't seem to work, it kills the magnetometer usage completely.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
- The vector table needs to be aligned correctly, depends on the amount
  of interrupts. 4K should be enough for this target.
- Padd the firmware to the correct size, the signature must start at a
  4B alignment.
- The firmware end address needs to be aligned as well, because the
  calculated signature size is the firmware size + the additional padding
Use the old code to verity ToC (the fist entry must contain it though)
Also simplify the previous implementation. The first TOC
entry must contain the TOC; but it doesn't matter whether
it contains only the TOC or also something else

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Re-build did not re-create the ToC, which results in a bad ToC for the
px4 firmware.
The syscall lookup table contains poisoned xxenv() procedures and causes
a build error. The file is included via a massive header that includes
almost everything in /arch/risc-v/ etc (riscv_internal.h). This was
already fixed once, and, tbh, suppressing the poison error is the only
way to get this to work reliably.
Add recv_port into cmd line option
task_delete() API is not always available, so forward the call to
px4_task_delete() which knows what to do.
…th old master branch

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
The reason for this is that log.h includes drv_hrt.h which sucks in
half the project's include files with it, which causes strange build
issues
User space code cannot use critical sections, use a semaphore in that
case. The kernel side still uses critical sections.

Note: This cannot be done by ifdef-flagging, as the user-/kernel side
use the same work_queue.a library.
Use IRQ locking only when the atomic access is performed from IRQs
jlaitine and others added 26 commits March 30, 2023 12:19
…and run

Icicle target has suffered some bit-rot while not being used for a long time. Keep it
up to date so that it can be used for development

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Makes it a bit simpler to select correct linker script(s) for each
build type.
Streams have been moved to user space, so do not need to link nuttx_sched
into nuttx_c any longer.
- New memory map
- .secmem section
The uploader script calculates the crc over the maximum image size. With
32MB images it takes longer than 0.5s, so just wait for longer

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Centralized set of ip addresses in beginning of rcS
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
… from NuttX

This also fixes the issue that only 6 first bytes of the serial number are used

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
…ices

This is more or less hardcoded module, which can be used as basis for
more advanced functionality later.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
The PX4 IP address in ethernet network is 192.168.201.100+MAV_SYS_ID

Default MAV_SYS_ID is 1, so in normal configurations the IP is 192.168.201.101

This makes it possible to have several PX4-only devices in same switched network, and
controlled with a single mavlink-based GCS; just set different MAV_SYS_ID to every drone.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Setting duty cycle as 0 on initialization phase in not allowed.
The value has to be something from 1 to 65535.
With 0 CorePWM FPGA block generates square wave until
the real pwm values are set after the system init has been done.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
permissions properly when using unprivileged/non-root
container for building.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
@jlaitine jlaitine requested a review from jnippula April 11, 2023 07:47
@jlaitine
Copy link

Maybe squash the commits together; let's merge this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.