U-bootの処理は個別の設定を忘れたり、間違ったアドレスに書いて、bootをつぶしてしまわないように、処理をsetenv,saveenvで保存しておいて、runするようにしています。
ところがOnion OmegaなどU-bootにsaveenvがない環境があります。
また初期のU-bootにはrunコマンドがありませんでした。
このようなターゲットでは毎回コピペして処理していたのですが、RLoginのスクリプトを使う方法を思いつきました。
sputs("setenv ipaddr 192.168.0.100;setenv serverip 192.168.0.50;tftpboot 0x80020000 Onion_Omega.bin\r");
swait(30, "Omega>");
sputs("erase 0x9f020000 0x9f7fffff;cp.b 0x80020000 0x9f020000 $filesize;reset\r");
便利です。
メニューに登録したりショートカットにする方法はこちらを参考にしました。
Linuxがすぐに起動してしまい、止めるタイミングが難しい場合には以下のスクリプトが有効です。
function uboot() {
// u-boot boot command select script
dlg = dialog("Please choose the operation:", [ 0,0,360,180 ],
[
[ "radiotop", [ 30,10,300,20 ], "1: Load system code to SDRAM via TFTP." ],
[ "radio", [ 30,30,300,20 ], "2: Load system code then write to Flash via TFT." ],
[ "radio", [ 30,50,300,20 ], "3: Boot system code via Flash (default)." ],
[ "radio", [ 30,70,300,20 ], "4: Entr boot command line interface." ],
[ "button", [ 130,120,100,20 ], "OK", 0, "OnClickOk" ],
]
);
// get id by add because of id use after
chkid = dlg.add("check", [ 150,95,300,20 ], "reboot");
dlg.open();
dlg.center();
dlg.show(1);
dlg.wait();
}
function OnClickOk ( id ) {
if ( (n = dlg.getradio(0)) >= 0 ) {
if (dlg.getcheck(chkid) == 1) {
sputs("reboot\r");
}
swait(600, "Please choose the operation:");
sputs(substr(dlg.gettext(n), 0 , 1));
}
dlg.close();
}
menu(0, "uboot", "uboot");