***modified ardrone2**: UAV with modified kernel and rootfs
***plf** : Parrot's proprietary format to pack datas (rootfs, kernel, kernel command line, etc). This format has been more and less reverse engineered. Tools exist to read/write plf files (they are included in robomap3)
***ardrone2**: machine (poky definition) in robomap3; the production rootfs, we fly with it; it installs in the flash (mtd3 for rootfs, mtd1 "main_boot" for kernel)
***ardrone2-updater**: machine (poky definition) in robomap3; allows flashing the production rootfs; it installs in the flash (mtd2 for rootfs, mtd1 "alt_boot" for kernel)
***ardrone2-installer**: machine (poky definition) in robomap3; allows to entirely flash the system (production or updater); it is a ramfs
We do not have source code of this proprietary program. There is no open source alternative for the moment.
It could be replaced by xloader (TI) and u-boot.
By default, the bootloader loads the plf kernel from the *main_boot* partition of mtd1. To load another kernel (from the other mtd1 partition, *alt_boot*), labels of these partitions must firstly be swapped:
`# ubiattach -p /dev/mtd1` (note the ubi partition number)
`# ubirename /dev/ubix main_boot alt_boot alt_boot main_boot` (replace x by the partition number)
`# ubidetach -p /dev/mtd1`
Note that a script called *launch_update.sh* is provided in the rootfs in order to do this swap (see [update a modified adrone2 rootfs](#update-a-modified-ardrone2-rootfs)).
If the adrone2 is USB plugged to a computer, the bootloader can load and run another bootloader (see [flash an original ardrone2 with USB cable](#flash-an-original-ardrone-2-with-usb-cable)).
# Prerequisite for flashing with a USB cable
* Install a serial port communications program: cutecom, minicom, etc
* Install the x86_64 [toolchain](install-toolchains).
**inst_usb_bootldr.bin*: Parrot proprietary bootloader, loads from USB. It allows to load from USB a plf file (kernel+bootcmd+ramfs) and to run the kernel from that plf. Get it [here](https://gitlab.utc.fr/uav-hds/framework-uav/uav-dev/-/raw/main/bin/i686/unix/mykonos2_flash/bin/inst_usb_bootldr.bin?ref_type=heads)
* Add an udev rule for the USB connection with the adrone2 (or do the USB operations as root):
The ardrone2 installer allows to flash the updater and the production system.
Plug USB and serial (115200bps) cables, send the [ardrone2-installer](https://devel.hds.utc.fr/flair/ardrone2-installer/robomap3/core-image-minimal-mtdutils-ardrone2-installer.plf) with the following commands:
The ardrone2 will create a network interface over USB, connect to it with:
`$ ssh root@192.168.7.2`
create partitions for the custom firmware:
`# create_partitions.sh`
## install the updater
The updater will be used to update a production system.
Copy ardrone2-updater files ([zImage.plf](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/zImage.plf) and [core-image-minimal-mtdutils-ardrone2-updater.tar.gz](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz)) to the ardrone2:
Copy ardrone2 files ([zImage.plf](https://devel.hds.utc.fr/flair/ardrone2/robomap3/zImage.plf) and [core-image-flair-ardrone2.tar.bz2](https://devel.hds.utc.fr/flair/ardrone2/robomap3/core-image-flair-ardrone2.tar.bz2)) to the ardrone2:
`$ scp zImage.plf root@192.168.7.2:`
(be careful this is the same kernel file name for installer and production, but files are different!)
Boot the original ardrone2 system and connect to it:
* ssid ardrone2_011152 (last 6 numbers depends on ardrone2's serial number)
* ip pc : 192.168.1.2 (given by uav's dhcp)
* ip uav : 192.168.1.1
We are going to flash the updater in the mtd2 partition from original system. Then we reboot to the updater and flash the final system in the mtd3 partition.
Copy with ftp the ardrone2-installer.tar.gz, in */data/video/installer* then uncompress it:
`$ telnet 192.168.1.1`
`# cd /data/video/installer`
`# tar -xzf core-image-minimal-mtdutils-ardrone2-installer.tar.gz `
Create a chroot script and execute it:
```
umount /factory
mount -o bind /dev /data/video/installer/dev/
mount -t sysfs sys /data/video/installer/sys/
mount -t proc proc /data/video/installer/proc/
mount devpts /data/video/installer/dev/pts -t devpts
chroot /data/video/installer /bin/sh
```
Copy with ftp the [ardrone2-updater.tar.gz](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz) and its [kernel](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/zImage.plf) to */data/video/installer* then install it from the chroot:
`bitbake core-image-minimal-mtdutils`: for ardrone2-installer machine
`bitbake core-image-minimal-mtdutils`: for ardrone2-updater machine
# Definitions
***original ardrone2**: UAV with stock firmware
***modified ardrone2**: UAV with modified kernel and rootfs
***plf** : Parrot's proprietary format to pack datas (rootfs, kernel, kernel command line, etc). This format has been more and less reverse engineered. Tools exist to read/write plf files (they are included in robomap3)
***ardrone2**: machine (poky definition) in robomap3; the production rootfs, we fly with it; it installs in the flash (mtd3 for rootfs, mtd1 "main_boot" for kernel)
***ardrone2-updater**: machine (poky definition) in robomap3; allows flashing the production rootfs; it installs in the flash (mtd2 for rootfs, mtd1 "alt_boot" for kernel)
***ardrone2-installer**: machine (poky definition) in robomap3; allows to entirely flash the system (production or updater); it is a ramfs
We do not have source code of this proprietary program. There is no open source alternative for the moment.
It could be replaced by xloader (TI) and u-boot.
By default, the bootloader loads the plf kernel from the *main_boot* partition of mtd1. To load another kernel (from the other mtd1 partition, *alt_boot*), labels of these partitions must firstly be swapped:
`# ubiattach -p /dev/mtd1` (note the ubi partition number)
`# ubirename /dev/ubix main_boot alt_boot alt_boot main_boot` (replace x by the partition number)
`# ubidetach -p /dev/mtd1`
Note that a script called *launch_update.sh* is provided in the rootfs in order to do this swap (see [update a modified adrone2 rootfs](#update-a-modified-ardrone2-rootfs)).
If the adrone2 is USB plugged to a computer, the bootloader can load and run another bootloader (see [flash an original ardrone2 with USB cable](#flash-an-original-ardrone-2-with-usb-cable)).
# Prerequisite for flashing with a USB cable
* Install a serial port communications program: cutecom, minicom, etc
* Install the x86_64 [toolchain](install-toolchains).
**inst_usb_bootldr.bin*: Parrot proprietary bootloader, loads from USB. It allows to load from USB a plf file (kernel+bootcmd+ramfs) and to run the kernel from that plf. Get it [here](https://gitlab.utc.fr/uav-hds/framework-uav/uav-dev/-/raw/main/bin/i686/unix/mykonos2_flash/bin/inst_usb_bootldr.bin?ref_type=heads)
* Add an udev rule for the USB connection with the adrone2 (or do the USB operations as root):
The ardrone2 installer allows to flash the updater and the production system.
Plug USB and serial (115200bps) cables, send the [ardrone2-installer](https://devel.hds.utc.fr/flair/ardrone2-installer/robomap3/core-image-minimal-mtdutils-ardrone2-installer.plf) with the following commands:
The ardrone2 will create a network interface over USB, connect to it with:
`$ ssh root@192.168.7.2`
create partitions for the custom firmware:
`# create_partitions.sh` (**NB**: on an already modified ardrone2; this is not necessary nor advisable)
## install the updater
The updater will be used to update a production system.
Copy ardrone2-updater files ([zImage.plf](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/zImage.plf) and [core-image-minimal-mtdutils-ardrone2-updater.tar.gz](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz)) to the ardrone2:
Copy ardrone2 files ([zImage.plf](https://devel.hds.utc.fr/flair/ardrone2/robomap3/zImage.plf) and [core-image-flair-ardrone2.tar.bz2](https://devel.hds.utc.fr/flair/ardrone2/robomap3/core-image-flair-ardrone2.tar.bz2)) to the ardrone2:
`$ scp zImage.plf root@192.168.7.2:`
(be careful this is the same kernel file name for installer and production, but files are different!)
Boot the original ardrone2 system and connect to it:
* ssid ardrone2_011152 (last 6 numbers depends on ardrone2's serial number)
* ip pc : 192.168.1.2 (given by uav's dhcp)
* ip uav : 192.168.1.1
We are going to flash the updater in the mtd2 partition from original system. Then we reboot to the updater and flash the final system in the mtd3 partition.
Copy with ftp the ardrone2-installer.tar.gz, in */data/video/installer* then uncompress it:
`$ telnet 192.168.1.1`
`# cd /data/video/installer`
`# tar -xzf core-image-minimal-mtdutils-ardrone2-installer.tar.gz `
Create a chroot script and execute it:
```
umount /factory
mount -o bind /dev /data/video/installer/dev/
mount -t sysfs sys /data/video/installer/sys/
mount -t proc proc /data/video/installer/proc/
mount devpts /data/video/installer/dev/pts -t devpts
chroot /data/video/installer /bin/sh
```
Copy with ftp the [ardrone2-updater.tar.gz](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz) and its [kernel](https://devel.hds.utc.fr/flair/ardrone2-updater/robomap3/zImage.plf) to */data/video/installer* then install it from the chroot: