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

Arch setup script #13111

Merged
merged 4 commits into from
Oct 10, 2019
Merged

Arch setup script #13111

merged 4 commits into from
Oct 10, 2019

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Oct 7, 2019

Describe problem solved by the proposed pull request
A lot of new hardware doesn't work properly on Ubuntu out of the box. We should support Arch and Arch based distributions like Manjaro with a setup script.

Describe your preferred solution
I followed the clean ubuntu script in this repository and adopted it to the requirements on Arch.

Test data / coverage
I tested the script on a Vanialla Manjaro 18.0.1 (latest). Everything but gazebo works and is super quick to set up compared to Ubuntu. The step that takes longest is to load the downgraded arm-gcc which we are hopefully able to get rid of at some point.

Test on pure Arch is still missing, if someone has a quick way to check it I would appreciate.

Describe possible alternatives
I saw https://github.com/PX4/containers/blob/master/docker/px4-dev/Dockerfile_base-archlinux but e.g. it downloads arm-gcc using pacman which is super nice but PX4 doesn't compile on GCC 9 yet.

@MaEtUgR MaEtUgR requested review from jlecoeur and julianoes October 7, 2019 13:35
@MaEtUgR MaEtUgR self-assigned this Oct 7, 2019
@dagar
Copy link
Member

dagar commented Oct 7, 2019

If we're going to carry scripts like this I'd like to use it all the way through for container setup, actual CI builds, and documentation. Otherwise these things tend to slowly rot off on the side.

@jlecoeur
Copy link
Contributor

jlecoeur commented Oct 7, 2019

it downloads arm-gcc using pacman which is super nice but PX4 doesn't compile on GCC 9 yet.

Yeah things are updated quickly on ArchLinux. It would be best to install the same compiler on all linux platforms.

If we're going to carry scripts like this I'd like to use it all the way through for container setup, actual CI builds, and documentation.

I agree.
Can we create a repository "PX4/install_scripts" and add it as a submodule of the firmware, container, and docs repos?

@dagar
Copy link
Member

dagar commented Oct 7, 2019

Can we create a repository "PX4/install_scripts" and add it as a submodule of the firmware, container, and docs repos?

We can do that if it will help version and keep things in sync. Although now that I think about it again the Dockerfiles (from PX4/containers) could/should probably live in PX4/Firmware as well. That would leave the documentation, but it already has mechanisms to stay synced with PX4/Firmware for param and airframe metadata.

@jlecoeur
Copy link
Contributor

jlecoeur commented Oct 7, 2019

OK, fewer submodules 👍

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Oct 7, 2019

Although now that I think about it again the Dockerfiles (from PX4/containers) could/should probably live in PX4/Firmware as well.

While having them in the same spot, what about using the setup scripts also in the Dockerfiles? That would be less duplication and double verification of using the same in CI.

@dagar
Copy link
Member

dagar commented Oct 7, 2019

While having them in the same spot, what about using the setup scripts also in the Dockerfiles?

Yes that's exactly what I'd like to do.

@hamishwillee
Copy link
Contributor

While having them in the same spot, what about using the setup scripts also in the Dockerfiles?

Yes that's exactly what I'd like to do.

We've been talking about that for over a year. How do we make that happen?

Docs currently point to correct version of ubuntu.sh script - ie v1.9.0 docs point to ubuntu.sh at that Firmware tag. Something to consider if we move the files.

Copy link
Contributor

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Tools/setup/arch.sh Show resolved Hide resolved
Tools/setup/arch.sh Outdated Show resolved Hide resolved
Tools/setup/ubuntu.sh Outdated Show resolved Hide resolved
sudo usermod -aG uucp $USER

# Remove modem manager (interferes with PX4 serial port/USB serial usage).
sudo pacman -R modemmanager --noconfirm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is evil. I vote we don't do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed (and done) on ubuntu. So it may be evil, but consistently evil. Of course if the ubuntu and arch modem managers are different this could be pointless.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also curious to know why this is evil.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because let's say you use modemmanager because you use LTE in your laptop and then the PX4 installer comes along and decides to just remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right thing to do is to make pull requests against modemmanager and add all IDs of all Pixhawks so that it ignores them.

The 3DR USB ID is ignored since 2014:
https://github.com/freedesktop/ModemManager/commit/9447527c357a91bbd3660274c41fd1b802e4cf84

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only display it if and only if there is a port available but it's already occupied by someone else.

Copy link
Member Author

