BeagleBoneBlack

U-boot

Let's build the uboot to generate MLO and u-boot.img files.

$ git clone git://git.denx.de/u-boot.git

Build!

$ make am335x_evm_defconfig
$ make CROSS_COMPILE=arm-linux-gnueabihf-

... build process ...

SHIPPED dts/dt.dtb
MKIMAGE u-boot.img
CAT     u-boot-dtb.bin
COPY    u-boot.dtb
MKIMAGE u-boot-dtb.img
COPY    u-boot.bin
...
LD      spl/u-boot-spl
OBJCOPY spl/u-boot-spl-nodtb.bin
COPY    spl/u-boot-spl.bin
MKIMAGE MLO

The MLO and u-boot.img will be written into the SD card.

SD card partition

start size (KB) description
0 128 MLO
128 384 Uboot
2048 end of SD Alpine Linux

Format the SD card. In my system, sdb is the mount location of SD card.
Please note that it depends on the system.

$ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=10

Writing MLO

$ sudo dd if=MLO of=/dev/sdb count=1 seek=1 bs=128k
0+1 records in
0+1 records out
77876 bytes (78 kB) copied, 0.0147161 s, 5.3 MB/s

Writing u-boot.img

$ sudo dd if=u-boot.img of=/dev/sdb count=2 seek=1 bs=384k
0+1 records in
0+1 records out
365092 bytes (365 kB) copied, 0.0127763 s, 28.6 MB/s

Creating a partition for Alpine Linux

$ sudo fdisk /dev/sdb

Command (m for help): n
Partition type:
    p   primary (0 primary, 0 extended, 4 free)
    e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-31275007, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-31275007, default 31275007): 
Using default value 31275007
Command (m for help): w
The partition table has been altered!

$ sudo mkfs.fat /dev/sdb1

Let's check whether created partition is ok or not

$ sudo fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16012804096 bytes
64 heads, 32 sectors/track, 15271 cylinders, total 31275008 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 identifier: 0xd2858c87

Device    Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    31275007    15636480   83  Linux

It should be a bootable partition. To set the bootable flag, select 'a' in the menu

Command (m for help): a
Partition number (1-4): 1

Double check!

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16012804096 bytes
64 heads, 32 sectors/track, 15271 cylinders, total 31275008 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 identifier: 0xd2858c87

Device    Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    31275007    15636480   83  Linux

OK, now the 1st partition is bootable. Then, let's make the EXT4 file system for rootfs.

$ sudo mkfs.ext4 /dev/sdb1

Rootfs - Debian 8 Small flash

Created EXT4 partition is for Alpine Linux. Just copy whole files into the partition.

$ sudo mount /dev/sdb1 /mnt/

Generate uEnv.txt file.

##This will work with: Angstrom's 2013.06.20 u-boot.

loadaddr=0x82000000
fdtaddr=0x88000000
rdaddr=0x88080000

initrd_high=0xffffffff
fdt_high=0xffffffff

#for single partitions:
mmcroot=/dev/mmcblk0p1

loadximage=load mmc 0:1 ${loadaddr} /boot/vmlinuz-grsec
loadxfdt=load mmc 0:1 ${fdtaddr} /boot/dtbs/am335x-boneblack.dtb
loadall=run loadximage; run loadxfdt;

mmcargs=setenv bootargs console=tty0 console=${console} ${optargs} ${cape_disable} ${cape_enable} root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline}

uenvcmd=run loadall; run mmcargs; bootz ${loadaddr} - ${fdtaddr};

Move it into the rootfs.

$ sudo cp uEnv.txt /mnt/

Download the prebuilt Debian 8 rootfs compressed file and extract it

$ wget -c https://rcn-ee.com/rootfs/eewiki/barefs/debian-8.5-bare-armhf-2016-08-16.tar.xz
$ tar xf debian-8.5-bare-armhf-2016-08-16.tar.xz

Copy rootfs into the SD card

$ sudo tar xfvp armhf-rootfs-debian-jessie.tar -C /mnt/

$ ls -la /mnt/
total 100
drwxr-xr-x 21 root root  4096 Aug 16 23:30 .
drwxr-xr-x 24 root root  4096 Sep 26 23:36 ..
drwxr-xr-x  2 root root  4096 Aug 16 23:28 bin
drwxr-xr-x  3 root root  4096 Aug 16 23:30 boot
drwxr-xr-x  4 root root  4096 Aug 16 23:26 dev
drwxr-xr-x 49 root root  4096 Aug 16 23:30 etc
drwxr-xr-x  3 root root  4096 Aug 16 23:30 home
drwxr-xr-x 12 root root  4096 Aug 16 23:27 lib
drwx------  2 root root 16384 Sep 28 10:42 lost+found
drwxr-xr-x  2 root root  4096 Aug 16 23:26 media
drwxr-xr-x  2 root root  4096 Aug 16 23:26 mnt
drwxr-xr-x  3 root root  4096 Aug 16 23:30 opt
drwxr-xr-x  2 root root  4096 May 30 13:40 proc
drwx------  2 root root  4096 Aug 16 23:26 root
drwxr-xr-x  2 root root  4096 Apr  7  2015 run
drwxr-xr-x  2 root root  4096 Aug 16 23:29 sbin
drwxr-xr-x  2 root root  4096 Aug 16 23:26 srv
drwxr-xr-x  2 root root  4096 Apr  7  2015 sys
drwxrwxrwt  2 root root  4096 Aug 16 23:30 tmp
-rw-r--r--  1 root root   596 Sep 28 10:43 uEnv.txt
drwxr-xr-x 10 root root  4096 Aug 16 23:26 usr
drwxr-xr-x 11 root root  4096 Aug 16 23:26 var

Copy new dtb file into the SD card.

$ sudo mkdir /mnt/boot/dtbs/
$ sudo cp arch/arm/boot/dts/am335x-boneblack.dts.dtb /mnt/boot/dtbs/

Copy new built Linux kernel.

$ sudo cp arch/arm/boot/zImage /mnt/boot/vmlinuz-grsec

Done! Just pull out the SD card to test new kernel on BBB.

$ sync
$ sudo umount /mnt

results matching ""

    No results matching ""