昔の Linux ボードの OS を更新する(Edison 編)
Linux つながりで、昔買って積みボードと化している Intel Edison の FW を更新してみたいと思います。
現状
ぶっちゃけほぼ初期状態です。 u-boot
U-Boot 2014.04 (Jun 06 2016 - 14:40:07)
Watchdog enabled
DRAM: 980.6 MiB
MMC: tangier_sdhci: 0
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
カーネル
Poky (Yocto Project Reference Distro) 1.7.3 edison ttyMFD2
edison login: root
root@edison:~# uname -a
Linux edison 3.10.98-poky-edison+ #1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016 i686 GNU/Linux
イメージの Build
Intel Edison Image Builder を参考にします。
Build 環境に Ubuntu 22.04 (か 23.10)が必要なようなので、環境を用意します。 なお、ディスクの空き容量が 80GB 近く必要です。
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python2 python3 libsdl1.2-dev xterm
$ sudo apt-get install p7zip-full btrfs-progs lz4
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
$ sudo update-alternatives --config python
[ 1 を選んで python2 をデフォルトにする]
git で build に必要なファイルを取得します。
$ mkdir my_Edison_Workspace
$ cd my_Edison_Workspace
$ git clone https://github.com/edison-fw/meta-intel-edison.git
$ ln -s meta-intel-edison/utils/Makefile.mk Makefile
$ cd meta-intel-edison
$ git checkout master
$ cd ..
$ make setup
Build する
$ cd out/linux64
$ source poky/oe-init-build-env
$ bitbake -k edison-image
かなり待ちます…。 私の環境では一晩かかりました。
$ cd ../..
$ make image
またちょっと待ちます。(1時間くらい?) フラッシュ書き込み用のイメージを作ります。
$ make postbuild
書き込み
out/current/build/toFlash
にファイル一式があるので、書き込みツールで書き込みます。
dfu-utilをダウンロードして、インストールしておきます。
あとは root
で flashall.sh
を実行するだけです。
# ./flashall.sh
Using U-Boot target: edison-blankcdc
Now waiting for dfu device 8087:0a99
Please plug and reboot the board
Flashing IFWI
Download [=========================] 100% 4194304 bytes
Download [=========================] 100% 4194304 bytes
Flashing U-Boot
Download [=========================] 100% 692224 bytes
Flashing U-Boot Environment
DFU mode device DFU version 0110
Flashing U-Boot Environment Backup
Download [=========================] 100% 65536 bytes
Rebooting to apply partition changes
Now waiting for dfu device 8087:0a99
Flashing boot partition (kernel)
Download [=========================] 100% 27982848 bytes
Flashing rootfs, (it can take up to 5 minutes... Please be patient)
Download [=========================] 100% 1073741824 bytes
Rebooting
U-boot & Kernel System Flash Success...
Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes.
#
ほとぼりが冷めたら再起動します。 なお、Windows の Platform Flash Tool Lite でも書き込みできるはずのですが、私の環境では書き込みできませんでした。
U-Boot 2023.10 (Oct 02 2023 - 14:39:59 +0000)
CPU: Genuine Intel(R) CPU 4000 @ 500MHz
DRAM: 980.6 MiB
Core: 25 devices, 16 uclasses, devicetree: separate
WDT: Started wdt@0 with servicing every 1000ms (60s timeout)
MMC: mmc@ff3fc000: 0, mmc@ff3fa000: 1
Loading Environment from MMC... OK
In: No input devices available!
Out: No output devices available!
Err: No error devices available!
Net: No ethernet found.
Hit any key to stop autoboot: 0
Target:blank
Partitioning already done...
Flashing already done...
10813280 bytes read in 465 ms (22.2 MiB/s)
15925832 bytes read in 682 ms (22.3 MiB/s)
Valid Boot Flag
Magic signature found
Linux kernel version 6.1.55-edison-acpi-standard (oe-user@oe-host) #1 SMP PREEMPT_DYNAMIC Sat Sep 23 09:11:13 UTC 2023
Building boot_params at 0x00090000
Loading bzImage at address 100000 (10797920 bytes)
Initial RAM disk at linear address 0x06000000, size 25165824 bytes
Kernel command line: "quiet root=/dev/mmcblk0p8 rootfstype=ext4 console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8,keep loglevel=4 systemd.unit=multi-user.target"
Kernel loaded at 00100000, setup_base=00090000
Starting kernel ...
[ 1.769087] fail to initialize ptp_kvm
[ 4.056457] Initramfs unpacking failed: invalid magic at start of compressed archive
Scanning for Btrfs filesystems
Starting version 250.5+
Kernel with acpi enabled detected
Loading acpi tables
[ 5.123400] pca953x i2c-INT3491:00: failed writing register
[ 5.203015] pca953x i2c-INT3491:01: failed writing register
[ 5.242468] pca953x i2c-INT3491:02: failed writing register
[ 5.289060] pca953x i2c-INT3491:03: failed writing register
gpioset: cannot find line 'TRI_STATE_ALL'
[ 5.653157] pca953x i2c-INT3491:00: failed writing register
[ 5.666019] pca953x i2c-INT3491:01: failed writing register
[ 5.678761] pca953x i2c-INT3491:02: failed writing register
[ 5.695460] pca953x i2c-INT3491:03: failed writing register
gpioset: cannot find line 'TRI_STATE_ALL'
Waiting for root device /dev/mmcblk0p8
[ 7.015776] ext3: Unknown parameter 'umask'
[ 7.020222] ext2: Unknown parameter 'umask'
[ 7.024652] ext4: Unknown parameter 'umask'
Found device '/run/media/rootfs-mmcblk0p8'
Init found, booting...
mount: can't find /boot in /etc/fstab
mount: mounting /boot on /realroot/boot failed: Invalid argument
mount: can't find /lib/modules in /etc/fstab
mount: mounting /lib/modules on /realroot/lib/modules failed: Invalid argument
[ 12.177451] systemd[1]: Failed to start Set timezone by geolocation service.
[FAILED] Failed to start Set timezone by geolocation service.
[ 14.516671] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43340-sdio for chip BCM43340/2
[ 14.876138] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 14.888819] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43340/2 wl0: Apr 23 2021 05:48:34 version 6.10.190.91 (r728536) FWID 01-d45e96c4
ありゃ?ダメか?
[ 430.751960] sh[564]: 0
[ 430.937211] sh[651]: Enabled wifi
[ 431.023786] sh[654]: Error enabling wifi tethering: Not supported
[ 431.032856] sh[654]: Wifi SSID set
[ 431.037743] sh[654]: Wifi passphrase set
[ 431.057277] sh[564]: 0
[ 431.060836] sh[564]: Post install success
[ 432.421828] systemctl[660]: Removed /etc/systemd/system/basic.target.wants/post-install.service.
Poky (Yocto Project Reference Distro) 4.0.17 edison ttyS2
edison login: root
root@edison:~# uname -a
Linux edison 6.1.55-edison-acpi-standard #1 SMP PREEMPT_DYNAMIC Sat Sep 23 09:11:13 UTC 2023 i686 i686 i386 GNU/Linux
と思ったらプロンプト来ました。初回起動時になにか処理している模様です。 次回からは普通に起動しました。
というわけで、お疲れ様でした。