RPI3

From DaqWiki
Jump to navigation Jump to search

Raspberry Pi3

Links

  • AAA

On-board hardware

  • AAA

Serial console

there is no useful serial console

Benchmarks

[root@armdaq05 ~]# uname -a
Linux armdaq05.triumf.ca 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l armv7l armv7l GNU/Linux
[root@armdaq05 ~]# cat /proc/cpuinfo 
processor	: 0
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 2
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 3
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

Hardware	: BCM2709
Revision	: a22082
Serial		: 00000000852ec765
[root@armdaq05 ~]# 
[root@armdaq05 ~]# ./memcpy_arm 
memcpy       1 KiBytes:    710 MB/sec
memcpy       2 KiBytes:   1037 MB/sec
memcpy       4 KiBytes:   1340 MB/sec
memcpy       8 KiBytes:   1572 MB/sec
memcpy      16 KiBytes:   1703 MB/sec
memcpy      32 KiBytes:   2010 MB/sec
memcpy      64 KiBytes:   1780 MB/sec
memcpy     128 KiBytes:   1808 MB/sec
memcpy     256 KiBytes:   1421 MB/sec
memcpy     512 KiBytes:    971 MB/sec
memcpy    1024 KiBytes:    862 MB/sec
memcpy    2048 KiBytes:    824 MB/sec
memcpy    4096 KiBytes:    862 MB/sec
memcpy    8192 KiBytes:    817 MB/sec
memcpy   16384 KiBytes:    797 MB/sec
memcpy   32768 KiBytes:    767 MB/sec
memcpy   65536 KiBytes:    765 MB/sec
memcpy  131072 KiBytes:    766 MB/sec
[root@armdaq05 ~]# 

Original boot files with the CentOS 7.1 userland

[root@armdaq05 ~]# blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="70F7-FA1D" TYPE="vfat" 
/dev/mmcblk0p2: LABEL="el7" UUID="0ca625c5-8db1-4f78-a9fd-e6cce04f399e" TYPE="ext4" 
/dev/mmcblk0: PTTYPE="dos" 
[root@armdaq05 ~]# 
[root@armdaq05 ~]# fdisk -l

Disk /dev/mmcblk0: 31.4 GB, 31439454208 bytes, 61405184 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x5a7089a1

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      137215       64512    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          137216     2713599     1288192   83  Linux
[root@armdaq05 ~]# 
[root@armdaq05 ~]# df -kl
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        1235136 1029272    125072  90% /
devtmpfs          469536       0    469536   0% /dev
tmpfs             473868       0    473868   0% /dev/shm
tmpfs             473868   29964    443904   7% /run
tmpfs             473868       0    473868   0% /sys/fs/cgroup
tmpfs              94776       0     94776   0% /run/user/0
/dev/mmcblk0p1     64456   21192     43264  33% /mnt/tmp
[root@armdaq05 ~]# 

Install Boot files

Original boot files are in /daq/daqshare/olchansk/RPI3/bootfs

  • use 32GB micro-SD flash
  • connect to USB-to-SD flash adapter, plug into linux computer
  • login as root
  • identify the /dev/sdXXX device corresponding to target media: use "fdisk -l", look for a 32GB disk with a single MS-DOS partition
  • ensure the partitions of /dev/sdXXX are not mounted, use "df -kl" and umount /dev/sdXXX1, etc.
  • run "fdisk /dev/sdXXX"
  • create MSDOS partition table: command "o"
  • create first partition 64Mbytes: command "n", primary "p", first sector "<enter>", last sector: "+64M"
  • set partition type "C": command "t", partition 1 is selected automatically, hex code "c"
  • mark bootable: command "a", partition 1 is selected automatically
  • confirm correct layout: command "p"
Disk /dev/sde: 31.1 GB, 31104958464 bytes, 60751872 sectors
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        2048      133119       65536    c  W95 FAT32 (LBA)
  • save new partition table: command "w", there should be no messages other than "syncing disks"
  • mkfs.msdos /dev/sdXXX1
  • mkdir -p /mnt/tmp
  • mount /dev/sdXXX1 /mnt/tmp, cd /mnt/tmp
  • rsync -av /daq/daqshare/olchansk/RPI3/bootfs/ .
  • sync
  • select boot method:
    • cp cmdline-mmcblk.txt cmdline.txt ### to boot from SD flash
    • cp cmdline-nfsroot.txt cmdline.txt ### to boot from network (dhcp and nfsroot)
  • sync
  • cd /; umount /mnt/tmp
  • eject /dev/sdXXX
  • try to boot from the SD flash - on HDMI video, should see Linux kernel boot all the way to a panic on failure to mount rootfs.

Install CentOS7 rootfs image

  • use bootable 32GB micro-SD flash
  • connect and identify /dev/sdXXX same as above
  • ensure all partitions are unmounted, same as above
  • create second partion of maximum size:
  • fdisk /dev/sdXXX
  • command "n", "p", enter, enter
  • command "p" to see the layout:
Disk /dev/sde: 31.1 GB, 31104958464 bytes, 60751872 sectors
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        2048      133119       65536    c  W95 FAT32 (LBA)
/dev/sde2          133120    60751871    30309376   83  Linux
  • command "w" to save the changes
  • if it complains about "Device or resource busy":
    • eject /dev/sdXXX
    • remove it from usb adapter
    • connect to usb adapter and identify device again, same as above
  • ls -l /dev/sdXXX* to see there are two partitions "1" and "2"
  • mkfs.ext4 /dev/sdXXX2
  • mkdir -p /mnt/tmp
  • mount /dev/sdXXX2 /mnt/tmp, cd /mnt/tmp
  • rsync -av /ladd/data0/backup.os/armdaq06/ .
  • e2label /dev/sdXXX2 el7
  • sync
  • cd /; umount /mnt/tmp
  • eject /dev/sdXXX
  • try to boot, should boot all the way to the login prompt.

Setup Python i2c tools

su - root
yum install python-setuptools.noarch
yum install python-cffi
yum install python-devel
cd git
git clone https://github.com/bivab/smbus-cffi.git
cd smbus-cffi
python setup.py install

Enable i2c drivers

(already done) edit boot config.txt, uncomment "dtparam=i2c_arm=on" and "dtparam=i2c1=on", reboot
echo modprobe i2c-dev >> /etc/rc.local
echo modprobe i2c_bcm2708 >> /etc/rc.local
ls -l /dev/i2c*
i2cdetect -l
i2cdetect 1
echo chmod a+wr /dev/i2c* >> /etc/rc.local
reboot, run i2cdetect again.

Script for creating boot files

~olchansk/git/scripts/clone/boot_rpi3.perl

End