Uboot-envedit
Vous pouvez modifier le menu de boot du FreeRunner. Voilà comment.
Sommaire |
Comment ça Marche ?
Initial
Tout d'abord, il faut récupérer (uploader) l'environnement de boot initial :
sudo dfu-util -a u-boot_env -U env.u-boot
Le fichier env.u-boot étant un fichier binaire, vous ne pouvez pas le modifier directement avec un editeur binaire. Vous devez donc passer par un utilitaire uboot-envedit Il vous faut donc d'abord récupérer uboot-envedit. Il fait partie du package fso-utils. Donc :
apt-get install fso-utils
Ou l'équivalent.
Modification de l'environnement
Ensuite, il faut modifier l'environnement de boot initial dans un fichier:
uboot-envedit -i env.u-boot -f env_modified.u-boot.txt -o env_modified.u-boot
avec env_modified.u-boot.txt un fichier tel que celui ci dessous (Cf résultat de la commande uboot-envedit -i env_modified.u-boot -p >env_modified.u-boot.txt ) : en gros, vous convertissez votre fichier actuel en texte, vous le modifiez, et vous le donnez en entrée à uboot-envedit
$ uboot-envedit -i env_modified.u-boot -p
boot_1=setenv bootargs ${bootargs_base} ${mtdparts}; nand read.e 0x32000000 kernel 0x200000; bootm 0x32000000
boot_2=setenv bootargs ${bootargs_base} rootfstype=ext3 root=/dev/mmcblk0p2 rootdelay=5 ${mtdparts} ; mmcinit; fatload mmc 1 0x32000000 ${sd_image_name}; bootm 0x32000000
boot_3=setenv bootargs ${bootargs_base} rootfstype=ext3 root=/dev/mmcblk0p3 rootdelay=5 ${mtdparts} ; mmcinit; fatload mmc 1 0x32000000 ${sd_image_name}; bootm 0x32000000
boot_4=setenv bootargs ${bootargs_base} rootfstype=ext3 root=/dev/mmcblk0p5 rootdelay=5 ${mtdparts} ; mmcinit; fatload mmc 1 0x32000000 ${sd_image_name}; bootm 0x32000000
boot_5=setenv bootargs ${bootargs_base} rootfstype=ext3 root=/dev/mmcblk0p6 rootdelay=5 ${mtdparts} ; mmcinit; fatload mmc 1 0x32000000 ${sd_image_name}; bootm 0x32000000
boot_menu_timeout=300
bootargs_base=rootfstype=jffs2 root=/dev/mtdblock6 console=ttySAC2,115200 console=tty0 loglevel=8 regular_boot
bootcmd=run boot_${default}
bootdelay=1
default=1
menu_1=Prompt menu 1 flash interne: run boot_1
menu_2=Prompt menu 2 SDCard partition 2: run boot_2
menu_3=Prompt menu 3 SDCard partition 3: run boot_3
menu_4=Prompt menu 4 SDCard partition 5: run boot_4
menu_5=Prompt menu 5 SDCard partition 6: run boot_5
menu_6=Reboot: reset
menu_8=Power off: neo1973 power-off
mtddevname=nor
mtddevnum=0
mtdids=nor0=physmap-flash,nand0=neo1973-nand
mtdparts=mtdparts=physmap-flash:-(nor);neo1973-nand:0x00040000(u-boot),0x00040000(u-boot_env),0x00800000(kernel),0x000a0000(splash),0x00040000(factory),0x0f6a0000(rootfs) partition=nor0,0
pcb_rev=0x001
pcf50633_int1=0x80
pcf50633_int2=0xaa
quiet=1
sd_image_name=uImage.bin
splashimage=nand read.e 0x32000000 splash 0x5000; unzip 0x32000000 0x8800000 0x96000
stderr=usbtty
stdin=usbtty
stdout=usbtty
usbtty=cdc_acm
Cette configuration correspond à une SDCard de 4Go partitionnée ainsi : fdisk /dev/mmcblk0 p
Device Boot Start End Blocks Id System /dev/mmcblk0p1 1 245 7832 4 FAT16 <32M ==> boot (8Mo) /dev/mmcblk0p2 246 31496 1000032 83 Linux ==> debian (1Go) /dev/mmcblk0p3 31497 47122 500032 83 Linux ==> QtExtended (400Mo) /dev/mmcblk0p4 47123 120960 2362816 5 Extended /dev/mmcblk0p5 47123 83744 1171896 83 Linux ==> Hackable1 1.2Go /dev/mmcblk0p6 83745 117314 1074232 83 Linux ==> à venir : SHR (1.1Go) /dev/mmcblk0p7 117315 120960 116664 83 Linux ==> data (le reste!)
Mais ceci n'est qu'un exemple!
Charger nos modifications
Pour downloader la config de boot dans le FreeRunner :
sudo dfu-util -a u-boot_env -D env_modified.u-boot
Pour booter sur cette configuration de boot, je boot en faisant : Power + 2s + AUX
En faisant AUX + Power, je tombe sur le menu de boot par défaut.
Et si ça marche plus ??
1ère possibilité
Si cela se passe mal, voici l'environnement uBoot original (penser à suprimer le .txt à la fin). Et flasher comme ceci :
dfu-util -a u-boot_env -D original-u-boot_env.bin
2nde possibilité
Sinon, en console récupérer le binaire original :
wget http://www.tsleg.com/upload/data/original-u-boot_env.bin
Puis le charger dans le FR
dfu-util -a u-boot_env -D original-u-boot_env.bin