6
5

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 5 years have passed since last update.

[メモ] ASUS TinkerBoardでRaspbianイメージを起動 / RaspberryPiでも、TinkerBoardでも起動するイメージ作成

Last updated at Posted at 2017-08-09

TL;DR (For files of TinkerOS v2.0.8) Updated: Dec.27'2018

  • Environment 1: Tinkerboard, 2 x microSD(TinkerOS, Raspbian), USB SD cardreader

    • /dev/mmcblk0 = TinkerOS
    • /dev/sda = Raspbian (USB SD cardreader) and it is mounted under /media/linaro/{boot,rootfs}
  • Environment 2: Raspberry Pi, 1 x microSD

    • /dev/mmcblk0 = Raspbian

Operation

You should set RASPBIAN_DISK and RASPBIAN_DIR as your env.

#Env1: TinkerBoard + USB Card reader 
RASPBIAN_DISK=/dev/sda
RASPBIAN_DIR_BOOT=/media/linaro/boot
RASPBIAN_DIR_ROOTFS=/media/linaro/rootfs

#Env2: Raspberr Pi
#RASPBIAN_DISK=/dev/mmcblk0
#RASPBIAN_DIR_BOOT=/boot
#RASPBIAN_DIR_ROOTFS=/


mkdir ~/work
cd ~/work

#TINKEROS_VER=TinkerOS-20180321_v2.0.5
#TINKEROS_VER=TinkerOS-20180622_v2.0.7
TINKEROS_VER=TinkerOS-20181023_v2.0.8

wget https://github.com/mt08xx/files/raw/master/${TINKEROS_VER}_kernel_lib_idbloader.tbz
tar xf ./${TINKEROS_VER}_kernel_lib_idbloader.tbz 

sudo dd if=./tmp/${TINKEROS_VER}_idbloader.img  of=${RASPBIAN_DISK} seek=64 conv=notrunc