@MaEtUgR MaEtUgR Oct 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this to a test with a Pixhawk 4 and a CUAV V5 nano (both fmu-v5) and having the modemmanager (version 1.10.4 latest arch) installed clearly breaks a lot of flashing attempts. Especially every attmpt where you start the script and then power the board every single time. Here's the output of me repeating this case with both board alternately, removing modemmmanager and all subsequent tries are successful. I don't consider to leave it if the chance of successful flashing is that low.

[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 003d00233138510638393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 3.9%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 003d00233138510638393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 0.0%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 003d00233138510638393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 0.0%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 002000223138510138393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 0.0%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 003d00233138510638393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 0.0%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
==========================================================================================================
WARNING: You should uninstall ModemManager as it conflicts with any non-modem serial device (like Pixhawk)
==========================================================================================================
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 002000223138510138393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [                    ] 0.0%
ERROR: timeout waiting for data (1 bytes)
FAILED: platforms/nuttx/CMakeFiles/upload 
cd /home/maetugr/Firmware/build/px4_fmu-v5_default && /usr/bin/python /home/maetugr/Firmware/Tools/px_uploader.py --port "/dev/serial/by-id/*-3D_Robotics_PX4_FMU_v5.x*,/dev/serial/by-id/*PX4_BL*,/dev/serial/by-id/*BL_FMU*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,/dev/serial/by-id/usb-Hex_ProfiCNC*,/dev/serial/by-id/usb-UVify_FMU_BL*" /home/maetugr/Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
ninja: build stopped: subcommand failed.
make: *** [Makefile:202: px4_fmu-v5] Error 1
[maetugr@ManjaroVM Firmware]$ sudo -R pacman modemmanager
sudo: invalid option -- 'R'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] file ...
[maetugr@ManjaroVM Firmware]$ sudo pacman -R modemmanager
[sudo] password for maetugr: 
checking dependencies...
:: networkmanager optionally requires modemmanager: cellular network support

Packages (1) modemmanager-1.10.4-1

Total Removed Size:  9.55 MiB

:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/1) removing modemmanager                                                                                                                          [###########################################################################################] 100%
:: Running post-transaction hooks...
(1/5) Reloading system bus configuration...
(2/5) Updating icon theme caches...
(3/5) Reloading system manager configuration...
(4/5) Reloading device manager configuration...
(5/5) Arming ConditionNeedsUpdate...
[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 002000223138510138393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting. Elapsed Time 28.415

[maetugr@ManjaroVM Firmware]$ make px4_fmu-v5 upload
[0/4] Performing build step for 'px4io_firmware'
ninja: no work to do.
[3/4] uploading px4
Loaded firmware for board id: 50,0 size: 1670412 bytes (80.92%), waiting for the bootloader...


Found board id: 50,0 bootloader version: 5 on /dev/serial/by-id/usb-3D_Robotics_PX4_BL_FMU_v5.x_0-if00
sn: 003d00233138510638393738
chip: 10016451
family: b'STM32F7[6|7]x'
revision: b'Z'
flash: 2064384 bytes
Windowed mode: False

Erase  : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting. Elapsed Time 28.433

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, just leave it in for now then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When/if you remove this let me know? The ubuntu.sh removes it too, and should stay/go for same reasons.

As I understand this, it could cause a firmware update to fail. What would that look like to the user? [I'm thinking of adding this as a docs note]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it in for now and check on it another day.

@hamishwillee it's already covered here: https://dev.px4.io/master/en/debug/faq.html#usb-errors

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Oct 8, 2019

I quickly tried and the script in this pr is definitely docker suitable.
I ran this minimal docker file:

FROM archlinux/base:latest

# install sudo to run setup script which works outside docker
RUN pacman -Sy --noconfirm sudo

# Copy setup scripts into container
COPY . /setup

RUN source /setup/arch.sh

The only problem I ran into was the PATH for arm-gcc getting set in ~/.profile which apparently doesn't work in docker but I can fix that. Then it builds posix and nuttx just fine.

@mrpollo
Copy link
Contributor

mrpollo commented Oct 8, 2019

I can support this PR with a few dev hours to get the docker images and CI setup, can we make a todo list for tracking what is missing?

@julianoes
Copy link
Contributor

What's wrong with the SITL mixer test?

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Oct 9, 2019

What's wrong with the SITL mixer test?

It can't possibly be related. Let me rebase and fix the reboot messages, then CI runs again.

EDIT: everything passes...

@MaEtUgR MaEtUgR force-pushed the arch-setup-script branch from 1ca08b5 to 760a204 Compare October 9, 2019 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin: Enhancement (improvement) 💡 Tools Sub-tools used within PX4 ecosystem (scripts, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants