Week 2 :

Build master/x86: meta-ros + agl-image-minimal

  • Kindly go through build process of AGL and building for x86 for detailed reference to setup and initialize AGL workspace.

    ## After setting up AGL workspace
    
    # Clone the meta-ros layer
    $ cd $AGL_TOP/master/external
    $ git clone https://github.com/ros/meta-ros.git
    $ cd meta-ros
    $ git checkout -b dunfell
    
    # Setup build directory
    $ cd $AGL_TOP/master/
    $ source meta-agl/scripts/aglsetup.sh -b build-x86-meta-ros-minimal agl-devel
    $ ln -sf $AGL_TOP/site.conf conf/
    $ ls -alh conf/
    
    # Edit the following conf files :
    
    $ vim conf/local.conf #add the following to the bottom, to save error logs for future debugging
    # local.conf
      INHERIT += "buildhistory"
      BUILDHISTORY_COMMIT = "1"
      IMAGE_INSTALL_append = " packagegroup-ros-world-foxy"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler-msgs"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler-ros"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "eigenpy"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "py-trees-ros-tutorials"
    
    $ vim conf/bblayers.conf #Replace the following chunk
    # bblayers.conf
      AGL_META_NETWORKING ?= ""
      AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python"
      AGL_META_ROS = " \
        ${METADIR}/external/meta-ros/meta-ros-common \
        ${METADIR}/external/meta-ros/meta-ros-backports-gatesgarth \
        ${METADIR}/external/meta-ros/meta-ros2 \
        ${METADIR}/external/meta-ros/meta-ros2-foxy \
        "
      AGL_OTHER_DEPENDENCY_LAYERS = " \
        ${AGL_META_NETWORKING} \
        ${AGL_META_PYTHON} \
        ${AGL_META_ROS} \
        "
      
    # Build the image
    
    $ cd $AGL_TOP/master/build-x86-meta-ros-minimal/
    $ source agl-init-build-env #if not sourced
    $ bitbake -p ros-core #build ros-core first, to check all layers are added.
    $ time bitbake agl-image-minimal #wait for the build process to finish.
    
  • The typical build process looks like : buildx86rosaglminimal

  • In initialization of AGL workspace, a documentation discrepancy was noted for which $AGL_TOP must be replaced with <AGL_TOP> and $HOME must be replaced with with complete path, because once bitbake is configured bash defined global variable won’t exist. Corresponding Change Requests were submitted for retification of the documentation error :

Run master/x86: meta-ros + agl-image-minimal

  • Kindly use pre-built image agl-image-minimal-qemux86-64, if you want to skip the building process.

  • Kindly go through using prebuilt x86 images for detailed reference to setup and initialize AGL workspace.

    ## gdrive : https://drive.google.com/drive/folders/1oypRNaYh1-vQgsarS5w83_-huQl8Rw49?usp=sharing
    
    #  Install the dependencies
    $ apt-get install qemu
    $ sudo apt install vinagre
    $ sudo apt install qemu-system-x86
    
    # Copy image and kernel files
    $ cp ~/Downloads/agl-image-minimal-qemux86-64.ext4 ./
    $ cp ~/Downloads/bzImage ./
    $ sync
    
    # Run
    $ ( sleep 5 && vinagre --vnc-scale localhost ) > /tmp/vinagre.log 2>&1 &
      qemu-system-x86_64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22 \
      -drive file=agl-image-minimal-qemux86-64.ext4,if=virtio,format=raw -show-cursor -usb -usbdevice tablet -device virtio-rng-pci \
      -snapshot -vga virtio \
      -vnc :0 -soundhw hda -machine q35 -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -enable-kvm \
      -m 2048 -serial mon:vc -serial mon:stdio -serial null -kernel bzImage \
      -append 'root=/dev/vda rw console=tty0 mem=2048M ip=dhcp oprofile.timer=1 console=ttyS0,115200n8 verbose fstab=no'
      
    # boots up
      Automotive Grade Linux 11.91.0+snapshot qemux86-64 ttyS1
    
      qemux86-64 login: root
      root@qemux86-64:~# source /usr/bin/ros_setup.sh #source ros environment
      root@qemux86-64:~# echo $LD_LIBRARY_PATH #check if ros environment is sourced
      root@qemux86-64:~# poweroff #else, runs in background
    

Build master/raspberrypi4: meta-ros + agl-image-minimal

  • Kindly go through build process of AGL and building for raspberrypi4 for detailed reference to setup and initialize AGL workspace.

    # After setting up AGL workspace
    
    # Clone the meta-ros layer, skip if already cloned
    $ cd $AGL_TOP/master/external
    $ git clone https://github.com/ros/meta-ros.git
    $ cd meta-ros
    $ git checkout -b dunfell
    
    # Setup build directory
    $ cd $AGL_TOP/master/
    $ source meta-agl/scripts/aglsetup.sh -f -m raspberrypi4 -b build-rpi4-meta-ros-minimal agl-devel
    $ ln -sf $AGL_TOP/site.conf conf/
    $ ls -alh conf/
    
    # Edit the following conf files :
    
    $ vim conf/local.conf #add the following to the bottom, to save error logs for  future debugging
    # local.conf
      INHERIT += "buildhistory"
      BUILDHISTORY_COMMIT = "1"
      IMAGE_INSTALL_append = " packagegroup-ros-world-foxy"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler-msgs"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "plotjuggler-ros"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "eigenpy"
      ROS_SUPERFLORE_GENERATED_WORLD_PACKAGES_remove = "py-trees-ros-tutorials"
    
    $ vim conf/bblayers.conf #Replace the following chunk
    # bblayers.conf
      AGL_META_NETWORKING ?= ""
      AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python"
      AGL_META_ROS = " \
        ${METADIR}/external/meta-ros/meta-ros-common \
        ${METADIR}/external/meta-ros/meta-ros-backports-gatesgarth \
        ${METADIR}/external/meta-ros/meta-ros2 \
        ${METADIR}/external/meta-ros/meta-ros2-foxy \
        "
      AGL_OTHER_DEPENDENCY_LAYERS = " \
        ${AGL_META_NETWORKING} \
        ${AGL_META_PYTHON} \
        ${AGL_META_ROS} \
        "
      
    # Build the image
      
    $ cd $AGL_TOP/master/build-rpi4-meta-ros-minimal/
    $ source agl-init-build-env #if not sourced
    $ bitbake -p ros-core #build ros-core first, to check all layers are added.
    $ time bitbake agl-image-minimal #wait for the build process to finish.
      Build Configuration:
      BB_VERSION           = "1.46.0"
      BUILD_SYS            = "x86_64-linux"
      NATIVELSBSTRING      = "debian"
      TARGET_SYS           = "aarch64-agl-linux"
      MACHINE              = "raspberrypi4-64"
      DISTRO               = "poky-agl"
      DISTRO_VERSION       = "11.91.0+snapshot-20210602"
      TUNE_FEATURES        = "aarch64"
      TARGET_FPU           = ""
      DISTRO_NAME          = "Automotive Grade Linux"
      ROS_DISTRO           = "foxy"
      ROS_VERSION          = "2"
      ROS_PYTHON_VERSION   = "3"
      meta-raspberrypi     = "HEAD:77190af02d48adc2b28216775e6318e9eeda571c"
      meta-python          = "dunfell:11eae114522a6befa06c7f4021a83bc016133543"
      meta-ros-common      
      meta-ros-backports-gatesgarth 
      meta-ros2            
      meta-ros2-foxy       = "dunfell:7b0e0f7e5101d300ff9d75b06d7c4371376fad00"
      meta-oe              = "dunfell:11eae114522a6befa06c7f4021a83bc016133543"
      meta-agl-core        
      meta-agl-core-test   
      meta-agl-bsp         = "HEAD:109051d8049fde31ca9421d6d590fef51131c01b"
      meta                 
      meta-poky            = "HEAD:8f7d34d135e167f8949a9c44c00fd066408cb120"
    
      Initialising tasks: 100% |  #########################################################| Time: 0:00:11
      Sstate summary: Wanted 1793 Found 459 Missed 1334 Current 0 (25% match, 0%  complete)
      NOTE: Executing Tasks
      NOTE: Tasks Summary: Attempted 4443 tasks of which 1398 didn't need to be rerun   and all succeeded.
      NOTE: Writing buildhistory
      NOTE: Writing buildhistory took: 432 seconds
    
      Summary: There was 1 WARNING message shown.
      real	128m31.869s
      user	0m12.180s
      sys	0m1.954s
    

Run master/raspberrypi4: meta-ros + agl-image-minimal

  • Kindly use pre-built image agl-image-minimal-raspberrypi4-64, if you want to skip the building process.

  • Kindly go through using prebuilt raspberrypi4 images for detailed reference to setup and initialize AGL workspace.

    ## gdrive : https://drive.google.com/drive/folders/1PQfvwBNjYpe7csRfl5oTzcskPDfQy80g?usp=sharing
    
    # Copy image and extract into SD card
    $ cp ~/Downloads/agl-image-minimal-raspberrypi4-64.wic.xz ./
    $ lsblk #find <SD_CARD>
    $ sudo umount <SD_CARD>
    $ xzcat agl-image-minimal-raspberrypi4-64.wic.xz | sudo dd of=<SD_CARD> bs=4M
    $ sync
      
    # Boot up Pi and Run
      login: root
      ~# top #view current processes
      ~# source /usr/bin/ros_setup.sh #source ros environment
      ~# echo $LD_LIBRARY_PATH #check if ros environment is sourced
    
  • Raspberry pi 4 boots up as : runrpi4rosaglminimal