Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
NetBSD workshop
Jun Ebihara
jun@soum.co.jp
jun@netbsd.org
OverView in 4hours
● Install NetBSD/amd64 on VirtualBox
– Make earmv6hf cross-compiling toolchain
– Make RPI kernel
● Inst...
Hardwares
● Windows 10 PC with VirtualBox
● Raspberry PI
– MicroSD Card: Over 4GB class 10
– HDMI Display
– USB Keyboard/m...
Pre-Downloading
● NetBSD-7.1.amd64.iso
● src.tar.gz
● VirtualBox
● Rawrite32.exe
● RPI Image
– 2017-07-15-netbsd-earmv6hf....
VirtualBox
● NetBSD on VirtualBox
– Assign 2GB mem: Disk 10GB
● NetBSD-7.1-amd64.iso
● Set NetBSD source on /usr/src
– cd ...
NetBSD RPI Image
● on Windows
● http://cdn.netbsd.org/pub/NetBSD/misc/jun/raspberry-
pi/2017-07-15-earmv6hf/2017-07-15-net...
Using RPI image
● Login: root
● startx
● medit
● mikutter
● mlterm-fb
● omxplayer & youtube-dl
– pkg_add omxplayer
– pkg_a...
PaX
● Some application exec failed on starting
● sysctl -a |grep pax
– security.pax.mprotect.enabled = 1
– security.pax.mp...
NTP time setting
● ntpq -p
● /etc/rc.d/ntpd stop
● /etc/rc.d/ntpdate start
● /etc/rc.d/ntpd start
● ntpq -p
Reboot and / mount failed
● Power supply cut down failure
– make file system damaged
● Reboot but / read only access
● dro...
RPI:/boot
● Kernel
– kernel.img – kernel for RPI0/1
– kernel7.img – kernel for RPI2/3
● cmdline.txt
– root=ld0a console=fb...
/etc/rc.conf
● rc_configred=YES
● sshd=YES
● ntpd=YES
● hostname=nandemoii
NetBSD source
● dhcpcd
● ftp
http://cdn.netbsd.org/pub/NetBSD/NetBSD-current
/tar_files/src.tar.gz
● tar xzvf src.tar.gz
●...
Kernel cross build for RPI2
● cd /usr/src
● ./build.sh -u -U -m evbarm -a earmv6hf tools
● ./build.sh -u -U -m evbarm -a e...
Kernel cross build for KOBO
● cd /usr/src
● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf
tools
● ./build.sh -j 6 -u -U -m e...
Kernel cross build for NetWalker
● cd /usr/src
● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf
tools
● ./build.sh -j 6 -u -U...
Kernel cross build for earmv4
● cd /usr/src
● ./build.sh -j 6 -u -U -m hpcarm tools
● ./build.sh -j 6 -u -U -m hpcarm kern...
Kernel cross build for mipsel
● cd /usr/src
● ./build.sh -j 6 -u -U -m hpcmips tools
● ./build.sh -j 6 -u -U -m hpcmips ke...
Kernel cross build for sh3
● cd /usr/src
● ./build.sh -j 6 -u -U -m hpcsh tools
● ./build.sh -j 6 -u -U -m hpcsh kernel=GE...
Kernel cross build for sh4
● cd /usr/src
● ./build.sh -j 6 -u -U -m dreamcast tools
● ./build.sh -j 6 -u -U -m dreamcast
k...
Paths
● /etc/mk.conf
● /usr/src
– obj → ln -s /usr/obj
● tooldir.NetBSD-8.99.1-amd64
– bin/nbmake-hpcmips
● destdir.hpcmip...
CVS update
● cd /usr/src
● script 20170810.log
● cvs update -Pad
● exit
● grep -v Updating 20170810.log |more
MediaTek MT7620
● ELECOM WRH-300CR
● http://pastebin.com/n05jnhjs
● NetBSD/evbmips:
● /usr/src/sys/arch/evbmips/conf
● gre...
Kernel cross build for MT7620
● cd /usr/src
● ./build.sh -j 6 -u -U -m evbmips -a mipsel tools
● ./build.sh -j 6 -u -U -m ...
OrangePI
● Allwinnler H
● earmv7hf
● https://github.com/jaredmcneill/netbsd-arm-
docs/wiki/Allwinner
Kernel cross build for OrangePI
● cd /usr/src
● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf
tools
● ./build.sh -j 6 -u -U ...
Uboot
● Armbian
– https://github.com/ebijun/NetBSD/blob/master/sunxi/u-boot
/Makefile
– apt-get install binutils-arm-none-...
dmesg
● https://github.com/ebijun/NetBSD/tree/master/
dmesg
● http://dmesgd.nycbug.org/index.cgi
Upcoming SlideShare
Loading in …5
×

