***modified ardrone2**: UAV with modified kernel and rootfs
***plf** : Parrot's proprietary format to pack datas (rootfs, kernel, kernel command line, etc). This format hab 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://devel.hds.utc.fr/svn/uav_dev/trunk/bin/i686/unix/mykonos2_flash/bin/inst_usb_bootldr.bin)
* Add an udev rule for the USB connection with the adrone2 (or do the USB operations as root):
Plug USB and serial (115200bps) cables, send the [ardrone2-installer](https://uav.hds.utc.fr/src/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`
créer les partitions pour recevoir le système hds :
`# create_partitions.sh`
copier les éléments de ardrone2-updater ([https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/zImage.plf zImage.plf] et [https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz core-image-minimal-mtdutils-ardrone2-updater.tar.gz]) sur le drone
flasher le updater :
{{{
# update_kernel.sh zImage.plf (doit afficher found an updater kernel)
copier les éléments de ardrone2 ([https://uav.hds.utc.fr/src/ardrone2/robomap3/zImage.plf zImage.plf] et [https://uav.hds.utc.fr/src/ardrone2/robomap3/core-image-flair-ardrone2.tar.bz2 core-image-flair-ardrone2.tar.bz2]) sur le drone
flasher le système :
{{{
# update_kernel.sh zImage.plf (doit afficher found a production kernel)
__TODO__: retester car dernière tentive a brické le drone
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:
{{{
# 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.plf and its kernel, in /data/video/installer then install it from the chroot:
ssid ardrone2_011152 (les 6 derniers chiffres dépendent du numéro de série, voir sur l’étiquette du drone)
ip pc : 192.168.1.2 (donné par le dhcp du drone)
ip drone : 192.168.1.1
On ne peut pas flasher d’un coup le système final hds. On commence par mettre le ardrone-updater ; puis on bootera sur celui la pour installer le reste.
Copier par ftp les scripts de flashage (dans ''robomap3-rt/meta-poky/recipes-hds/ardrone-tools/ardrone2-flash-scripts'') et les outils mtd/ubi (ubiattach, ubidetach, etc). Sur le drone, les fichiers envoyés en ftp sont dans /data/video par défaut. Mettre tout ca dans /usr/bin.
copier les éléments de ardrone2-updater ([https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/zImage.plf zImage.plf] et [https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz core-image-minimal-mtdutils-ardrone2-updater.tar.gz]) sur le drone par ftp. Flasher le noyau et le rootfs de ardrone2-updater