Upgrade to Pro — share decks privately, control downloads, hide ads and more …

how to embed mruby

how to embed mruby

Ecd1d460960b652a705a565deef2d026?s=128

Tomoyuki Sahara

June 02, 2013
Tweet

Transcript

  1. mrubyͷ૊ΈࠐΈ͔ͨ ࠤݪ۩޾ UTBIBSB!JJKBEKQ גࣜձࣾΠϯλʔωοτΠχγΞςΟϒ $PQZSJHIU $ *OUFSOFU*OJUJBUJWF+BQBO*OD"MMSJHIUTSFTFSWFE

  2. ͸͡Ίʹ ࠒͷ࿩Ͱ͢

  3. NSVCZͱ͸ mruby is the lightweight implementation of the Ruby language...

    https://github.com/mruby/mruby google://mruby/
  4. CPU: ARM 32bit Memory: 128MB FlashROM: 32MB OS: NetBSD 4"8

    XXXTBDNKQTBX NSVCZΛ࢖ͬͨϧʔλ
  5. ͳͥNSVCZΛ࢖ͬͨͷ͔ 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 ίϯϑΟά ύʔζݕূධՁ൓ө mruby!
  6. NSVCZΛಈ͔͢ CPU ARM 32bit ˡͦͦ͜͜;ͭ͏ Memory 128MB ˡ·͊·͊͋Δ FlashROM 32MB

    ˡ΍΍ݫ͠Ί OS NetBSD ˡ͍͓ͪ͏6OJY 㲈;ͭ͏ͷ1$ ͨͩ͠ශऑ 㲈;ͭ͏ͷ1$ ͨͩ͠ශऑ 㱤ಈ͔͚ͩ͢ͳΒ೉͘͠ͳ͍
  7. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  8. Of cource it runs NetBSD

  9. ιϑτ΢ΣΞͷ૊ΈࠐΈ NetBSD ϑΝʔϜ΢ΣΞ OpenSSL KAME NTPD Quagga ಠࣗιϑτ΢ΣΞ mruby

  10. ιʔείʔυͷऔಘ % wget http://www.openssl.org/ source/openssl-1.0.1e.tar.gz

  11. NSVCZͷ҆ఆ൛ % wget http://www.mruby.org/ source/mruby-1.0.0.tar.gz ͸͋Γ·ͤΜɻ

  12. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ ←New! • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  13. NSVCZPOHJUIVC

  14. JJKNSVCZ

  15. ϒϥϯνຊ Ћ ϒϥϯν ༻్ NBTUFS NSVCZNSVCZ JJK ։ൃ൛ T ҆ఆ൛

    ͦͷଞ QVMMSFRVFTU༻ͳͲɺ࢖͍ࣺͯ
  16. NSVCZNSVCZ JJKNSVCZ NBTUFS NBTUFS JJK T EBJMZ ࣗಈ EBJMZ ࣗಈ·ͨ͸खಈ

    ෆఆظ ϨϏϡʔ෇͖खಈ
  17. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  18. Πϯϙʔτखॱ work=$HOME/mruby-import % cd $work % git checkout -b s1

  19. Πϯϙʔτखॱ % make % make test % ./test/posix/all.sh

  20. Πϯϙʔτखॱ usr=$NetBSD/usr.bin/mruby % cp src/y.tab.c mrblib/mrblib.c $usr % vi $usr/Makefile

  21. Πϯϙʔτखॱ dist=$NetBSD/dist/mruby % make clean % rm -r $dist/* %

    cp -r * $dist
  22. Πϯϙʔτखॱ % cd $dist; svn add ... % svn ci

    $dist $usr
  23. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  24. Bug, Bug, Bug!

  25. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ ←New! • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  26. ҆ఆԽ w σόοά؀ڥͷ੔උ w όοΫτϨʔε w lSFRVJSFzʹΑΔϞδϡʔϧ෼ׂ w ٯΞηϯϒϥ BQQNSCEVNQ

    w ςετϑϨʔϜϫʔΫ NSVCZNUFTU w σόοΨ NSVCZNEFCVH
  27. ΍ͬͨ͜ͱ • ػೳ֦ு • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  28. ʮ͑ 3VCZͳͷʹ ͕ແ͍ͷ ʯ

  29. ΍ͬͨ͜ͱ • ػೳڧԽ ←New! • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  30. ֦ு w6OJYґଘͷػೳͷ௥Ճ w*0 'JMF 4PDLFU 3FHFYQ &SSOP  wطଘϞδϡʔϧͷڧԽ w"SSBZ

    4USJOH 
  31. JJKNSVCZ 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...)
  32. ׬੒ʂ • ػೳڧԽ • ෆ۩߹मਖ਼ • ҆ఆ൛ϦϦʔεͷ࡞੒ • ϑΝʔϜ΢ΣΞ΁ͷ૊ΈೖΕ

  33. ࠓޙ w ૊ΈࠐΜͩNSVCZͷ׆༻ w ࣍ͷ҆ఆ൛Tͷ࡞੒