I am trying to create a USB drive manually as opposed to using the supported BeagleBoard Ubuntu OS with their bb-imager tool. My intention is to put another Linux flavor on the root fs, eventually (I’ve already got this working with the BBB, now I’m working a PB2). But first just trying to get it to boot u-boot. When using the bb-imager tool, it creates a USB drive with three partitions for Ubuntu and it works fine. I can read u-boot output on the proper serial console with the terminal emulator.
The Problem:
However, when I run my manually created USB drive (not using bb-imager), and using the same terminal emulator settings, all I get is jibberish on the terminal console and I can’t understand why.
Here’s what I did …
The Official Drive: (for comparison)
I used bb-imager to create a USB image of the supported Ubuntu OS on an 8Gb USB drive. After creating the image, fdisk reports the partition layout as follows:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 7.5 GiB, 8053063680 bytes, 15728640 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcbd6c8a0
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/sda2 526336 2623487 2097152 1G 82 Linux swap / Solaris
/dev/sda3 2623488 15269887 12646400 6G 83 Linux
… and when I insert this USB drive into a PocketBeagle 2, the image boots fine and I can read the serial output.
My “manual” Drive:
So now I’m trying to replicate the above functionality and I’ve used fdisk as well as parted to create the partitions. But since they both give the same results, I will show using my test script based on fdisk.
#!/bin/bash
# Usage:
# $ mksd-fdisk.sh /dev/sda /mnt/sda
TGTDEV="$1"
MOUNT="$2"
PART1="$TGTDEV"1
PART2="$TGTDEV"2
PART3="$TGTDEV"3
# The sed script strips off all the comments so that we can document what
# we're doing in-line with the actual commands. Note that a blank line
# (commented as "default") will send an empty line terminated with a newline to
# take the fdisk default.
sed -e 's/s*([+0-9a-zA-Z]*).*/1/' << EOF | fdisk ${TGTDEV}
o # clear the in memory partition table
n # new partition
p # primary partition
1 # partition number 1
# default - start at beginning of disk
+256M # 256MB boot partition
n # new partition
p # primary partition
2 # partition number 2
# default, start immediately after preceding partition
+1G # 1G Swap
n
p
3 # partition 3 for rootfs
# default, start immediately after preceding partition
# default, extend partition to end of disk
t
1
0c
t
2
82
t
3
83
a # make a partition bootable
1 # bootable partition is partition 1
p # print the in-memory partition table
w # write the partition table
q # and we're done
EOF
mkfs.vfat -F 32 -n BOOT "$PART1"
mkswap "$PART2"
mkfs.ext4 -L ROOTFS -T small "$PART3"
After, creating the partitions and formatting them (running the above script), I mount the first partition and copy the following three files onto it. These should be the only files required to give me a u-boot prompt and allow me to see proper serial output on the console (shows me u-boot is working).
- tiboot3.bin
- tispl.bin
- u-boot.img
Also, these are the same binaries that came from the first partition of the image created from the Ubuntu tool, which works. After running the above script, fdisk reports the drive layout as follows:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 7.5 GiB, 8053063680 bytes, 15728640 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3086b90f
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/sda2 526336 2623487 2097152 1G 82 Linux swap / Solaris
/dev/sda3 2623488 15728639 13105152 6.2G 83 Linux
Problem, Again
And here is the problem. When I insert this card into the PB2 and power it on, all I see is jibberish on the console. I am using the correct device for terminal emulations with the same settings (115200 8n1) as the Ubuntu drive. I have tried minicom, tio, and screen, all three show same results.
I have a Raspberry Pi Debug Probe between my machine and the PB2.
I know it seems like a simple stupid problem, but I just can’t see it. I’m using the same binaries as from the working USB drive and my drive, the only difference I can possibly think of is how these USB partitions are being created, but I see none … and my terminal emulation settings are the same.