====== ブートローダの環境変数ファイルを、Linuxから編集する ====== [[mae3xx_ope:bootloader_operation:start]] で設定を編集・保存した内容を、Linux で編集・保存することが可能です。\\ bareboxenv というコマンドを用意してあります。 コマンド書式は下記のとおりです。 user1@plum:~$ sudo bareboxenv Usage : bareboxenv [OPTION] DIRECTORY FILE Load a barebox environment sector into a directory or save a directory into a barebox environment sector options: -s save (directory -> environment sector) -l load (environment sector -> directory) -p pad output file to given size -v verbose user1@plum:~$ \\ ===== 準備 ===== mtd 領域に保存してある内容を対象としますので、ブートローダで "saveenv" コマンドにより保存済みである必要があります。 Hit m for menu or any other key to stop autoboot: 2 type exit to get to the menu barebox@plum-ma[512MiB]:/ saveenv saving environment barebox@plum-ma[512MiB]:/ \\ この後、Linux を起動します。 barebox@plum-ma[512MiB]:/ boot \\ ===== mtd 領域からの読み込み ===== 保存されている内容を、ディレクトリへ展開します。\\ ブートローダの env 領域 /dev/mtd14 から読み込みます。 user1@plum:~$ sudo bareboxenv -l /tmp/bareboxenv /dev/mtd14 \\ この例では、/tmp/bareboxenv/ 以下に展開されます。 user1@plum:~$ ls -l /tmp/bareboxenv/ total 8 drwxr-xr-x 2 root root 180 Aug 25 19:07 bin drwxr-xr-x 2 root root 140 Aug 25 19:07 boot -rw-r--r-- 1 root root 1062 Aug 25 19:07 config -rw-r--r-- 1 root root 261 Aug 25 19:07 config-board drwxr-xr-x 2 root root 80 Aug 25 19:07 data drwxr-xr-x 2 root root 160 Aug 25 19:07 init drwxr-xr-x 2 root root 240 Aug 25 19:07 menu drwxr-xr-x 2 root root 60 Aug 25 19:07 network user1@plum:~$ \\ あとは、各種設定ファイルをエディタで編集・保存します。 user1@plum:~$ sudo nano -w /tmp/bareboxenv/config GNU nano 2.2.6 File: /tmp/bareboxenv/config #!/bin/sh # change network settings in /env/network/eth0 # change mtd partition settings and automountpoints in /env/init/* #global.hostname= # set to false if you do not want to have colors #global.allow_color=true # user (used for network filenames) #global.user=none # timeout in seconds before the default boot entry is started global.autoboot_timeout=2 # list of boot entries. These are executed in order until one # succeeds. An entry can be: # - a filename in /env/boot/ # - a full path to a directory. All files in this directory are # treated as boot files and executed in alphabetical order #global.boot.default=net # base bootargs #global.linux.bootargs.base="ubi.mtd=0 mtdoops.mtddev=OOPS mtdoops.record_size=8192 zswap.enabled=1" # don't format MTD automatically #manual_mtd=1 [ Read 43 lines ] ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell \\ ===== mtd 領域への保存 ===== 編集が完了したら、bareboxenv コマンドで mtd 領域へ保存します。 user1@plum:~$ sudo bareboxenv -v -s /tmp/bareboxenv /dev/mtd14 saving contents of /tmp/bareboxenv to file /dev/mtd14 user1@plum:~$