NetBSD workshop

562 views

Published on

4 hour NetBSD kernel compile tutorial

Published in: Software
  • Be the first to comment

NetBSD workshop

  1. 1. NetBSD workshop Jun Ebihara jun@soum.co.jp jun@netbsd.org
  2. 2. OverView in 4hours ● Install NetBSD/amd64 on VirtualBox – Make earmv6hf cross-compiling toolchain – Make RPI kernel ● Install NetBSD/earmv6hf on RPI – Play RPI with NetBSD – Feel difference between your favorite environment ● Copy your RPI kernel to RPI – Update NetBSD-current kernel ● Boot RPI with your cross-compiled kernel
  3. 3. Hardwares ● Windows 10 PC with VirtualBox ● Raspberry PI – MicroSD Card: Over 4GB class 10 – HDMI Display – USB Keyboard/mouse – USB power supply – Ethernet Cable ● Internet access via Ethernet Cable – RPI get IP address via DHCP – RPI set time via NTP
  4. 4. Pre-Downloading ● NetBSD-7.1.amd64.iso ● src.tar.gz ● VirtualBox ● Rawrite32.exe ● RPI Image – 2017-07-15-netbsd-earmv6hf.img.gz or newer – http://cdn.netbsd.org/pub/NetBSD/misc/jun/raspberry-pi – http://mail-index.netbsd.org/port-arm/2017/07/13/msg004307.html – https://github.com/ebijun/NetBSD/blob/master/RPI/RPIimage/READ ME
  5. 5. VirtualBox ● NetBSD on VirtualBox – Assign 2GB mem: Disk 10GB ● NetBSD-7.1-amd64.iso ● Set NetBSD source on /usr/src – cd /usr – ftp http://cdn.netbsd.org/pub/NetBSD/NetBSD-current/tar_files/src.tar .gz – tar xzvf src.tar.gz
  6. 6. NetBSD RPI Image ● on Windows ● http://cdn.netbsd.org/pub/NetBSD/misc/jun/raspberry- pi/2017-07-15-earmv6hf/2017-07-15-netbsd-raspi- earmv6hf.img.gz ● http://www.netbsd.org/~martin/rawrite32/download.html ● Use rawrite32 to write RPI image to microSD ● Connect RPI: ● Boot ● Wait 15 min to resize partition
  7. 7. Using RPI image ● Login: root ● startx ● medit ● mikutter ● mlterm-fb ● omxplayer & youtube-dl – pkg_add omxplayer – pkg_add youtube-dl
  8. 8. PaX ● Some application exec failed on starting ● sysctl -a |grep pax – security.pax.mprotect.enabled = 1 – security.pax.mprotect.global = 1 – security.pax.mprotect.ptrace = 1 – security.pax.mprotect.debug = 1 – security.pax.segvguard.enabled = 1 – security.pax.segvguard.global = 1 ● Loooose protection: (bad manner) – sysctl -w security.pax.mprotect.enabled=0
  9. 9. NTP time setting ● ntpq -p ● /etc/rc.d/ntpd stop ● /etc/rc.d/ntpdate start ● /etc/rc.d/ntpd start ● ntpq -p
  10. 10. Reboot and / mount failed ● Power supply cut down failure – make file system damaged ● Reboot but / read only access ● drop on single usermode – df – fsck /dev/ld0a – reboot ● /etc/fstab – add “log,noatime” – man 5 fstab
  11. 11. RPI:/boot ● Kernel – kernel.img – kernel for RPI0/1 – kernel7.img – kernel for RPI2/3 ● cmdline.txt – root=ld0a console=fb – Add -s to boot single user mode ● config.txt – http://elinux.org/RPiconfig – hdmi_group=2 – hdmi_mode=16
  12. 12. /etc/rc.conf ● rc_configred=YES ● sshd=YES ● ntpd=YES ● hostname=nandemoii
  13. 13. NetBSD source ● dhcpcd ● ftp http://cdn.netbsd.org/pub/NetBSD/NetBSD-current /tar_files/src.tar.gz ● tar xzvf src.tar.gz ● mv src /usr/src ● mkdir /usr/obj
  14. 14. Kernel cross build for RPI2 ● cd /usr/src ● ./build.sh -u -U -m evbarm -a earmv6hf tools ● ./build.sh -u -U -m evbarm -a earmv6hf kernel=RPI2 ● Copy netbsd.bin to /boot/kernel7.img ● objdump -D netbsd.bin ● Copy netbsd.bin to RPI:/boot/kernel7.img ● Set over 2GB mem for VirtualBox,if failed
  15. 15. Kernel cross build for KOBO ● cd /usr/src ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf tools ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf kernel=KOBO ● Copy netbsd.bin to /boot/kernel7.img ● objdump -D netbsd.bin
  16. 16. Kernel cross build for NetWalker ● cd /usr/src ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf tools ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf kernel=NETWALKER ● Copy netbsd.bin to /boot/kernel7.img ● objdump -D netbsd.bin
  17. 17. Kernel cross build for earmv4 ● cd /usr/src ● ./build.sh -j 6 -u -U -m hpcarm tools ● ./build.sh -j 6 -u -U -m hpcarm kernel=WZERO3 ● Copy netbsd to MSDOS partition ● Copy /usr/src/sys/arch/hpc/stand/binary/ARM/hpcboot.exe.uue ● Uudecode hpcboot.exe.uue ● objdump -D netbsd
  18. 18. Kernel cross build for mipsel ● cd /usr/src ● ./build.sh -j 6 -u -U -m hpcmips tools ● ./build.sh -j 6 -u -U -m hpcmips kernel=GENERIC ● Copy netbsd to MSDOS partition ● Copy /usr/src/sys/arch/hpc/stand/binary/MIPS/hpcboot.exe.uue ● Uudecode hpcboot.exe.uue ● objdump -D netbsd
  19. 19. Kernel cross build for sh3 ● cd /usr/src ● ./build.sh -j 6 -u -U -m hpcsh tools ● ./build.sh -j 6 -u -U -m hpcsh kernel=GENERIC ● Copy netbsd to MSDOS partition ● Copy /usr/src/sys/arch/hpc/stand/binary/SH3/hpcboot.exe.uue ● uudecode hpcboot.exe.uue ● objdump -D netbsd
  20. 20. Kernel cross build for sh4 ● cd /usr/src ● ./build.sh -j 6 -u -U -m dreamcast tools ● ./build.sh -j 6 -u -U -m dreamcast kernel=GENERIC ● objdump -D netbsd
  21. 21. Paths ● /etc/mk.conf ● /usr/src – obj → ln -s /usr/obj ● tooldir.NetBSD-8.99.1-amd64 – bin/nbmake-hpcmips ● destdir.hpcmips ● releasedir – sys/arch/hpcmips/ ● conf/GENERIC ● compile/obj/GENERIC/netbsd ● compile/obj/GENERIC/netbsd.bin ● compile/obj/GENERIC/netbsd.ub
  22. 22. CVS update ● cd /usr/src ● script 20170810.log ● cvs update -Pad ● exit ● grep -v Updating 20170810.log |more
  23. 23. MediaTek MT7620 ● ELECOM WRH-300CR ● http://pastebin.com/n05jnhjs ● NetBSD/evbmips: ● /usr/src/sys/arch/evbmips/conf ● grep MT7620 – ZYXELKX
  24. 24. Kernel cross build for MT7620 ● cd /usr/src ● ./build.sh -j 6 -u -U -m evbmips -a mipsel tools ● ./build.sh -j 6 -u -U -m evbmips -a mipsel kernel=ZYXELKX ● objdump -D netbsd
  25. 25. OrangePI ● Allwinnler H ● earmv7hf ● https://github.com/jaredmcneill/netbsd-arm- docs/wiki/Allwinner
  26. 26. Kernel cross build for OrangePI ● cd /usr/src ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf tools ● ./build.sh -j 6 -u -U -m evbarm -a earmv7hf kernel=SUNXI ● https://github.com/jaredmcneill/netbsd-arm- docs/wiki/Allwinner ● objdump -D netbsd.bin
  27. 27. Uboot ● Armbian – https://github.com/ebijun/NetBSD/blob/master/sunxi/u-boot /Makefile – apt-get install binutils-arm-none-eabi – apt-get install gcc-arm-none-eabi – apt-get install swig libpython-dev – make ${BOARD}_defconfig;make ● pkgsrc/sysutils/u-boot-orangepi-plus2e ● dd if=u-boot-sunxi-with-spl.bin of=imagefile bs=1024 seek=8 conv=sync
  28. 28. dmesg ● https://github.com/ebijun/NetBSD/tree/master/ dmesg ● http://dmesgd.nycbug.org/index.cgi

×