0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

RLoginでU-bootのオペレーション

Last updated at Posted at 2021-11-14

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");

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?