SlideShare a Scribd company logo
1 of 18
Download to read offline
初心者の初心者による
初心者のための
AGL on Yocto on R-Car M2 Porter
渡邉直彦
Yocto Project Japan 勉強会 #3 #yoctojp
2017/04/08
すご~い!
君は初心者だと
正直に告白出来る
フレンズなんだね!
アジェンダ
1. 今日やることの概要説明
a. AGL on Yocto on R-Car M2 Porter
b. AGL って何?
c. Yocto って何?
d. R-Car M2 Porter って何?
2. Yocto build
3. 実行
4. 詰まったところ
自己紹介
● 渡邉直彦
○ @naohikowatanabe
● 株式会社 ACCESS
○ 組込 Browser 歴10年(車載歴8年)
■ (うち、育休8ヶ月半してました)
○ 最近は WebKit&Blink を移植したり改造したり
○ Yocto build は、、、平均月1回ビルドする程度
● 今日は私人です!
● 今日の目標
○ Yocto を「ヨクト」と発音しない、「ヤクト」と発音する (ง`0´)ง
○ Yocto 初めての人でも build 出来るようになる情報をお伝えしたい
○ 多分くまだすさんや岩松先生が Yocto の概要とか理念とか大事な所を説明し
てくれるだろうから、僕は具体的なコマンドレベルで説明を。。
今日やること
● AGL on Yocto on R-Car M2 Porter のビルドと実行方法
● AGL(Automotive Grade Linux) とは
○ Linux Foundation のプロジェクト
○ オープンに車載用 Linux を作成
● Yocto Project とは
○ 組込 OS(Linux) 作成ツール
● R-Car M2 Porter とは
○ ルネサスさんの車載用 SoC
○ M はミドルレンジ、2は第2世代
○ CPU: Cortex-A15 1.5 GHz Dual
○ GPU: PowerVR SGX544MP2
http://elinux.org/R-Car/Boards/Porter
AGL on Yocto on R-Car M2 Porter
全体図
R-Car M2
Hardware
AGL
OS
Ubuntu
CES2017
UI/HMI
OS 作成ツール
Repository
https://gerrit.automotivelinux.org
100GB
オーダーの
storage
1. OS ソース一式ダウンロード
$ repo init
$ repo sync
2. Yocto build
$ bitbake agl-demo-platform
3. sdcard へコピー
$ tar --directory=<roofs書込先> --file=<rootfs>.tar.bz2
$ cp uImage+dtb /<roofs書込先>/boot
実行環境 開発(ビルド)環境
必要機材
● 開発環境
○ Ubuntu 14.04
■ storage 100GB オーダー
○ Windows
■ Teraterm (厳密には何かしらの terminal soft)
○ AGL ソース
■ 今回は AGL UCB(Unifid Code Base) 3.0.2 (Yocto 2.1 ベース)
● 実行環境
○ R-Car M2 Porter
■ マルツさんから買えます http://www.marutsu.co.jp/pc/i/599180/
■ 2017/4/7 現在 53550円。ボーナスはたくか、会社に買ってもらいましょうw
○ その他機材
■ AC アダプタ
■ ディスプレイ: On-Lap 1002 http://www.tekwind.co.jp/products/GEC/entry_11501.php
■ micro sdcard
■ USB <-> micro USB シリアルケーブル(Windows と R-Car の接続用)
ビルド&実行コマンドまとめ
// ビルドに必要なパッケージ追加
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl
// ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置
// http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp
// Repo tool インストール
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
// Yocto でソースダウンロードとビルド
$ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
$ repo sync
$ source meta-agl/scripts/aglsetup.sh -h
$ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack
$ bitbake agl-demo-platform
// sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置
$ umount /dev/sdf1
$ sudo fdisk /dev/sdf
コマンド (m でヘルプ): o
コマンド (m でヘルプ): n
Partition type:
Select (default p):
コマンド (m でヘルプ): w
$ umount /dev/sdf1
$ sudo mke2fs -t ext3 /dev/sdf1
$ mkdir /tmp/agl
$ sudo mount /dev/sdf1 /tmp/agl/
$ cd ./tmp/deploy/images/porter/
$ sudo rm -rf /tmp/agl/*
$ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2
$ sudo cp uImage+dtb /tmp/agl/boot/
$ sync
$ sudo umount /tmp/agl
// ここから Teraterm on windows (というか何かしらの terminal soft)
=> setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に
=> setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel'
=> setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60'
=> setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait'
=> setenv bootmmc '1:1'
=> setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb'
=> setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0'
=> saveenv
// 実機再起動。ここから Teraterm の実機コンソール
# root
// ビルドに必要なパッケージ追加
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl
// ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置
// http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp
// Repo tool インストール
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
// Yocto でソースダウンロードとビルド
$ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
$ repo sync
$ source meta-agl/scripts/aglsetup.sh -h
$ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack
$ bitbake agl-demo-platform
// sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置
$ umount /dev/sdf1
$ sudo fdisk /dev/sdf
コマンド (m でヘルプ): o
コマンド (m でヘルプ): n
Partition type:
Select (default p):
コマンド (m でヘルプ): w
$ umount /dev/sdf1
$ sudo mke2fs -t ext3 /dev/sdf1
$ mkdir /tmp/agl
$ sudo mount /dev/sdf1 /tmp/agl/
$ cd ./tmp/deploy/images/porter/
$ sudo rm -rf /tmp/agl/*
$ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2
$ sudo cp uImage+dtb /tmp/agl/boot/
$ sync
$ sudo umount /tmp/agl
// ここから Teraterm on windows (というか何かしらの terminal soft)
=> setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に
=> setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel'
=> setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60'
=> setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait'
=> setenv bootmmc '1:1'
=> setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb'
=> setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0'
=> saveenv
// 実機再起動。ここから Teraterm の実機コンソール
# root
ビルド&実行コマンドまとめ
Yocto build (OS 作成)
OS を sdcard に配置
実機(R-CarM2 Porter)の u-boot 設定
実機(R-CarM2 Porter)起動
Yocto
ビルド
コマンド
5つのみ!
ビルドに必要なツール準備
ビルド&実行コマンド詳細 1/4
// ビルドに必要なパッケージ追加
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib 
build-essential chrpath socat libsdl1.2-dev xterm cpio curl
// Repo tool インストール
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
// ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置
// http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp
$ ls ~/Downloads/ | grep R-Car
R-Car_Series_Evaluation_Software_Package_for_Linux-20160920.zip
R-Car_Series_Evaluation_Software_Package_of_Linux_Drivers-20151228.zip
Repo tool : git の管理ツール
要ユーザー登録
バックスラッシュは改行の意味(以下同様)
ビルド&実行コマンド詳細 2/4
// Yocto で AGL ソースダウンロードとビルド
$ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
$ repo sync
$ source meta-agl/scripts/aglsetup.sh -h
$ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack
$ bitbake agl-demo-platform
// 約 6000 パッケージをビルド。コーヒー飲んで約 2時間待ちましょう
// 成果物
$ ls ./tmp/deploy/images/porter | grep -e agl-demo-platform-porter.tar -e uImage+dtb
agl-demo-platform-porter.tar.bz2
uImage+dtb
// ストレージ使用量確認
$ du -sh
55G
./tmp/deploy/images/porter: 成果物生成ディレクトリ
agl-demo-platform-porter.tar.bz2: rootfs
uImage+dtb : linux の kernel
repo init: 初期化
repo sync: ダウンロード
aglsetup.sh: AGL&Yocto ビルド設定
-h : --help
-m 以降: 実際の設定
bitbake: Yocto build
ビルド&実行コマンド詳細 3/4
// sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置
$ lsblk
$ umount /dev/sdf1
$ sudo fdisk /dev/sdf
コマンド (m でヘルプ): o
コマンド (m でヘルプ): n
Partition type:
Select (default p):
コマンド (m でヘルプ): w
$ umount /dev/sdf1
$ sudo mke2fs -t ext3 /dev/sdf1
$ mkdir /tmp/agl
$ sudo mount /dev/sdf1 /tmp/agl/
$ cd ./tmp/deploy/images/porter/
$ sudo rm -rf /tmp/agl/*
$ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl
--file=agl-demo-platform-porter.tar.bz2
$ sudo cp uImage+dtb /tmp/agl/boot/
$ sync
$ sudo umount /tmp/agl
lsblk: sdcard のデバイス名確認(今回は sdf1 だったとする)
fdisk: パーティション設定。”o”, ”n”, enter, enter, ”w” を押下
mke2fs: sdcard フォーマット。 ext3 で。
tar --file=agl-demo-platform-porter.tar.bz2: rootfs 書き込み
cp uImage+dtb : Kernel (uImage+dtb) を sdcard に書き込み
ビルド&実行コマンド詳細 4/4
// 実機関連各種接続
// R-Car, ディスプレイ、AC アダプター、Windwos PC
// 電源 ON
// ここから Teraterm on windows (というか何かしらの terminal soft)
=> setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に
=> setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel'
=> setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60'
=> setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait'
=> setenv bootmmc '1:1'
=> setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb'
=> setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm
0x40007fc0'
=> saveenv
// 実機再起動。ここから Teraterm の実機コンソール
porter login:
// root Enter
root@porter:~#
setenv: U-Boot に対する設定
mac address
シリアル通信
Video の設定
ファイルシステムの設定
saveenv: setenv コマンドによる設定の保存
動作状況 1/3
動作状況 2/3
動作状況 3/3
実機持ってきたので実機デモタイム
今回詰まったところ
● そもそも AGL の最新ソース(CES2017 Demo の AGL UCB
3.0.2) の在り処を探すのに手間取った。。
○ elinux( http://elinux.org/R-Car/Boards/Porter ) は UCB 2.1 まで
○ AGL wiki Porter (https://wiki.automotivelinux.org/start/building_for_the_renesas_r-car_m2) は 2.0.4 まで
○ → AGL wiki のリリースノート https://wiki.automotivelinux.org/agl-distro/release-notes の バー
ジョン毎のリポジトリ URL のリストから最新版 URL を入手
● Ubuntu 14.04 の tar の version をあげる必要
○ デフォルト
■ $ tar --version
■ tar (GNU tar) 1.27.1
○ AGL としては tar 1.28 を使えとのこと
○ →適当にアップデートして対応
まとめ
● AGL on Yocto on R-Car M2 Porter ビルド&実行出来ましたね!
○ AGL(Automotive Grade Linux) = Linux Faundation 策定の車載用 Linux
○ Yocto Project = 組込 Linux 作成環境
○ R-Car M2 Porter = ルネサスさんの車載用 SoC
● AGL on Yocto の良いところ
○ (理念とか方向性とかそういう良さはここでは語らず、 Yocto ユーザー視点として )
○ 圧倒的にビルドコマンドが少ない!簡単!
● 個人的には Yocto の情報もっと潤沢になって欲しいと思っているので、 Yocto 人
口が増えたら嬉しいです!
○ 最初は RPi3 とかでビルド済の OS がネットに上がってる実機がおすすめです
参考
● AGL(Automotive Grade Linux)
○ 公式 https://www.automotivelinux.org/
○ ビルド手順 https://wiki.automotivelinux.org/start/building_for_the_renesas_r-car_m2
○ AGL UCB Release Notes https://wiki.automotivelinux.org/agl-distro/release-notes
○ 今回のソース
https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl.git;a=tree;h=refs/heads/chinook;hb=refs/heads/chinook
● Yocto Project
○ 公式 https://www.yoctoproject.org/docs/2.1/yocto-project-qs/yocto-project-qs.html
● R-Car M2 Porter
○ 公式 https://www.renesas.com/ja-jp/solutions/automotive/products/rcar-m2.html

More Related Content

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

初心者の初心者による初心者のための AGL on Yocto on R-Car M2 Porter

  • 1. 初心者の初心者による 初心者のための AGL on Yocto on R-Car M2 Porter 渡邉直彦 Yocto Project Japan 勉強会 #3 #yoctojp 2017/04/08 すご~い! 君は初心者だと 正直に告白出来る フレンズなんだね!
  • 2. アジェンダ 1. 今日やることの概要説明 a. AGL on Yocto on R-Car M2 Porter b. AGL って何? c. Yocto って何? d. R-Car M2 Porter って何? 2. Yocto build 3. 実行 4. 詰まったところ
  • 3. 自己紹介 ● 渡邉直彦 ○ @naohikowatanabe ● 株式会社 ACCESS ○ 組込 Browser 歴10年(車載歴8年) ■ (うち、育休8ヶ月半してました) ○ 最近は WebKit&Blink を移植したり改造したり ○ Yocto build は、、、平均月1回ビルドする程度 ● 今日は私人です! ● 今日の目標 ○ Yocto を「ヨクト」と発音しない、「ヤクト」と発音する (ง`0´)ง ○ Yocto 初めての人でも build 出来るようになる情報をお伝えしたい ○ 多分くまだすさんや岩松先生が Yocto の概要とか理念とか大事な所を説明し てくれるだろうから、僕は具体的なコマンドレベルで説明を。。
  • 4. 今日やること ● AGL on Yocto on R-Car M2 Porter のビルドと実行方法 ● AGL(Automotive Grade Linux) とは ○ Linux Foundation のプロジェクト ○ オープンに車載用 Linux を作成 ● Yocto Project とは ○ 組込 OS(Linux) 作成ツール ● R-Car M2 Porter とは ○ ルネサスさんの車載用 SoC ○ M はミドルレンジ、2は第2世代 ○ CPU: Cortex-A15 1.5 GHz Dual ○ GPU: PowerVR SGX544MP2 http://elinux.org/R-Car/Boards/Porter
  • 5. AGL on Yocto on R-Car M2 Porter 全体図 R-Car M2 Hardware AGL OS Ubuntu CES2017 UI/HMI OS 作成ツール Repository https://gerrit.automotivelinux.org 100GB オーダーの storage 1. OS ソース一式ダウンロード $ repo init $ repo sync 2. Yocto build $ bitbake agl-demo-platform 3. sdcard へコピー $ tar --directory=<roofs書込先> --file=<rootfs>.tar.bz2 $ cp uImage+dtb /<roofs書込先>/boot 実行環境 開発(ビルド)環境
  • 6. 必要機材 ● 開発環境 ○ Ubuntu 14.04 ■ storage 100GB オーダー ○ Windows ■ Teraterm (厳密には何かしらの terminal soft) ○ AGL ソース ■ 今回は AGL UCB(Unifid Code Base) 3.0.2 (Yocto 2.1 ベース) ● 実行環境 ○ R-Car M2 Porter ■ マルツさんから買えます http://www.marutsu.co.jp/pc/i/599180/ ■ 2017/4/7 現在 53550円。ボーナスはたくか、会社に買ってもらいましょうw ○ その他機材 ■ AC アダプタ ■ ディスプレイ: On-Lap 1002 http://www.tekwind.co.jp/products/GEC/entry_11501.php ■ micro sdcard ■ USB <-> micro USB シリアルケーブル(Windows と R-Car の接続用)
  • 7. ビルド&実行コマンドまとめ // ビルドに必要なパッケージ追加 $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl // ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置 // http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp // Repo tool インストール $ mkdir ~/bin $ export PATH=~/bin:$PATH $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo // Yocto でソースダウンロードとビルド $ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo $ repo sync $ source meta-agl/scripts/aglsetup.sh -h $ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack $ bitbake agl-demo-platform // sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置 $ umount /dev/sdf1 $ sudo fdisk /dev/sdf コマンド (m でヘルプ): o コマンド (m でヘルプ): n Partition type: Select (default p): コマンド (m でヘルプ): w $ umount /dev/sdf1 $ sudo mke2fs -t ext3 /dev/sdf1 $ mkdir /tmp/agl $ sudo mount /dev/sdf1 /tmp/agl/ $ cd ./tmp/deploy/images/porter/ $ sudo rm -rf /tmp/agl/* $ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2 $ sudo cp uImage+dtb /tmp/agl/boot/ $ sync $ sudo umount /tmp/agl // ここから Teraterm on windows (というか何かしらの terminal soft) => setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に => setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel' => setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60' => setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait' => setenv bootmmc '1:1' => setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb' => setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0' => saveenv // 実機再起動。ここから Teraterm の実機コンソール # root
  • 8. // ビルドに必要なパッケージ追加 $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl // ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置 // http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp // Repo tool インストール $ mkdir ~/bin $ export PATH=~/bin:$PATH $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo // Yocto でソースダウンロードとビルド $ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo $ repo sync $ source meta-agl/scripts/aglsetup.sh -h $ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack $ bitbake agl-demo-platform // sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置 $ umount /dev/sdf1 $ sudo fdisk /dev/sdf コマンド (m でヘルプ): o コマンド (m でヘルプ): n Partition type: Select (default p): コマンド (m でヘルプ): w $ umount /dev/sdf1 $ sudo mke2fs -t ext3 /dev/sdf1 $ mkdir /tmp/agl $ sudo mount /dev/sdf1 /tmp/agl/ $ cd ./tmp/deploy/images/porter/ $ sudo rm -rf /tmp/agl/* $ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2 $ sudo cp uImage+dtb /tmp/agl/boot/ $ sync $ sudo umount /tmp/agl // ここから Teraterm on windows (というか何かしらの terminal soft) => setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に => setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel' => setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60' => setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait' => setenv bootmmc '1:1' => setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb' => setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0' => saveenv // 実機再起動。ここから Teraterm の実機コンソール # root ビルド&実行コマンドまとめ Yocto build (OS 作成) OS を sdcard に配置 実機(R-CarM2 Porter)の u-boot 設定 実機(R-CarM2 Porter)起動 Yocto ビルド コマンド 5つのみ! ビルドに必要なツール準備
  • 9. ビルド&実行コマンド詳細 1/4 // ビルドに必要なパッケージ追加 $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl // Repo tool インストール $ mkdir ~/bin $ export PATH=~/bin:$PATH $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo // ルネサスさんのサイトから R-Car の driver ダウンロード。 ~/Downloads に配置 // http://www.renesas.com/secret/r_car_download/rcar_demoboard.jsp $ ls ~/Downloads/ | grep R-Car R-Car_Series_Evaluation_Software_Package_for_Linux-20160920.zip R-Car_Series_Evaluation_Software_Package_of_Linux_Drivers-20151228.zip Repo tool : git の管理ツール 要ユーザー登録 バックスラッシュは改行の意味(以下同様)
  • 10. ビルド&実行コマンド詳細 2/4 // Yocto で AGL ソースダウンロードとビルド $ repo init -b chinook -m chinook_3.0.0.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo $ repo sync $ source meta-agl/scripts/aglsetup.sh -h $ source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack $ bitbake agl-demo-platform // 約 6000 パッケージをビルド。コーヒー飲んで約 2時間待ちましょう // 成果物 $ ls ./tmp/deploy/images/porter | grep -e agl-demo-platform-porter.tar -e uImage+dtb agl-demo-platform-porter.tar.bz2 uImage+dtb // ストレージ使用量確認 $ du -sh 55G ./tmp/deploy/images/porter: 成果物生成ディレクトリ agl-demo-platform-porter.tar.bz2: rootfs uImage+dtb : linux の kernel repo init: 初期化 repo sync: ダウンロード aglsetup.sh: AGL&Yocto ビルド設定 -h : --help -m 以降: 実際の設定 bitbake: Yocto build
  • 11. ビルド&実行コマンド詳細 3/4 // sdcard 作成。初期化して、 rootfs の tar を書き込み、 uImage+dtb を配置 $ lsblk $ umount /dev/sdf1 $ sudo fdisk /dev/sdf コマンド (m でヘルプ): o コマンド (m でヘルプ): n Partition type: Select (default p): コマンド (m でヘルプ): w $ umount /dev/sdf1 $ sudo mke2fs -t ext3 /dev/sdf1 $ mkdir /tmp/agl $ sudo mount /dev/sdf1 /tmp/agl/ $ cd ./tmp/deploy/images/porter/ $ sudo rm -rf /tmp/agl/* $ sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2 $ sudo cp uImage+dtb /tmp/agl/boot/ $ sync $ sudo umount /tmp/agl lsblk: sdcard のデバイス名確認(今回は sdf1 だったとする) fdisk: パーティション設定。”o”, ”n”, enter, enter, ”w” を押下 mke2fs: sdcard フォーマット。 ext3 で。 tar --file=agl-demo-platform-porter.tar.bz2: rootfs 書き込み cp uImage+dtb : Kernel (uImage+dtb) を sdcard に書き込み
  • 12. ビルド&実行コマンド詳細 4/4 // 実機関連各種接続 // R-Car, ディスプレイ、AC アダプター、Windwos PC // 電源 ON // ここから Teraterm on windows (というか何かしらの terminal soft) => setenv ethaddr 00:00:000:00:00:00 // 数字は MAC ADDRESS。ひとまず適当に => setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel' => setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60' => setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait' => setenv bootmmc '1:1' => setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb' => setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0' => saveenv // 実機再起動。ここから Teraterm の実機コンソール porter login: // root Enter root@porter:~# setenv: U-Boot に対する設定 mac address シリアル通信 Video の設定 ファイルシステムの設定 saveenv: setenv コマンドによる設定の保存
  • 16. 今回詰まったところ ● そもそも AGL の最新ソース(CES2017 Demo の AGL UCB 3.0.2) の在り処を探すのに手間取った。。 ○ elinux( http://elinux.org/R-Car/Boards/Porter ) は UCB 2.1 まで ○ AGL wiki Porter (https://wiki.automotivelinux.org/start/building_for_the_renesas_r-car_m2) は 2.0.4 まで ○ → AGL wiki のリリースノート https://wiki.automotivelinux.org/agl-distro/release-notes の バー ジョン毎のリポジトリ URL のリストから最新版 URL を入手 ● Ubuntu 14.04 の tar の version をあげる必要 ○ デフォルト ■ $ tar --version ■ tar (GNU tar) 1.27.1 ○ AGL としては tar 1.28 を使えとのこと ○ →適当にアップデートして対応
  • 17. まとめ ● AGL on Yocto on R-Car M2 Porter ビルド&実行出来ましたね! ○ AGL(Automotive Grade Linux) = Linux Faundation 策定の車載用 Linux ○ Yocto Project = 組込 Linux 作成環境 ○ R-Car M2 Porter = ルネサスさんの車載用 SoC ● AGL on Yocto の良いところ ○ (理念とか方向性とかそういう良さはここでは語らず、 Yocto ユーザー視点として ) ○ 圧倒的にビルドコマンドが少ない!簡単! ● 個人的には Yocto の情報もっと潤沢になって欲しいと思っているので、 Yocto 人 口が増えたら嬉しいです! ○ 最初は RPi3 とかでビルド済の OS がネットに上がってる実機がおすすめです
  • 18. 参考 ● AGL(Automotive Grade Linux) ○ 公式 https://www.automotivelinux.org/ ○ ビルド手順 https://wiki.automotivelinux.org/start/building_for_the_renesas_r-car_m2 ○ AGL UCB Release Notes https://wiki.automotivelinux.org/agl-distro/release-notes ○ 今回のソース https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl.git;a=tree;h=refs/heads/chinook;hb=refs/heads/chinook ● Yocto Project ○ 公式 https://www.yoctoproject.org/docs/2.1/yocto-project-qs/yocto-project-qs.html ● R-Car M2 Porter ○ 公式 https://www.renesas.com/ja-jp/solutions/automotive/products/rcar-m2.html