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
how to embed mruby (en)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tomoyuki Sahara
June 02, 2013
Programming
150
0
Share
how to embed mruby (en)
Japanese version is
https://speakerdeck.com/tsahara/how-to-embed-mruby
Tomoyuki Sahara
June 02, 2013
More Decks by Tomoyuki Sahara
See All by Tomoyuki Sahara
IPv6 家庭用ルータ SWG 報告
tsahara
0
180
IPv6 RFC 改版の提案はなぜ議論紛糾したのか?
tsahara
2
2.2k
DNS と TLS のビミョーな関係
tsahara
1
570
IPv6 Path MTU in the World and Japan
tsahara
1
22k
how to embed mruby
tsahara
2
450
Other Decks in Programming
See All in Programming
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
160
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
180
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
2
650
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
1.3k
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
3
530
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
260
Zod v4 Codec でスキーマに型変換を埋め込む REST API 設計 #TSKaigi2026
ryutaro_yako
0
130
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
110
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
200
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
2
500
Sans tests, vos agents ne sont pas fiables
nabondance
0
150
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
400
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
Deep Space Network (abreviated)
tonyrice
0
150
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
290
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
260
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
210
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.1k
Code Review Best Practice
trishagee
74
20k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
930
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
Bash Introduction
62gerente
615
210k
Transcript
How to embed mruby Tomoyuki Sahara (
[email protected]
) Internet Initiative Japan
Inc. $PQZSJHIU $ *OUFSOFU*OJUJBUJWF+BQBO*OD"MMSJHIUTSFTFSWFE
Notice 5IFXPSLIBTEPOFJO/PW IBMGPGZFBSBHP
What is mruby? mruby is the lightweight implementation of the
Ruby language... https://github.com/mruby/mruby google://mruby/
CPU: ARM 32bit Memory: 128MB FlashROM: 32MB OS: NetBSD SA-W1
(www.sacm.jp/#saw1) Router built with mruby
Why mruby? interface.ge1.ipv4.address : 192.168.0.1/24 interface.wlan0.service : enable interface.wlan0.ssid :
guest interface.wlan0.security : wpa-psk-aes route.ipv4.0.destination : default route.ipv4.0.gateway : 100.100.0.1 dhcp.server.0.interface : wlan0 dhcp.server.0.pool.address : 192.168.0.4/24 dhcp.server.0.pool.count : 100 Configuration parse/validate/evalute/execute mruby!
Running mruby CPU ARM 32bit is not uncommon Memory 128MB
is large enough FlashROM 32MB is tight OS NetBSD is a kind of Unix ≒ a (poor) PC ≒ a (poor) PC Not difficult to run mruby on it.
What we have done: • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞
• Build a firmware
Of cource it runs NetBSD
Import Software NetBSD Firmware OpenSSL KAME NTPD Quagga Proprietary Code
mruby
Getting source code % wget http://www.openssl.org/ source/openssl-1.0.1e.tar.gz
Stable version of mruby % wget http://www.mruby.org/ source/mruby-1.0.0.tar.gz EPFTOPUFYJTU
What we have done: • ػೳ֦ு • ෆ۩߹मਖ਼ • Make
a stable version ←New! • Build a firmware
mruby on github
iij/mruby
3 branches (and others) #SBODI 6TBHF NBTUFS NSVCZNSVCZ JJK NBJOEFWFMPQNFOU
T TUBCMFWFSTJPO PUIFST QVMMSFRVFTU FUD
NSVCZNSVCZ JJKNSVCZ NBTUFS NBTUFS JJK T EBJMZ BVUPNBUJDNFSHF EBJMZ BVUPNBUJD
PSCZIBOE BTOFFEFE SFWJFXFE
What we have done: • ػೳ֦ு • ෆ۩߹मਖ਼ • Make
a stable version • Build a firmware
Import Step 1. work=$HOME/mruby-import % cd $work % git checkout
-b s1
Import Step 2. % make % make test % ./test/posix/all.sh
Import Step 3. usr=$NetBSD/usr.bin/mruby % cp src/y.tab.c mrblib/mrblib.c $usr %
vi $usr/Makefile
Import Step 4. dist=$NetBSD/dist/mruby % make clean % rm -r
$dist/* % cp -r * $dist
Import Step 5. % cd $dist; svn add ... %
svn ci $dist $usr
What we have done: • ػೳ֦ு • ෆ۩߹मਖ਼ • Make
a stable version • Build a firmware
Bug, Bug, Bug!
What we have done: • ػೳ֦ு • Fix bugs ←New!
• Make a stable version • Build a firmware
To fix bugs • Write debugging tools: • backtrace •
“require” to module • disassembler (app/mrbdump) • testing framework (mruby-mtest) • debugger (mruby-mdebug)
What we have done: • ػೳ֦ு • Fix bugs •
Make a stable version • Build a firmware
“mruby is useless because *** class/ method is missing!”
What we have done: • Add features ←New! • Fix
bugs • Make a stable version • Build a firmware
Enhancement • Create modules dependent on Unix • IO, File,
Socket, Regexp, Errno, ... • Enhance built-in modules • Array, String, ...
iij/mruby-* mruby-io mruby-socket mruby-regexp-pcre mruby-errno mruby-simple-random mruby-env mruby-require mruby-pack mruby-mock
mruby-syslog mruby-mtest mruby-tempfile mruby-process mruby-pcap mruby-dir (more...)
Ship it! • Add features • Fix bugs • Make
a stable version • Build a firmware
Future work • Make more use of mruby • Create
a new stable branch: s2