Update ardrone2 authored by Guillaume Sanahuja's avatar Guillaume Sanahuja
...@@ -88,6 +88,10 @@ replace *youruser* by your user name. ...@@ -88,6 +88,10 @@ replace *youruser* by your user name.
# Flash an original ardrone2 with usb cable # Flash an original ardrone2 with usb cable
## boot to the ardrone2 installer
The ardrone2 installer allows to flash the updater and the production system.
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: 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:
`$ source /opt/robomap3/2.1.3/armv7a-neon/environment-setup-armv7a-neon-poky-linux-gnueabi` `$ source /opt/robomap3/2.1.3/armv7a-neon/environment-setup-armv7a-neon-poky-linux-gnueabi`
...@@ -121,121 +125,114 @@ The ardrone2 will create a network interface over USB, connect to it with: ...@@ -121,121 +125,114 @@ The ardrone2 will create a network interface over USB, connect to it with:
`$ ssh root@192.168.7.2` `$ ssh root@192.168.7.2`
créer les partitions pour recevoir le système hds : create partitions for the custom firmware:
`# create_partitions.sh` `# 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 ## install the updater
The updater will be used to update a production system.
Copy ardrone2-updater files ([zImage.plf](https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/zImage.plf) and [core-image-minimal-mtdutils-ardrone2-updater.tar.gz](https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz)) to the ardrone2:
`$ scp zImage.plf root@192.168.7.2:`
`$ scp core-image-minimal-mtdutils-ardrone2-updater.tar.gz root@192.168.7.2:`
flash the updater:
`# update_kernel.sh zImage.plf` (must write *found an updater kernel*)
`# install_updater_rootfs.sh core-image-minimal-mtdutils-ardrone2-updater.tar.gz`
remove temporary files:
`# rm zImage.plf core-image-minimal-mtdutils-ardrone2-updater.tar.gz`
## install the production
flasher le updater : Copy ardrone2 files ([zImage.plf](https://uav.hds.utc.fr/src/ardrone2/robomap3/zImage.plf) and [core-image-flair-ardrone2.tar.bz2](https://uav.hds.utc.fr/src/ardrone2/robomap3/core-image-flair-ardrone2.tar.bz2)) to the ardrone2:
{{{
# update_kernel.sh zImage.plf (doit afficher found an updater kernel)
# install_updater_rootfs.sh core-image-minimal-mtdutils-ardrone2-updater.tar.gz
}}}
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 `$ scp zImage.plf root@192.168.7.2:`
`$ scp core-image-flair-ardrone2.tar.bz2 root@192.168.7.2:`
flash the system:
`# update_kernel.sh zImage.plf` (must write *found a production kernel*)
`# flash_rootfs.sh core-image-flair-ardrone2.tar.bz2 `(chose option 1: production)
flasher le système :
{{{
# update_kernel.sh zImage.plf (doit afficher found a production kernel)
# flash_rootfs.sh core-image-flair-ardrone2.tar.bz2 (choisir l’option 1 : production)
}}}
reboot ! reboot !
# Flash original ardrone2 without USB cable # Flash original ardrone2 without USB cable
__TODO__: retester car dernière tentive a brické le drone This procedure has not been heavily tested.
Boot the original ardrone2 system and connect to it: Boot the original ardrone2 system and connect to it:
ssid ardrone2_011152 (last 6 numbers depends on ardrone2's serial number) * ssid ardrone2_011152 (last 6 numbers depends on ardrone2's serial number)
ip pc : 192.168.1.2 (given by uav's dhcp) * ip pc : 192.168.1.2 (given by uav's dhcp)
ip uav : 192.168.1.1 * 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. 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: Copy with ftp the ardrone2-installer.tar.gz, in */data/video/installer* then uncompress it:
{{{
# cd /data/video/installer `$ telnet 192.168.1.1`
# tar -xzf core-image-minimal-mtdutils-ardrone2-installer.tar.gz
}}} `# cd /data/video/installer`
`# tar -xzf core-image-minimal-mtdutils-ardrone2-installer.tar.gz `
Create a chroot script and execute it: Create a chroot script and execute it:
{{{ ```
umount /factory umount /factory
mount -o bind /dev /data/video/installer/dev/ mount -o bind /dev /data/video/installer/dev/
mount -t sysfs sys /data/video/installer/sys/ mount -t sysfs sys /data/video/installer/sys/
mount -t proc proc /data/video/installer/proc/ mount -t proc proc /data/video/installer/proc/
mount devpts /data/video/installer/dev/pts -t devpts mount devpts /data/video/installer/dev/pts -t devpts
chroot /data/video/installer /bin/sh 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: Copy with ftp the [ardrone2-updater.tar.gz](https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/core-image-minimal-mtdutils-ardrone2-updater.tar.gz) and its [kernel](https://uav.hds.utc.fr/src/ardrone2-updater/robomap3/zImage.plf) to */data/video/installer* then install it from the chroot:
{{{ `# update_kernel.sh zImage.plf`
# update_kernel.sh zImage.plf
# install_updater_rootfs.sh core-image-minimal-mtdutils-ardrone2-updater.tar.gz `# install_updater_rootfs.sh core-image-minimal-mtdutils-ardrone2-updater.tar.gz`
}}}
Change ubi names to reboot to updater: Change ubi names to reboot to updater:
{{{
# ubiattach -p /dev/mtd1 `# ubiattach -p /dev/mtd1` (note the ubi partition number)
# ubirename /dev/ubix main_boot alt_boot alt_boot main_boot (x donné par ubittach)
# ubidetach -p /dev/mtd1 `# ubirename /dev/ubix main_boot alt_boot alt_boot main_boot` (replace x by the partition number)
# reboot
}}} `# ubidetach -p /dev/mtd1`
# Flasher ardrone2 original sans câble USB `# reboot`
TODO : scripter un peu plus tout ça ! The ardrone2 will reboot to the updater, then:
se connecter en wifi au drone : `# create_partitions.sh`
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) `# flash_rootfs core-image-flair-uav-ardrone.tar.bz2`
ip drone : 192.168.1.1
`# swap kernel ubi labels`
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.
`# flash_kernel.sh zImage.plf`
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.
# Update a modified ardrone2 kernel
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
{{{ `# flash_kernel.sh zImage.plf`
# update_kernel.sh zImage.plf
# install_updater_rootfs.sh core-image-minimal-mtdutils-ardrone2-updater.tar.gz
}}}
rebooter sur le système ardrone2-updater
{{{
# ubiattach -p /dev/mtd1
# ubirename /dev/ubix main_boot alt_boot alt_boot main_boot (x donné par ubittach)
# ubidetach -p /dev/mtd1
# reboot
}}}
une fois sur le ardrone2-updater : (en port série car procédure à automatiser)
{{{
# create_partitions.sh
# flash_rootfs core-image-flair-uav-ardrone.tar.bz2
# swap kernel ubi labels
# flash_kernel.sh zImage.plf
}}}
# Mettre à jour le noyau sur adrones2 hds
{{{
# flash_kernel.sh zImage.plf
}}}
# Update a modified ardrone2 rootfs # Update a modified ardrone2 rootfs
# Tester un noyau sans le flasher (avec câble USB) # Run a kernel without flashing it (with USB cable)
Procédure identique au flash avec câble usb. On créé ici le plf avec noyau+rootfs à mettre en ram We need to create a plf file with a kernel, the kernel command line and a rootfs (initrd), which will be run from ram.
faire un fichier image.ini (adapter le chemin des 3 fichiers, le !EntryPoint et le !LoadAddr du zImage) : Create an image.ini file (change the path to the 3 files, change the EntryPoint and the LoadAddr of zImage) :
{{{ ```
[file] [file]
Type=kernel Type=kernel
EntryPoint=0x81588004 EntryPoint=0x81588004
...@@ -250,32 +247,33 @@ LanguageZone=0 ...@@ -250,32 +247,33 @@ LanguageZone=0
[zImage] [zImage]
LoadAddr=0x81588004 LoadAddr=0x81588004
File=/home/gsanahuj/HDS/igep/ardrone2_src/linux-ardrone2-2.6.32-9/arch/arm/boot/zImage File=path to zImage
[InitRD] [InitRD]
LoadAddr=0x81000000 LoadAddr=0x81000000
File=/home/poky/poky-robomap3/build/tmp/deploy/images/ardrone2-installer/core-image-minimal-mtdutils-ardrone2-installer.cpio File=path to core-image-minimal-mtdutils-ardrone2-installer.cpio
[BootParams] [BootParams]
LoadAddr=0x80700000 LoadAddr=0x80700000
File=/home/gsanahuj/HDS/igep/ardrone2_src_svn/trunk/linux-ardrone2-2.6.32-9/bootparams.txt File=path to bootparams.txt
}}} ```
créer un plf avec le noyau et le rootfs : Create the plf file:
{{{
# /opt/robomap3/2.1.3/armv7a-neon/sysroots/x86_64-pokysdk-linux/usr/bin/plftool -b ./image.ini -o ./image.plf `# /opt/robomap3/2.1.3/armv7a-neon/sysroots/x86_64-pokysdk-linux/usr/bin/plftool -b ./image.ini -o ./image.plf`
}}}
brancher le câble USB et le série (115200bps), envoyer le ardrone2-installer : Plug USB and serial (115200bps) cables, send the plf file with the following commands:
`# source /opt/robomap3/2.1.3/armv7a-neon/environment-setup-armv7a-neon-poky-linux-gnueabi`
`# ardrone2-usbload inst_usb_bootldr.bin image.plf`
power up the ardrone2 to send and run the kernel.
{{{ # Flash a bricked ardrone2 (with a USB cable)
# source /opt/robomap3/2.1.3/armv7a-neon/environment-setup-armv7a-neon-poky-linux-gnueabi
# ardrone2-usbload inst_usb_bootldr.bin image.plf
}}}
une fois le programme en attente, allumer le drone
# Flasher ardrone2 briqué (avec câble USB) Follow the steps from flashing an orignal ardrone2 with USB cable.
suivre la procédure ardrone2 original avec câble USB. Send the ardrone2-installer through USB, then flash necessary files to unbrick the ardrone2 (kernel for example).
Envoyer le ardrone2-installer par USB, puis flasher le nécessaire pour dé-briquer (normalement le noyau).
# Compiling everything from scratch # Compiling everything from scratch
...@@ -283,8 +281,8 @@ If you want to compile all by yourself: ...@@ -283,8 +281,8 @@ If you want to compile all by yourself:
robomap3 : https://sourcesup.renater.fr/projects/robomap3-rt/ robomap3 : https://sourcesup.renater.fr/projects/robomap3-rt/
''bitbake core-image-minimal-mtdutils'' pour la machine ardrone2-installer (se lance en ram depuis l’usb) `bitbake core-image-minimal-mtdutils`: for ardrone2-installer machine
''bitbake core-image-minimal-mtdutils'' pour la machine ardrone2-updater (se met en flash) `bitbake core-image-minimal-mtdutils`: for ardrone2-updater machine
''bitbake core-image-flair-uav'' pour la machine ardrone2 (se met en flash) `bitbake core-image-flair-uav`: for ardrone2 machine
\ No newline at end of file \ No newline at end of file