Previous posts for this project:
Introduction
Last week, I received my Beaglebone Black and my first order from the budget containing accessoires for the BBB. I've used the BBB before, in the Beaglebone Black Radio Challenge. Since then, Debian has become available which should simplify things on the software side (as opposed to using Angstrom).
The parts used in this post are the following:
- 7 inch LCD Display Cape7 inch LCD Display Cape
- Beaglebone BlackBeaglebone Black
- USB Wifi DongleUSB Wifi Dongle
- Power Supply 5V 4APower Supply 5V 4A
- Power Cord EUPower Cord EU
- MicroSD Card 8GbMicroSD Card 8Gb
Let's get started!
Preparing the SD card
First thing I did was to prepare the SD card.
To have more space available, I decided to run Debian from the 8Gb SD card instead of burning it to the built-in storage of 4Gb.
On BeagleBoard.org - latest-images , there are two different Debian images. One for running from the SD card and one to flash the built-in memory. I picked the first one.
I downloaded the image and unpacked it. Next, I inserted the SD card in my laptop and flashed it with the Debian image.
To avoid accidentally erasing the wrong disk, I first listed them:
Fredericks-MacBook-Air:Downloads fvan1$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *251.0 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_CoreStorage 250.1 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_HFS Macintosh HD *249.8 GB disk1 Logical Volume on disk0s2 5642627E-CEC4-458D-AB8D-376EF3FB568C Unencrypted /dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *137.0 MB disk2 1: Apple_partition_map 32.3 KB disk2s1 2: Apple_HFS VirtualBox 137.0 MB disk2s2 /dev/disk3 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *7.9 GB disk3 1: DOS_FAT_32 7.9 GB disk3s1
I then unmounted the SD card:
Fredericks-MacBook-Air:Downloads fvan1$ diskutil unmountDisk /dev/disk3 Unmount of all volumes on disk3 was successful
And finally, I wrote the image to the card using "dd":
Fredericks-MacBook-Air:Downloads fvan1$ sudo dd if=bone-debian-7.5-2014-05-14-2gb.img of=/dev/disk3 bs=1m WARNING: Improper use of the sudo command could lead to data loss or the deletion of important system files. Please double-check your typing when using sudo. Type "man sudo" for more information. To proceed, enter your password, or type Ctrl-C to abort. Password: 1700+0 records in 1700+0 records out 1782579200 bytes transferred in 1069.609160 secs (1666571 bytes/sec)
After that, I inserted the SD card in the Beaglebone black and booted it. I connected a USB cable for networking, in order to be able to SSH into the BBB.
The default credentials are "debian"/"temppwd".
Fredericks-MacBook-Air:Downloads fvan1$ ssh debian@192.168.7.2 Debian GNU/Linux 7 BeagleBoard.org BeagleBone Debian Image 2014-05-14 Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian debian@192.168.7.2's password: debian@beaglebone:~$
The BBB booted correctly and was accessible via SSH. I verified the space available and noticed the 8Gb were not fully used.
That's because the image is meant for a 2Gb built-in memory or SD card.
debian@beaglebone:~$ df -h Filesystem Size Used Avail Use% Mounted on rootfs 1.6G 1.5G 1.2M 100% / udev 10M 0 10M 0% /dev tmpfs 100M 640K 99M 1% /run /dev/mmcblk0p2 1.6G 1.5G 1.2M 100% / tmpfs 249M 0 249M 0% /dev/shm tmpfs 249M 0 249M 0% /sys/fs/cgroup tmpfs 100M 0 100M 0% /run/user tmpfs 5.0M 0 5.0M 0% /run/lock /dev/mmcblk0p1 96M 70M 27M 73% /boot/uboot /dev/mmcblk1p2 3.4G 1.4G 1.9G 42% /media/rootfs /dev/mmcblk1p1 96M 72M 25M 75% /media/boot
Expanding the filesystem
In order to fully utilise the SD card, the filesystem needs to be expanded. Instructions are provided online: Beagleboard:BeagleBoneBlack Debian - eLinux.org
debian@beaglebone:/opt/scripts/tools$ sudo ./grow_partition.sh Media: [/dev/mmcblk0] Disk /dev/mmcblk0: 239904 cylinders, 4 heads, 16 sectors/track Old situation: Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End MiB #blocks Id System /dev/mmcblk0p1 * 1 96 96 98304 e W95 FAT16 (LBA) start: (c,h,s) expected (32,0,1) found (0,32,33) end: (c,h,s) expected (1023,3,16) found (12,93,17) /dev/mmcblk0p2 97 1699 1603 1641472 83 Linux start: (c,h,s) expected (1023,3,16) found (12,93,18) end: (c,h,s) expected (1023,3,16) found (216,183,31) /dev/mmcblk0p3 0 - 0 0 0 Empty /dev/mmcblk0p4 0 - 0 0 0 Empty New situation: Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End MiB #blocks Id System /dev/mmcblk0p1 * 1 96 96 98304 e W95 FAT16 (LBA) /dev/mmcblk0p2 97 7496 7400 7577600 83 Linux /dev/mmcblk0p3 0 - 0 0 0 Empty /dev/mmcblk0p4 0 - 0 0 0 Empty Successfully wrote the new partition table Re-reading the partition table ... BLKRRPART: Device or resource busy The command to re-read the partition table failed. Run partprobe(8), kpartx(8) or reboot your system now, before using mkfs If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 (See fdisk(8).)
The last step generated an error, stating the device or resource is busy. I tried rebooting, but that didn't help.
I then came across this discussion: https://groups.google.com/forum/#!msg/beagleboard/lJ8RWGzXebc/X_jMKTICRSwJ
As mentioned in one of the comments, I executed the following command:
debian@beaglebone:/opt/scripts/tools$ sudo resize2fs /dev/mmcblk0p2 resize2fs 1.42.5 (29-Jul-2012) Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk0p2 is now 1894400 blocks long.
Et voila, more space!
debian@beaglebone:~$ df -h Filesystem Size Used Avail Use% Mounted on rootfs 7.1G 1.5G 5.4G 22% / udev 10M 0 10M 0% /dev tmpfs 100M 644K 99M 1% /run /dev/mmcblk0p2 7.1G 1.5G 5.4G 22% / tmpfs 249M 0 249M 0% /dev/shm tmpfs 249M 0 249M 0% /sys/fs/cgroup tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 100M 0 100M 0% /run/user /dev/mmcblk0p1 96M 70M 27M 73% /boot/uboot /dev/mmcblk1p2 3.4G 1.4G 1.9G 42% /media/rootfs /dev/mmcblk1p1 96M 72M 25M 75% /media/boot
Setting up Wifi
Wifi was really easy to set up.
I connected the USB dongle, and SSH'ed into the BBB. Listing the current network interfaces, wifi is not one of them:
debian@beaglebone:~$ ip -4 a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN inet 127.0.0.1/8 scope host lo 4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
Wifi can be enabled by editing the interfaces file, just like on the Raspberry Pi.
debian@beaglebone:~$ sudo nano /etc/network/interfaces ... # WiFi Example auto wlan0 iface wlan0 inet dhcp wpa-ssid "ssid" wpa-psk "password" ...
After editing the file and saving the changes, I restarted the networking.
debian@beaglebone:~$ sudo /etc/init.d/networking restart [....] Restarting networking (via systemctl): networking.service . ok
That's it, that's all there is to it. Wifi is now running on the BBB.
debian@beaglebone:~$ ip -4 a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN inet 127.0.0.1/8 scope host lo 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 inet 192.168.0.135/24 brd 192.168.0.255 scope global wlan0 4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
Configuring for BB View
Finally, I decided to use a touch screen on the BBB for my project.
The steps are rather straightforward and properly documented in the BB View user manual. Here's a summary of what I did.
First, I dowloaded the patch files available on element14: element14: BB View LCD Cape Software Download Centre[1]
After downloading, I extracted the files and copied them over to the BBB via SCP.
Fredericks-MacBook-Air:BB VIEW Debian Image fvan1$ scp * debian@192.168.0.135:bbview/ Debian GNU/Linux 7 BeagleBoard.org BeagleBone Debian Image 2014-05-14 Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian debian@192.168.0.135's password: am335x-boneblack-lcd4.dtb 100% 23KB 23.2KB/s 00:00 am335x-boneblack-lcd7.dtb 100% 23KB 23.2KB/s 00:00 am335x-boneblack.dtb 100% 23KB 23.2KB/s 00:00 kernel_modules.tar.gz 100% 34MB 8.6MB/s 00:04 xorg.conf 100% 564 0.6KB/s 00:00 zImage 100% 4243KB 4.1MB/s 00:00
After that, it was just following instructions to put the patch files in the correct locations:
debian@beaglebone:~/bbview$ sudo cp -f zImage /boot/uboot debian@beaglebone:~/bbview$ sudo cp -f *.dtb /boot/uboot/dtbs/ debian@beaglebone:~/bbview$ sudo tar -xvzf kernel_modules.tar.gz -C / debian@beaglebone:~/bbview$ sudo cp -f xorg.conf /etc/X11/ debian@beaglebone:~/bbview$ sudo sync debian@beaglebone:~/bbview$ cd /boot/uboot/dtbs debian@beaglebone:/boot/uboot/dtbs$ sudo cp am335x-boneblack-lcd7.dtb am335x-boneblack.dtb debian@beaglebone:/boot/uboot/dtbs$ sudo sync debian@beaglebone:/boot/uboot/dtbs$ sudo reboot
Result
Tadaaaa, the Beaglebone Black is working with Wifi and LCD touch screen!
Top Comments