{"id":857,"date":"2015-07-18T16:02:38","date_gmt":"2015-07-18T07:02:38","guid":{"rendered":"https:\/\/hack.gpl.jp\/?p=857"},"modified":"2015-07-18T16:02:38","modified_gmt":"2015-07-18T07:02:38","slug":"post-857","status":"publish","type":"post","link":"https:\/\/hack.gpl.jp\/2015\/07\/18\/post-857.html","title":{"rendered":"berryboot.img \u306e\u4e2d\u3092\u306e\u305e\u3044\u3066\u307f\u305f"},"content":{"rendered":"

berryboot \u306e\u4f5c\u308a\u3092\u3082\u3046\u5c11\u3057\u898b\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u8d77\u52d5\u3059\u308bboot img \u3092\u3070\u3089\u3057\u3066\u8997\u3044\u3066\u307f\u307e\u3057\u305f\u3002\u624b\u9806\u306f\u7d76\u5bfe\u5fd8\u308c\u308b\u306e\u3067\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n

 <\/p>\n

\u4f5c\u696d\u306f\u3001osx \u3067\u3084\u3063\u3066\u3044\u307e\u3059\u3002
\u3068\u308a\u3042\u3048\u305a\u3001\u4f5c\u696d\u7528\u306bRAM\u30c7\u30a3\u30b9\u30af\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3059\u3002
\u4f5c\u696d\u306f\u3001RAM\u30c7\u30a3\u30b9\u30af\u306e\u4e2d\u3058\u3083\u306a\u304f\u3066\u3082\u3044\u3044\u3093\u3067\u3059\u304c\u3001\u4f55\u304b\u3068\u901f\u304f\u3066\u9593\u9055\u3048\u306a\u304f\u3066\u4fbf\u5229\u306a\u306e\u3067\u3001\u81ea\u5206\u7528\u306e\u30e1\u30e2\u306e\u610f\u5473\u3092\u3042\u3063\u3066\u66f8\u3044\u3066\u3044\u307e\u3059\u3002\u72ec\u7acb\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3059\u308b\u3053\u3068\u3082\u7c21\u5358\u3067\u3059\u3057\u306d\u3002<\/p>\n

osx \u3067RAM\u30c7\u30a3\u30b9\u30af\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001<\/p>\n

\n

$ diskutil eraseDisk HFS+ RAMDISK `hdiutil attach -nomount ram:\/\/8388608`<\/p>\n<\/blockquote>\n

\u3053\u306e\u4f8b\u3067\u306f\u3001\u30c7\u30a3\u30b9\u30af\u30b5\u30a4\u30ba\u306f8388608\uff084096 * 2048\uff09\u30674GB \u306eRAM\u30c7\u30a3\u30b9\u30af\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304c\u3044\u3084\u306a\u5834\u5408\u306f\u3001RAMDiskCreator \u3068\u3044\u3046\u30c4\u30fc\u30eb\u3092Florian Bogner\u3055\u3093\u304c\u516c\u958b\u3057\u3066\u3044\u308b\u306e\u3067\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n

\"a\" <\/p>\n

\"_Applications\" <\/p>\n

RAMDiskCreator 1.2<\/a><\/p>\n

 <\/p>\n

\"aa\" <\/p>\n<\/p>\n

\u3053\u308c\u4ee5\u4e0b\u306f\u3001Linux \u3067\u3082\u540c\u3058\u306a\u306f\u305a\u3067\u3059\u3002<\/p>\n

file \u3067 berriboot.img \u3092\u898b\u308b\u3068\u3001u-boot \u306e uImage \u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n

$ file berryboot.img \nberryboot.img: u-boot legacy uImage, , Linux\/ARM, RAMDisk Image (Not compressed), 10112736 bytes, Wed Apr  1 07:32:40 2015, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xAB28A904, Data CRC: 0x6870C48E<\/pre>\n

\u3053\u308c\u306f\u8abf\u3079\u3066\u307f\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u5c55\u958b\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n

$ dd if=berryboot.img bs=64 skip=1 of=berryboot_initrd\n158011+1 records in\n158011+1 records out\n10112736 bytes transferred in 0.315515 secs (32051518 bytes\/sec)<\/pre>\n

\u5148\u982d64bite \u306b\u5c5e\u6027\u60c5\u5831\u304c\u3042\u308b\u3088\u3046\u3067\u3001\u305d\u308c\u3092\u98db\u3070\u3057\u3066 DD \u3057\u3066\u3084\u308c\u3070\u3088\u3044\u3088\u3046\u3067\u3059\u3002\u518d\u5ea6\u3001file \u3067\u898b\u3066\u307f\u308b\u3068\u3001<\/p>\n

$ file berryboot_initrd \nberryboot_initrd: gzip compressed data, was "rootfs.cpio", from Unix, last modified: Wed Apr  1 07:32:37 2015, max compression<\/pre>\n

cpio \u306e\u3088\u3046\u3067\u3059\u3002tmp \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u5f8c\u3001\u305d\u3053\u306b\u5c55\u958b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n

$ mkdir tmp\n$ cd tmp\/\n$ cpio -idm < ..\/berryboot_initrd<\/pre>\n

\u3046\u307e\u304f\u5c55\u958b\u3055\u308c\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n

init \u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3053\u3068\u3092\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n

---- \/init\n#!\/bin\/sh\n#\n# BerryBoot, ugly but functional image chooser thingy\n#\n# Author: Floris Bos\n#\n\n# Standard busybox init\n\/bin\/mount -t proc proc \/proc\n\/bin\/mount -o remount,rw,noatime \/ \n\/bin\/mount -t sysfs sysfs \/sys\n\/bin\/mount -t devtmpfs dev \/dev\n\/bin\/hostname -F \/etc\/hostname\n\nif grep -q debugconsole \/proc\/cmdline; then\n    \/sbin\/getty -L tty2 0 vt100 &\nfi\n\nif grep -q "mmc0_led" \/proc\/cmdline; then\n    if [ -e \/sys\/class\/leds\/ph20:green:led1 ]; then\n        echo mmc0 > \/sys\/class\/leds\/ph20:green:led1\/trigger\n    fi\nfi\n\nif grep -q vncinstall \/proc\/cmdline; then\n    export QWS_DISPLAY="VNC:size=800x600:depth=32:0"\n    echo\n    echo Connect with your VNC client\n    echo If you wish to disable VNC mode: remove 'vncinstall' from cmdline.txt\n    echo\nfi\n\n# Show GUI, it will write the OS choosen to \/tmp\/answer\n\/usr\/bin\/BerrybootGUI -qws 2>\/tmp\/debug \n\n# Clear screen\nclear\n\nIMAGE=`cat \/tmp\/answer`\nDATADIR="\/mnt\/data\/$IMAGE"\nrm \/tmp\/answer\n\n#\n# Set CPU governor to "ondemand" when booting an OS on the Pi\n# Set it to "performance" for other devices\n#\nif grep -q "BCM2708" \/proc\/cpuinfo; then\n    GOVERNOR=ondemand\nelse\n    GOVERNOR=performance\nfi\n\nif [ "$IMAGE" != "" ]; then\n    mkdir -p \/squashfs \/aufs $DATADIR\n    clear\n    echo Mounting image ${IMAGE}...\n    mount -o loop "\/mnt\/images\/$IMAGE" \/squashfs\n    cd \/squashfs\n\n    if [ -e berryboot-init ]; then\n        echo Executing init script\n        . berryboot-init\n    fi\n\n    if [ -L lib -o -L sbin ]; then\n        echo\n        echo Error: having a symlink for \/lib and\/or \/sbin inside your image is not allowed!\n        echo This conflicts with the shared AUFS folders\n        echo\n        sleep 5\n    fi\n\n    for initfile in sbin\/init usr\/lib\/systemd\/systemd init\n    do\n        if [ -e $initfile ]; then\n            echo Mounting RW data directory on top\n            mount -t aufs -o br:${DATADIR}:\/mnt\/shared:\/squashfs none \/aufs\n            cd \/aufs\n            mount -o move \/dev dev\n            mount -o move \/sys sys\n            mount -o move \/proc proc\n            echo Setting CPU governor to $GOVERNOR\n            echo "$GOVERNOR" > sys\/devices\/system\/cpu\/cpu0\/cpufreq\/scaling_governor\n            echo Starting operating system ${IMAGE}...\n            exec switch_root . $initfile\n        fi\n    done\n\n    echo\n    echo Error: unable to locate or execute \/sbin\/init \/usr\/lib\/systemd\/systemd \/init inside $IMAGE\n    echo\n    sleep 5\nfi\n\n# In case the user pressed cancel or something went wrong, show an emergency recovery shell\nclear\necho\necho Emergency recovery shell activated\necho\n\n\/bin\/sh<\/pre>\n

cmdline \u306b mmc0_led \u304c\u3042\u308b\u3068\u3001\u4f55\u304b green \u306b\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u306d\u3002\u7b50\u4f53\u306eLED \u3092\u7dd1\u306b\u3057\u3066\u3044\u308b\u3093\u3067\u3059\u304b\u306d\uff1f \u3042\u3068\u3067\u8a66\u3057\u3066\u307f\u307e\u3059\u3002vncinstall \u304c\u3042\u308b\u3068\u3001\u74b0\u5883\u5909\u6570QWS_DISPLAY\u306bVNC \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u30bb\u30c3\u30c8\u3055\u308c\u308b\u3088\u3046\u3067\u3059\u3002VNC \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u304b\u306d\u3002\u3042\u3068\u3067\u3001\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3002<\/p>\n

\u3061\u3087\u3063\u3068\u52c9\u5f37\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

berryboot \u306e\u4f5c\u308a\u3092\u3082\u3046\u5c11\u3057\u898b\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u8d77\u52d5\u3059\u308bboot img \u3092\u3070\u3089\u3057\u3066\u8997\u3044\u3066\u307f\u307e\u3057\u305f\u3002\u624b\u9806\u306f\u7d76\u5bfe\u5fd8\u308c\u308b\u306e\u3067\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059\u3002   \u4f5c\u696d\u306f\u3001osx \u3067\u3084\u3063\u3066\u3044\u307e\u3059\u3002 \u3068\u308a\u3042\u3048\u305a\u3001\u4f5c\u696d\u7528\u306bRAM\u30c7 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","footnotes":""},"categories":[69],"tags":[],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"JunkHack","author_link":"https:\/\/hack.gpl.jp\/author\/junkhack\/"},"uagb_comment_info":1,"uagb_excerpt":"berryboot \u306e\u4f5c\u308a\u3092\u3082\u3046\u5c11\u3057\u898b\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u8d77\u52d5\u3059\u308bboot img \u3092\u3070\u3089\u3057\u3066\u8997\u3044\u3066\u307f\u307e\u3057\u305f\u3002\u624b\u9806\u306f…","_links":{"self":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/857"}],"collection":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/comments?post=857"}],"version-history":[{"count":0,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/857\/revisions"}],"wp:attachment":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/media?parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/categories?post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/tags?post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}