sudo cp -rvn ./boot/* ${RASPBIAN_DIR_BOOT}
sudo cp -rvn ./lib/* ${RASPBIAN_DIR_ROOTFS}/lib/

#sudo touch /media/linaro/boot/ssh
sudo poweroff


  • ASUS TinkerBoardで、Raspbianイメージを起動したところ。Terminalの文字見れるかな??

2017-08-09-060825_1920x1080_scrot.png

概要

  • Raspbianのイメージに、TinkerBoardのKernelとか、modulesとか、u-bootあたりをつっこめば動くんじゃ...
  • やってみたら、RaspberryPiでも、TinkerBoardでも起動するイメージになりました。
  • ラズパイに強く依存してるようなアプリケーション・ハードウェア関係は動きませんよね??
    • Minecraft とか、Wolfram とかは、NG
    • CSI Cameraとか、も動かない
  • うまく動いたものがあれば、コメントあたりで教えてください。

TL;DR for TinkerOS v2.0.5

(2017-11-24更新: 2017-09-07-raspbian-stretch に、TinkerOS v2.0.3-20170928のカーネル使用にて確認)

  1. 2017-09-07-raspbian-stretch.imgを焼く

  2. RPiにて起動して、軽く設定する(Wifiの設定とか)

  3. 以下実行

    らずぱいにて実行
    # Run on RaspberryPi
    # For TinkerOS v2.0.3 (20170928)
    
    TINKER_FILES_URL=https://github.com/mt08xx/files/raw/master
    TINKER_BOOT=TinkerOS-20170928_v2.0.3_boot.tbz 
    TINKER_ROOTLIB=TinkerOS-20170928_v2.0.3_rootfs-lib.tbz
    TINKER_UBOOT=TinkerOS-20170928_v2.0.3_idbloader.img
    
    wget ${TINKER_FILES_URL}/${TINKER_BOOT}    -O - | bzcat | sudo tar xf - -C /boot/
    wget ${TINKER_FILES_URL}/${TINKER_ROOTLIB} -O - | bzcat | sudo tar xf - -C /lib/
    wget ${TINKER_FILES_URL}/${TINKER_UBOOT}
    sudo dd if=./${TINKER_UBOOT} of=/dev/mmcblk0 seek=64 conv=notrunc
    rm -f ./${TINKER_UBOOT}
    
    # rootfs指定
    grep -q 'root=' /boot/extlinux/extlinux.conf || sudo sed -i -e 's@ rw @ root=/dev/mmcblk0p2 rw @'  /boot/extlinux/extlinux.conf
    
    # Enable UART (お好みで)
    #sudo sed -i -e 's/console=tty1/console=ttyS1,115200n8/' /boot/extlinux/extlinux.conf
    
    # シャットダウン
    sudo shutdown -h now
    
  4. SDカードを、TinkerBoardに差し替えて、起動する。

  5. Enjoy!


以下、当時の環境での作業.


環境

手順

  1. 下準備

    1. microSD、2枚にそれぞれイメージを焼く。 Etcherとかで。

      • (その1) 20170703-tinker-board-linaro-stretch-alip-v1.9.zip
      • (その2) 2017-07-05-raspbian-jessie.zip
    2. microSD(TinkerOS)をTinkerBoard本体のmicroSDスロットに挿す。

    3. microSD(Raspbian)をUSBカードリーダへいれて、TinkerBoardのUSBポートへ挿す。

    4. 電源を入れる。(microUSBのACアダプタを挿す)

    5. 起動したら、User: linaro , パスワード: linaro でログイン。

    6. ターミナルを開く
      左下のアイコンをクリックして、メニューを出したら、System Tools > LXTerminal

    7. USBカードリーダのmicroSDが、/dev/sdaとして認識されてて、/media/linaro/あたりに自動でマウントされてる、、ハズ。

      linaro@linaro-alip:~$ mount | grep dev/sda
      /dev/sda2 on /media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
      /dev/sda1 on /media/linaro/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
      linaro@linaro-alip:~$ 
      
  2. TinkerBoard関係のファイルなどをコピーする。

    1. /boot/ 以下のファイルを、/media/linaro/boot/
      sudo cp -rv /boot/* /media/linaro/boot/

    2. /lib/modules/4.4.16-00010-g0fce7eb-dirty/フォルダを、/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/
      sudo cp -rv /lib/modules/4.4.16-00010-g0fce7eb-dirty /media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/

    3. メモ:: ※ラズパイ上で...

      ラズパイ上で、ファイルをダウンロードして、解凍

wget https://github.com/mt08xx/files/raw/master/TinkerBoard-kernel_4.4.16-00010-g0fce7eb-dirty_TinkerOS1.9Beta.tbz
sudo tar xvf ./TinkerBoard-kernel_4.4.16-00010-g0fce7eb-dirty_TinkerOS1.9Beta.tbz -C /


3. u-boot関連
    先頭から64セクタ目(64*512 = 0x8000 バイト目)からなにやら書きこまないといけない。
    <font color='red'>!!! `dd`を使うので気をつける !!!</font>

	```bash:ubootを書き込む
# ファイルをダウンロード
wget https://github.com/mt08xx/files/raw/master/rk3288-uboot-image/idbloader.img
# ddで書き込む
sudo dd if=./idbloader.img of=/dev/sda seek=64 conv=notrunc
# シンク、5秒寝て、シャットダウン.
sync && sleep 5 && sudo shutdown -h now
  1. USBカードリーダのmicroSD(Raspbian)を、TinkerBoardに挿して、起動。

その他

  • Raspbianのイメージは、ラズパイで一度起動して、初期設定をさせたほうがいいかも。
    ↓は、マニュアルでやった。

    • パーティション拡張 (raspi-config から...)
    • sshのキー作成 (sudo dpkg-reconfigure openssh-server)
  • TinkerOS v1.9 (beta)
    2017-08-09-053341_1920x1080_scrot.png

  • ファイルコピー時のログ

linaro@linaro-alip:~$ sudo cp -rv /boot/* /media/linaro/boot/
'/boot/extlinux' -> '/media/linaro/boot/extlinux'
'/boot/extlinux/extlinux.conf' -> '/media/linaro/boot/extlinux/extlinux.conf'
'/boot/hw_intf.conf' -> '/media/linaro/boot/hw_intf.conf'
'/boot/rk3288-miniarm.dtb' -> '/media/linaro/boot/rk3288-miniarm.dtb'
'/boot/zImage' -> '/media/linaro/boot/zImage'
linaro@linaro-alip:~$ sudo cp -rv /lib/modules/4.4.16-00010-g0fce7eb-dirty /media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/
'/lib/modules/4.4.16-00010-g0fce7eb-dirty' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/source' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/source'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/build' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/build'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.order' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.order'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.builtin' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.builtin'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.dep' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.dep'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.dep.bin' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.dep.bin'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.alias' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.alias'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.alias.bin' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.alias.bin'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.softdep' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.softdep'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.symbols' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.symbols'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.symbols.bin' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.symbols.bin'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.builtin.bin' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.builtin.bin'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.devname' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/modules.devname'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/crypto' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/crypto'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/crypto/echainiv.ko' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/crypto/echainiv.ko'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/i2c' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/i2c'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/i2c/i2c-stub.ko' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/i2c/i2c-stub.ko'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs/8723bs.ko' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs/8723bs.ko'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs/flexfilelayout' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs/flexfilelayout'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs/flexfilelayout/nfs_layout_flexfiles.ko' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/fs/nfs/flexfilelayout/nfs_layout_flexfiles.ko'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net/netfilter' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net/netfilter'
'/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net/netfilter/xt_conntrack.ko' -> '/media/linaro/62ca0b6d-6291-4c40-b1fd-11bc291e4a38/lib/modules/4.4.16-00010-g0fce7eb-dirty/kernel/net/netfilter/xt_conntrack.ko'
linaro@linaro-alip:~$


----
## メモ

1. Bluetooth 周り
TinkerOS側から、`/usr/local/bin/rtk_hciattach`をコピーする.

	```bash
	## てぃんかー
	pi@raspberrypi:~$ cat hciuart.service.tinkerboard
	[Unit]
	Description=Bluetooth HCI UART service
	Before=bluetooth.service
	After=dev-ttyS0.device

	[Service]
	Type=simple
	ExecStart=/usr/local/bin/rtk_hciattach -n -s 115200 ttyS0 rtk_h5

	[Install]
	WantedBy=multi-user.target

	## らずぱい
	pi@raspberrypi:~$ cat hciuart.service.raspberrypi
	[Unit]
	Description=Configure Bluetooth Modems connected by UART
	ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins
	Before=bluetooth.service
	Wants=dev-serial1.device
	After=dev-serial1.device

	[Service]
	Type=forking
	ExecStart=/usr/bin/btuart

	[Install]
	WantedBy=multi-user.target
	pi@raspberrypi:~$
	```
6
5
2

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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?