Azure / iot-hub-device-update

Device Update for IoT Hub agent
MIT License
53 stars 41 forks source link

Build the agent with yocto dunfell 3.1 version (boost 1.72.0, cpprest 2.10.16 ) #50

Closed pierrickcurt closed 2 years ago

pierrickcurt commented 3 years ago

With Dunfell the iot-hub-device-update is not building due to wrong dependancies with boost version 1.72.0 and cpprest version 2.10.16. It is the same with ubuntu 20.04 (boost version 1.71.0)

Here are the modifications to be able of building the agent on yocto dunfell

The three patches are in attachments patch-adu.zip

ValOlson commented 3 years ago

Thank you for sharing your learnings with us on how to port the Device Update agent for Yocto Dunfell and Ubuntu 20.04.

SimonSimCity commented 3 years ago

@pierrickcurt When I try to build the agent in yocto dunfell, I get a couple of different error messages first (e.g. about an outdated git-url and branch names, that I have to update the bb-file format (recipes-azure-device-update/adu-agent-service/adu-agent-service.bb), that mtd-utils is not referenced in the swupdate file) before encountering an error about the ssl library - which I couldn't get around yet.

Assuming you passed all these, and even got it to build: It would be great to get a how-to on how you got around these errors - best would be a diff to the meta-layer provided in the downloads of this repo.

SimonSimCity commented 3 years ago

@pierrickcurt I've just created a repo for the meta-layer. It would be nice to have your version, which you got working for dunfell added there as branch: https://github.com/SimonSimCity/meta-azure-device-update

Also take a look at the other additions I did in the zeus branch - I guess some of them might be useful for you too.

pierrickcurt commented 3 years ago

@SimonSimCity can you push your wip dunfell branch on your repo ? Maybe I can help you.

SimonSimCity commented 3 years ago

@pierrickcurt Thanks for providing you help! I've created a branch containing all the changes I did for dunfell: https://github.com/SimonSimCity/meta-azure-device-update/tree/dunfell

And here's the commands I run. Now it seems I'm getting errors which could be corrected by your changes. You can run the following commands on an empty folder to see it:

git clone --depth=1 -b dunfell git://git.yoctoproject.org/poky
git clone --depth=1 -b dunfell git://github.com/openembedded/meta-openembedded.git
git clone --depth=1 -b dunfell git://github.com/agherzan/meta-raspberrypi.git
git clone --depth=1 -b dunfell git://github.com/sbabic/meta-swupdate.git
git clone --depth=1 -b dunfell git://github.com/SimonSimCity/meta-azure-device-update

source poky/oe-init-build-env

bitbake-layers add-layer ../meta-openembedded/meta-oe
bitbake-layers add-layer ../meta-openembedded/meta-python
bitbake-layers add-layer ../meta-openembedded/meta-networking
bitbake-layers add-layer ../meta-openembedded/meta-multimedia
bitbake-layers add-layer ../meta-raspberrypi
bitbake-layers add-layer ../meta-swupdate
bitbake-layers add-layer ../meta-azure-device-update

cat >>conf/local.conf <<EOL

MACHINE = "raspberrypi3"

SDIMG_ROOTFS_TYPE = "ext4"
ENABLE_UART = "1"
RPI_USE_U_BOOT = "1"
PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
DISTRO_FEATURES_append = " systemd virtualization"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

IMAGE_INSTALL_append = " azure-device-update"

ADUC_PRIVATE_KEY = "/home/yocto/project/priv.pem"
ADUC_PRIVATE_KEY_PASSWORD = "/home/yocto/project/priv.pass"

EOL

echo "TestPassword" > ../priv.pass
openssl genrsa -aes256 -passout file:../priv.pass -out ../priv.pem

bitbake core-image-base

You should get it already when trying to bitbake deliveryoptimization-agent.

SimonSimCity commented 3 years ago

I've now tried to apply the patches you provided in the branch dunfell-dev (see https://github.com/SimonSimCity/meta-azure-device-update/commit/f2b592d034e2d9df9d5f2217f1604471e1a70bc9) but without success. I am obviously using a different version than you because the patch for client-lite/CMakeLists.txt wasn't necessary in my case. Since you seem to have more experience in C than I (I have almost none ...) it would be nice if you could take a look at it. Maybe it's just as fast as taking a different commit-id as basis ... Looking forward to hear from you.

SimonSimCity commented 3 years ago

Our branch now includes the mentioned changes and I've proofed it working - check it out: https://github.com/munit-solutions/meta-azure-device-update/tree/dunfell

@kapetan Thanks for your help!