Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
KernelVM式 nommu Linux入門/introduce of nommu Linu...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Toshifumi NISHINAGA
July 22, 2017
Programming
2
1.8k
KernelVM式 nommu Linux入門/introduce of nommu Linux for KernelVM
2017年7月22日にKernelVM@東京13で発表した資料です。
STM32F746-discoveryマイコンボードでLinuxを動かす方法を紹介します。
Toshifumi NISHINAGA
July 22, 2017
Tweet
Share
More Decks by Toshifumi NISHINAGA
See All by Toshifumi NISHINAGA
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.6k
マイコンでもRustのtestがしたい/KernelVM Kansai 11
tnishinaga
1
1.7k
BareMetalで遊ぶRaspberry Pi 5 PCIe編/KernelVM Tokyo17
tnishinaga
0
3.4k
probe-rsの紹介と最近の貢献紹介/CELF-02-03
tnishinaga
1
740
SecurityCamp2023基板作るコース講義資料/Security Camp 2023 Lecture Materials
tnishinaga
8
2.7k
RP2040のPIOを使う話/KernelVM Hokuriku 6
tnishinaga
3
2k
JTAGでArmプロセッサをデバッグする方法のつづき/KernelVM_Tokyo16
tnishinaga
0
660
CMSIS-DAPの概要と使い方/KernelVM Online5
tnishinaga
1
2.3k
JTAGでarmプロセッサをデバッグする話/KernelVM Online4
tnishinaga
5
3.9k
Other Decks in Programming
See All in Programming
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.4k
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
180
Feature Toggle は捨てやすく使おう
gennei
0
360
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
310
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
250
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
100
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
130
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
130
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.4k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.1k
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
150
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
180
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
290
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Color Theory Basics | Prateek | Gurzu
gurzu
0
260
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Into the Great Unknown - MozCon
thekraken
40
2.3k
GitHub's CSS Performance
jonrohan
1032
470k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
ラッコキーワード サービス紹介資料
rakko
1
2.8M
Transcript
Kernel/VM式 ARMマイコン入門 Toshifumi NISHINAGA
Kernel/VM式 nommu Linux入門 Toshifumi NISHINAGA
$ who @tnishinaga
一般的なLinuxの動くARM board
Linuxなどの現代の一般的なOSは 仮想メモリを必要とするため、 仮想メモリ制御を行う Memory Management Unit(MMU) が必要
MMUはCortex-Aファミリにのみ搭載されている Cortex-A Cortex-R Cortex-M CPU Clock 数百MHz 〜 数GHz よくしらない
数MHz 〜 数百MHz RAM 数百MB 〜 数GB よくしらない 数KB 〜 数MB MMU/MPU MMU MPU MPU 用途 スマートフォン等 のプロセッサ リアルタイム 機器用 マイコン
しかし、世の中にはマイコンで Linuxを動かしたい人が居る Cortex-A Cortex-R Cortex-M CPU Clock 数百MHz 〜 数GHz
よくしらない 数MHz 〜 数百MHz RAM 数百MB 〜 数GB よくしらない 数KB 〜 数MB MMU/MPU MMU MPU MPU 用途 スマートフォン等 のプロセッサ リアルタイム 機器用 マイコン
nommu Linux
mmuの無いプロセッサで動くLinux
マイコンで動くLinux
STM32F746G discovery board
• STM32F746NG ◦ Cortex-M7 ◦ 200MHz CPU clock ◦ 7-stage
pipeline ◦ Superscalar ◦ I&D cache available ◦ 1MB Flash
つよいCPU + 8MB SDRAM
= Linuxが動く
どうやって起動するか
ブートに必要なもの ブートローダー Linux Kernel (+ device tree blob) rootfs
ブートローダー 役割: • SDRAMの有効化 • SDRAMへのカーネル読み込み • カーネルの起動
役割: • 各種ペリフェラルの初期化 • OS基本機能の初期化 • rootfsのマウント • init処理の実行 Linux
Kernel
役割: • busyboxなどの実行バイナリを提 供する rootfs
SDRAM ブートの流れ STM32F746 ROM u-boot.bin Image root.cpio
U-Bootのビルド $ git git://git.denx.de/u-boot.git && cd u-boot $ curl https://gist.githubusercontent.com/tnishinaga/ea0180fc28227ad158d3092645ccb575/raw/76cbb90cf30a23
d3a59c860c7a887250b31a385b/disable_spl_stm32f7.diff | git apply U-Bootのソースをダウンロード.SPLを切るパッチを当てる $ make stm32f746-disco_defconfig $ make menuconfig STM32F746-disco用の設定からFITを有効化
FITを有効化 U-Bootのビルド
U-Bootのビルド $ make CROSS_COMPILE=arm-none-eabi- -j4
U-Bootのインストール $ sudo st-flash write u-boot.bin 0x08000000 st-flashで書き込む USB
Linux Kernelのビルド $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-linux $ cd stm32-linux
$ git checkout -b stm32-dt-for-v4.13 remotes/origin/stm32-dt-for-v4.13 ソースをダウンロード $ make ARCH=arm stm32_defconfig $ make ARCH=arm menuconfig STM32用の設定を取得して修正していく
RAMアドレスを0xC0000000に修正 (FLASH size も0x00100000(1MiB)に修正) Linux Kernelのビルド
XIPを無効化 Linux Kernelのビルド
Linux Kernelのビルド $ ARCH=arm CROSS_COMPILE=arm-none-eabi- make -j4 Image dtbs ビルドする
rootfsの用意 $ curl http://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2 | bzip2 -d > rootfs.cpio Cortex-M4用のrootfsをもらってくる
(後方互換があるのでCortex-M7でも動く)
rootfsの用意 $ curl http://elinux.org/images/5/51/Stm32_mini_rootfs.cpio.bz2 | bzip2 -d > rootfs.cpio Cortex-M4用のrootfsをもらってくる
(後方互換があるのでCortex-M7でも動く) 動かなかった
rootfsの用意 buildrootを使ってrootfsを作る(要パッチ) 今パッチ作ってるので少々お待ちください…… $ make stm32f746_disco_defconfig $ make CROSS_COMPILE=arm-none-eabi- -j4
起動用イメージの用意 $ curl -O https://gist.githubusercontent.com/tnishinaga/ea0180fc28227ad158d3092645ccb575/raw/cdab9f1bfd5488 d2ec180c383f0d142fb1f5200a/stm32f7_fit.its $ mkimage -f stm32f7_fit.its
stm32f7_fit.itb Image Tree Souce(stm32f7_fit.its)を持ってきて Image Tree Blob(stm32f7_fit.itb)を作成
起動イメージの転送 PC側でminicomを起動する $ minicom -D /dev/ttyACM0 -b 115200
起動イメージの転送
起動イメージの転送 PC側(minicom)はymodemよりFIT(*.itb)を送信 (Crtl + A, Sで開ける) U-Boot側はloadyで待受け U-Boot > loady
0xC0400000
起動イメージの転送
Linuxの起動 bootmでFITからLinux Kernelを読み込んで起動 U-Boot > bootm 0xC0400000
Demo: sl
今後の予定 • NIC使えるようにする • 画面使えるようにする • MINCS動かしてみる(?)