So-net無料ブログ作成

Linuxのコンパイル2 [電子工作]

前回、Linuxをコンパイルしたのですが、DACのドライバが認識しなくて悩んでいたのですが、 buildrootの新しいのを使って再度コンパイルしてみました。
root@kuro:~/work# wget https://buildroot.uclibc.org/downloads/buildroot-2017.05.tar.gz
root@kuro:~/work# tar xvf buildroot-2017.05.tar.gz
root@kuro:~/work# cd buildroot-2017.05
設定の準備をします。
root@kuro:~/work/buildroot-2017.05# cp configs/raspberrypi_defconfig configs/raspberrypi1_defconfig
root@kuro:~/work/buildroot-2017.05# cp -r board/raspberrypi board/raspberrypi1
root@kuro:~/work/buildroot-2017.02.2$ vi configs/raspberrypi1_defconfig
-----
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi1/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi1/post-image.sh"
-----
root@kuro:~/work/buildroot-2017.05# cp board/raspberrypi1/genimage-raspberrypi.cfg board/raspberrypi1/genimage-raspberrypi1.cfg

root@kuro:~/work/buildroot-2017.05# vi board/raspberrypi1/genimage-raspberrypi1.cfg

-----
image boot.vfat {
  vfat {
    files = {
      "bcm2708-rpi-b.dtb",
      "bcm2708-rpi-b-plus.dtb",
      "bcm2708-rpi-cm.dtb",
      "rpi-firmware/bootcode.bin",
      "rpi-firmware/cmdline.txt",
      "rpi-firmware/config.txt",
      "rpi-firmware/fixup.dat",
      "rpi-firmware/start.elf",
      "zImage"
    }
  }
  size = 256M
}

image sdcard.img {
  hdimage {
  }

  partition boot {
    partition-type = 0xC
    bootable = "true"
    image = "boot.vfat"
  }

  partition rootfs {
    partition-type = 0x83
    image = "rootfs.ext4"
  }
}
-----
設定を行います。
root@kuro:~/work/buildroot-2017.05# make raspberrypi1_defconfig
root@kuro:~/work/buildroot-2017.05# make menuconfig
------
-----
Toolchain  --->
 custom toolchain vendor name
  kuro
 Custom kernel headers series (4.11.x)  --->
  (X) 4.10.x
 [*] Enable WCHAR support
System configuration  --->
 System hostname
  kuro
 System banner
  Welcome to Kuro
  /dev management (Dynamic using devtmpfs only)  --->
   (X) Dynamic using devtmpfs + mdev
 Root password
  root123
 Run a getty (login prompt) after boot  --->
  (console) TTY port
   ttyAMA0
  Baudrate (keep kernel default)  --->
   115200
 ()  Root filesystem overlay directories
  rootfs-overlay
Kernel  --->
 Kernel version (Custom Git repository)  --->
  (X) Custom Git repository
 (rpi-4.10.y) Custom repository version
  rpi-4.10.y
 Linux Kernel Tools  --->
  [*] gpio
Target packages  --->
 Audio and video applications  --->
 [*] alsa-utils  --->
  [*]   alsactl (NEW)
  [*]   alsamixer (NEW)
  [*]   aplay/arecord
 [*] ffmpeg  --->
  [*]   Enable GPL code
  [*]   Build ffmpeg (the command line application) (NEW)
  [*]   Enable input devices (NEW)
  [*]   Enable output devices (NEW)
  [*]   Build libavresample
 [*] flac
 [*] lame
 [*] mpd  --->
  [*]   libsamplerate
  [*]   libsoxr
  [*]   dsd
  [*]   ffmpeg
  [*]   flac
  [*]   lame
 [*] mpd-mpc
 [*] mplayer
 [*] Build and install mplayer (NEW)
Filesystem and flash utilities  --->
 [*] nfs-utils
  [*]   rpc.lockd
Interpreter languages and scripting  --->
 [*] python
Networking applications  --->
 [*] bluez-utils
  [*]   audio support
  [*]   USB support
  [*]   GATT support
 [*] dropbear
 [*] openssh
Filesystem images  --->
 [*] initial RAM filesystem linked into linux kernel
 [*] romfs root filesystem
-----
root@kuro:~/work/buildroot-2017.05# vi .config
-----
BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS=y
BR2_TARGET_ROOTFS_EXT2_BLOCKS=250000
------
今回の変更点は、カーネルを4.9から4.10へ、/devのマネジメントをmdevにしたところです。
設定を取っておきます。
root@kuro:~/work/buildroot-2017.05# cp .config build_config
Linuxの設定を行います。
root@kuro:~/work/buildroot-2017.05# make linux-menuconfig
-----
General setup  --->
 Default hostname
  kuro
 [ ] Support for paging of anonymous memory (swap)
 [*]   Support initial ramdisks compressed using gzip
 [ ]   Support initial ramdisks compressed using bzip2
 [ ]   Support initial ramdisks compressed using LZMA
 [ ]   Support initial ramdisks compressed using XZ
 [ ]   Support initial ramdisks compressed using LZO
 [ ]   Support initial ramdisks compressed using LZ4
Boot options  --->
 ()  Default kernel command string
   console=ttyAMA0,115200
[*] Networking support  --->
 Networking options  --->
  [ ] Network packet filtering framework (Netfilter)  ----
  < > Asynchronous Transfer Mode (ATM)
  < > Layer Two Tunneling Protocol (L2TP)  ----
  < > 802.1d Ethernet Bridging
  < > 802.1Q/802.1ad VLAN Support
  < > Appletalk protocol support
  < > Open vSwitch
  [ ] MultiProtocol Label Switching  ----
 [ ]   Amateur Radio support  ----
 < >   CAN bus subsystem support  ----
 < >   WiMAX Wireless Broadband support  ----
 < >   RF switch subsystem support  ----
 < >   Plan 9 Resource Sharing Support (9P2000)  ----
 < >   NFC subsystem support  ----
