====== Getting started with BeagleBoneBlack ====== Interesting links: * http://eewiki.net/display/linuxonarm/BeagleBone+Black * http://blog.logikonlabs.com/how-to-create-a-custom-microsd-card-image-for-the-beaglebone-black/ * http://www.crashcourse.ca/wiki/index.php/Minimal_scratch_build_for_BBB Toolchain from Linaro: arm-linux-gnueabihf-gcc (GCC 4.8.3) ===== U-Boot ===== The BeagleBoneBlack is fully supported in mainline U-Boot (currently tested with U-Boot 2014.04) make O=bbb CROSS_COMPILE=arm-linux-gnueabihf am335x_boneblack_config make O=bbb CROSS_COMPILE=arm-linux-gnueabihf * ''O='' specifices the output build directory * This will generate MLO and u-boot.img under ''bbb/'' ===== Bootable microSD ===== Make two partitions: * boot partition: FAT16, starting at offset 1MB, for MLO, u-boot.img and kernel zImage * linux partion: ext3 for rootfs > :!: Before running below commands be sure of which device is your to-be-formatted microSD card. In this example we take ''/dev/sdd'' . You might loose data if you run the wrong command! sudo sfdisk --in-order --Linux --unit M /dev/sdd << EOF 1,48,0xE,* ,,,- EOF Format the first partition in FAT16 for boot sudo mkfs.vfat -F 16 /dev/sdd1 -n boot Format the second in EXT3 for the root filesystem sudo mkfs.ext3 /dev/sdd2 -L rootfs and untar the generated filesystem: sudo tar -xvzf rootfs.tar.gz /mnt/rootfs or write the complete second partition with the rootfs image produced by buildroot (no formatting is necessary in this case, but only a part of the remaining SD space will be available). sudo dd -if=rootfs.ext2 -of=/dev/sdd2 ===== Write to on-board eMMC ==== eMMC is already partitionned in /dev/mmcblk1p1 and /dev/mmcblk1p2. You need a running system to reprogram the on-board eMMC. Create three partitions as follows (note the first bootable DOS partition) with fdisk Device Boot Start End Blocks Id System /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA) /dev/mmcblk1p2 3105 18730 500032 83 Linux /dev/mmcblk1p3 18731 34356 500032 83 Linux # fdisk /dev/mmcblk1 The number of cylinders for this disk is set to 118016. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p Disk /dev/mmcblk1: 3867 MB, 3867148288 bytes 4 heads, 16 sectors/track, 118016 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA) /dev/mmcblk1p2 3105 118016 3677184 83 Linux Command (m for help): d Partition number (1-4): 1 Command (m for help): d Selected partition 2 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-118016, default 1): 33 Last cylinder or +size or +sizeM or +sizeK (33-118016, default 118016): 3104 Command (m for help): a Partition number (1-4): 1 Command (m for help): t Selected partition 1 Hex code (type L to list codes): e Changed system type of partition 1 to e (Win95 FAT16 (LBA)) Command (m for help): p Disk /dev/mmcblk1: 3867 MB, 3867148288 bytes 4 heads, 16 sectors/track, 118016 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (1-118016, default 1): 3105 Last cylinder or +size or +sizeM or +sizeK (3105-118016, default 118016): +512M Command (m for help): p Disk /dev/mmcblk1: 3867 MB, 3867148288 bytes 4 heads, 16 sectors/track, 118016 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA) /dev/mmcblk1p2 3105 18730 500032 83 Linux Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (1-118016, default 1): 18731 Last cylinder or +size or +sizeM or +sizeK (18731-118016, default 118016): +512M Command (m for help): p Disk /dev/mmcblk1: 3867 MB, 3867148288 bytes 4 heads, 16 sectors/track, 118016 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk1p1 * 33 3104 98304 e Win95 FAT16 (LBA) /dev/mmcblk1p2 3105 18730 500032 83 Linux /dev/mmcblk1p3 18731 34356 500032 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table # Mount the partitions so that you can copy content to it: mkdir -p /mnt/emmc-boot mkdir -p /mnt/emmc-rootfsA mount -t vfat /dev/mmcblk1p1 /mnt/emmc-boot/ umount /mnt/emmc-boot/ mkfs.vfat /dev/mmcblk1p1 mkfs.ext2 /dev/mmcblk1p2 mount -t vfat /dev/mmcblk1p1 /mnt/emmc-boot/ mount -t ext2 /dev/mmcblk1p2 /mnt/emmc-rootfsA/ Copy MLO, u-boot.img and uEnv.txt (in this order) to the partition. This can be done directly from your host via scp: scp MLO root@192.168.1.4:/mnt/emmc-boot/MLO scp u-boot.img uEnv.txt root@192.168.1.4:/mnt/emmc-boot/ Extract the rootfs image to the target and write it to the second partition scp rootfs.tar root@192.168.1.4:/tmp/rootfs.tar rm -rf /mnt/emmc-rootfsA/* tar xvf /tmp/rootfs.tar -C /mnt/emmc-rootfsA/ sync ===== Enable UARTs ==== Be sure BB-BONELT-HDMI is not autoloaded. In uEnv.txt add: optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN Load Device Tree overlays for UARTs echo BB-UART1 > /sys/devices/bone_capemgr.9/slots echo BB-UART4 > /sys/devices/bone_capemgr.9/slots echo BB-UART5 > /sys/devices/bone_capemgr.9/slots Set the baudrate on the command line: stty -F /dev/ttyO1 115200 ===== Remote debugging ===== Run gdbserver on target: # gdbserver :1234 helloworld Start the cross-gdb on host (with ddd as frontend): ddd --debugger arm-linux-gnueabihf-gdb --eval-command="target remote 192.168.1.4:1234" helloworld ===== 3G modem ===== Enable USB support in kernel: Device Drivers --> USB Support --> <*> Support for Host-side USB Device Drivers --> USB Support --> <*> USB Mass Storage support Device Drivers --> USB Support --> <*> Platform Glue Layer (TI DSPS platforms) Enable PPP interface with usb_modeswitch (for Huawei E303) : usb_modeswitch -v 0x12d1 -p 0x1f01 -V 0x12d1 -P 0x14dc -M "55534243123456780000000000000a11062000000000000100000000000000"