User Tools

Site Tools


beagleboneblack

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
beagleboneblack [2014/10/20 21:49]
damien [Bootable microSD]
beagleboneblack [2018/05/22 10:33] (current)
Line 1: Line 1:
 +====== 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)
 +
 +<​code>​
 +make O=bbb CROSS_COMPILE=arm-linux-gnueabihf am335x_boneblack_config
 +make O=bbb CROSS_COMPILE=arm-linux-gnueabihf
 +</​code>​
 +
 +  * ''​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!
 +
 +<​code>​
 +sudo sfdisk --in-order --Linux --unit M /dev/sdd << EOF
 +1,48,0xE,*
 +,,,-
 +EOF
 +</​code>​
 +
 +Format the first partition in FAT16 for boot
 +<​code>​
 +sudo mkfs.vfat -F 16 /dev/sdd1 -n boot
 +</​code>​
 +
 +Format the second in EXT3 for the root filesystem
 +<​code>​
 +sudo mkfs.ext3 /dev/sdd2 -L rootfs
 +</​code>​
 +and untar the generated filesystem:
 +<​code>​
 +sudo tar -xvzf rootfs.tar.gz /mnt/rootfs
 +</​code>​
 +
 +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).
 +<​code>​
 +sudo dd -if=rootfs.ext2 -of=/​dev/​sdd2
 +</​code>​
 +
 +===== 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
 +<​code>​
 +        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
 +</​code>​
 +
 +<​code>​
 +# 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
 +
 +
 +</​code>​
 +
 +Mount the partitions so that you can copy content to it:
 +
 +<​code>​
 +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/​
 +</​code>​
 +
 +Copy MLO, u-boot.img and uEnv.txt (in this order) to the partition. This can be done directly from your host via scp:
 +<​code>​
 +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/​
 +</​code>​
 +
 +Extract the rootfs image to the target and write it to the second partition
 +<​code>​
 +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
 +</​code>​
 +
 +===== Enable UARTs ====
 +
 +Be sure BB-BONELT-HDMI is not autoloaded. In uEnv.txt add:
 +<​code>​
 +optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,​BB-BONELT-HDMIN
 +</​code>​
 +
 +Load Device Tree overlays for UARTs
 +<​code>​
 +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
 +</​code>​
 +
 +Set the baudrate on the command line:
 +<​code>​
 +stty -F /dev/ttyO1 115200
 +</​code>​
 +
 +===== Remote debugging =====
 +
 +Run gdbserver on target:
 +<​code>​
 +# gdbserver :1234 helloworld
 +</​code>​
 +
 +Start the cross-gdb on host (with ddd as frontend):
 +<​code>​
 +ddd --debugger arm-linux-gnueabihf-gdb --eval-command="​target remote 192.168.1.4:​1234"​ helloworld
 +</​code>​
 +
 +===== 3G modem =====
 +
 +Enable USB support in kernel:
 +<​code>​
 +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)
 +</​code>​
 +
 +Enable PPP interface with usb_modeswitch (for Huawei E303) :
 +<​code>​
 +usb_modeswitch -v 0x12d1 -p 0x1f01 -V 0x12d1 -P 0x14dc -M "​55534243123456780000000000000a11062000000000000100000000000000"​
 +</​code>​
 +
  
beagleboneblack.txt ยท Last modified: 2018/05/22 10:33 (external edit)