Device Drivers  --->
 [ ] Multiple devices driver support (RAID and LVM)  ----
 [*] Network device support  --->
  < >     Bonding driver support
  < >     Dummy net driver support
  < >     MAC-VLAN support
  < >     IP-VLAN support
  < >     Virtual eXtensible Local Area Network (VXLAN)
  < >     Universal TUN/TAP device driver support
  < >     Virtual ethernet pair device
  < >   PPP (point-to-point protocol) support
  < >   SLIP (serial line) support
  < >   IEEE 802.15.4 drivers  ----
  Multimedia support  --->
  [ ]   Analog TV support
  [ ]   Digital TV support
  [ ]   AM/FM radio receivers/transmitters support
Graphics support  --->
 [ ] Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  ----
 [ ] Bootup logo  ----
 [*] USB support  --->
  < >     Synopsis DWC host support
  < >     USB Printer support
  < >       Realtek Card Reader support
  < >       Datafab Compact Flash Reader support
  < >       Freecom USB/ATAPI Bridge support
  < >       ISD-200 USB/ATA Bridge support
  < >       USBAT/USBAT02-based storage support
  < >       SanDisk SDDR-09 (and other SmartMedia, including DPCM) support
  < >       SanDisk SDDR-55 SmartMedia support
  < >       Lexar Jumpshot Compact Flash Reader
  < >       Olympus MAUSB-10/Fuji DPC-R1 support
  < >       Support OneTouch Button on Maxtor Hard Drives
  < >       Support for Rio Karma music player
  < >       SAT emulation on Cypress USB/ATA Bridge with ATACB
  < >       USB ENE card reader support
  < >     USB Mustek MDC800 Digital Camera support
  < >     Microtek X6USB scanner support
  < >   DesignWare USB2 DRD Core Support
  < >   ADU devices from Ontrak Control Systems
  < >   USB 7-Segment LED Display
  < >   USB Diamond Rio500 support
  < >   USB Lego Infrared Tower support
  < >   USB LCD driver support
  < >   USB LED driver support
  < >   Cypress CY7C63xxx USB driver support
  < >   Cypress USB thermometer driver support
  < >   Siemens ID USB Mouse Fingerprint sensor support
  < >   Elan PCMCIA CardBus Adapter USB Client
  < >   Apple Cinema Display support
  < >   USB LD driver
  < >   PlayStation 2 Trance Vibrator driver support
  < >   IO Warrior driver support
  < >   USB testing driver
  < >   iSight firmware loading support
  < >   USB YUREX driver support
  < >   USB Gadget Support  ----
 < > Industrial I/O support  ----
-----
Linuxの設定はXFree86 4.1.0のマネージャを切ったことです。
独自に設定を格納するためのディレクトリを作成します。
root@kuro:~/work/buildroot-2017.05# mkdir -p rootfs-overlay/etc
root@kuro:~/work/buildroot-2017.05# mkdir -p rootfs-overlay/var/lib/mpd
root@kuro:~/work/buildroot-2017.05# vi rootfs-overlay/etc/asound.conf
------
pcm.!default  {
 type hw card 0
}
ctl.!default {
 type hw card 0
}
------
コンパイルします。
root@kuro:~/work/buildroot-2017.05# make -j40
コンパイルできた後、一旦できたファイルを削除します。
rm output/build/linux-rpi-4.10.y/arch/arm/boot/zImage
rm output/images/rootfs.*
rm output/images/sdcard.img
rm output/images/boot.vfat
rm output/images/zImage
設定ファイルをコピーします。
root@kuro:~/work/buildroot-2017.05# cp output/target/etc/mdev.conf ootfs-overlay/etc
以下を追加します。
#network interface 
(eth.*)         root:netdev 660 >net/%1 @/sbin/ifup $INTERFACE
再度コンパイルします。
root@kuro:~/work/buildroot-2017.05# make
コンパイルしたものをWindowsへもっていく準備をします。
root@kuro:~/work$ mkdir image
root@kuro:~/work$ mkdir config
root@kuro:~/work$ cd config
root@kuro:~/work/config# vi cmdline.txt
-----
console=ttyAMA0,115200
-----
root@kuro:~/work/config# vi config.txt
-----
kernel=zImage
#initramfs rootfs.cpio.gz
disable_overscan=1
# gpu_mem_256=100
# gpu_mem_512=100
# gpu_mem_1024=100
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtoverlay=hifiberry-dac
-----
root@kuro:~/work/config# cd ../image
イメージを持ってきます。
cp ../buildroot-2017.05/output/images/zImage .
cp ../buildroot-2017.05/output/images/bcm2708-rpi-b-plus.dtb .
cp -r ../buildroot-2017.05/output/images/rpi-firmware/* .
cp ../buildroot-2017.05/output/images/rootfs.romfs .
cp ../config/* .
Windowsへもっていき、FATでフォーマットしたSDカードにコピーして出来上がりです。
root@kuro:~/work/image# ls
bcm2708-rpi-b-plus.dtb  cmdline.txt  fixup.dat  rootfs.romfs  zImage
bootcode.bin            config.txt   overlays   start.elf

nice!(0)  コメント(0)  トラックバック(0) 

nice! 0

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

トラックバック 0