Booting Linux from QSPI on AMC1 with RFS on eMMC
Contents
1 Preparation
Follow steps 1-4 of Booting Linux from QSPI on AMC1 with RFS on NFS and boot into Linux on the AMC1
Kernel image @ 0x80200000 [ 0x000000 - 0x395e58 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Using Device Tree in place at 88000000, end 8800d630
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.41-ge3a80a1c5c (sitara@sitara-sdk401) (gcc vers
ion 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP Wed Oct 25 14:53:44 CEST 20
17
...
[ 9.670506] systemd[1]: Detected architecture arm.
Welcome to Arago 2017.06!
[ 9.722230] systemd[1]: Set hostname to <am437x-evm>.
...
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org am437x-evm ttyO0
Arago 2017.06 am437x-evm ttyO0
am437x-evm login: root
root@am437x-evm:~#
2 Prepare eMMC
2.1 Check if eMMC is available
ls -lah /dev/ | grep mmc
root@am437x-evm:~# ls -lah /dev/ | grep mmc
brw-rw---- 1 root disk 179, 0 Sep 26 21:32 mmcblk0
brw-rw---- 1 root disk 179, 16 Sep 26 21:32 mmcblk0boot0
brw-rw---- 1 root disk 179, 32 Sep 26 21:33 mmcblk0boot1
brw-rw---- 1 root disk 179, 1 Sep 26 21:33 mmcblk0p1
root@am437x-evm:~#
mmcblk0 is the on-board eMMC
2.2 Start fdisk
fdisk /dev/mmcblk0
root@am437x-evm:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.28.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
2.3 Clear existing partition
Command o clears any existing partition on device mmcblk0 and creates a new disklable
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xc4fcd91f.
Command (m for help):
2.4 List all partiotions
Command p will list all partition tables on eMMC
Command (m for help): p
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 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
Disklabel type: dos
Disk identifier: 0xc4fcd91f
Command (m for help):
2.5 Create new partition
Create a new partition with command n.
Enter p for a primary partition, Partition number is 1, first sector is 2048 and +64M is the boot partition size.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15269887, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15269887, default 15269887): +64M
Created a new partition 1 of type 'Linux' and of size 64 MiB.
Command (m for help):
If this partition should be used later for booting - remember we do not need it since QSPI boot is default - make this partition bootable. For this the partition type must be set to W95 FAT16 (LBA):
Command (m for help): t
Selected partition 1
Partition type (type L to list all types): e
Changed type of partition 'Linux' to 'W95 FAT16 (LBA)'.
Command (m for help):
and the boot flag must be set by command a:
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help):
Check success:
Command (m for help): p
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 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
Disklabel type: dos
Disk identifier: 0xc4fcd91f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 133119 131072 64M e W95 FAT16 (LBA)
Command (m for help):
2.6 Create second partition
Create a second partition for the Root FS. Enter command n to create a new partition. Partition type is p for primary. Partition numer is 2, first and last sector set to default.
command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (133120-15269887, default 133120):
Last sector, +sectors or +size{K,M,G,T,P} (133120-15269887, default 15269887):
Created a new partition 2 of type 'Linux' and of size 7.2 GiB.
Command (m for help): p
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 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
Disklabel type: dos
Disk identifier: 0xc4fcd91f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 133119 131072 64M e W95 FAT16 (LBA)
/dev/mmcblk0p2 133120 15269887 15136768 7.2G 83 Linux
Command (m for help):
2.7 Write partition table to eMMC
Command w writes the new partition table back to eMMC:
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
[ 3589.507368] mmcblk0: p1 p2
Syncing disks.
root@am437x-evm:~#
2.8 Format partitions
Format boot partition with FAT:
mkfs.vfat -F 16 /dev/mmcblk0p1
root@am437x-evm:~# mkfs.vfat -F 16 /dev/mmcblk0p1
mkfs.fat 4.0 (2016-05-06)
root@am437x-evm:~#
Format Root FS partition with EXT4:
mkfs.ext4 /dev/mmcblk0p2
root@am437x-evm:~# mkfs.ext4 /dev/mmcblk0p2
mke2fs 1.43 (17-May-2016)
Discarding device blocks: done
Creating filesystem with 1892096 4k blocks and 473280 inodes
Filesystem UUID: 09e4e558-553e-455d-b93f-542ed41a1f4f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
root@am437x-evm:~#
3 Copy Root FS tarball
Copy a Root FS tarball to a directory on your NFS server:
4 Extract Root FS to eMMC
Extract the Root FS to the eMMC with the following commands:
root@am437x-evm:~# cd /tmp
root@am437x-evm:/tmp# mkdir rootfs
root@am437x-evm:/tmp# mount /dev/mmcblk0p2 rootfs
root@am437x-evm:/tmp# tar -xJf /home/arago-base-tisdk-image-am437x-evm.tar.xz -C rootfs
root@am437x-evm:/tmp# umount /dev/mmcblk0p2
This step may take a few minutes depending on the size of your Root FS.
5 Reboot and change bootparam
Reboot the system using reboot command. Enter the U-Boot command processor and change the bootparam:
setenv bootargs root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
AMC1> setenv bootargs root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
6 start Linux with Root FS on eMMC
setenv loadimage 'sf read ${loadaddr} 0x200000 0x400000' setenv loaddtb 'sf read ${fdtaddr} 0x120000 0x10000' sf probe && run loadimage loaddtb && bootz ${loadaddr} - ${fdtaddr}
AMC1> setenv loadimage 'sf read ${loadaddr} 0x200000 0x400000'
AMC1> setenv loaddtb 'sf read ${fdtaddr} 0x120000 0x10000'
AMC1> sf probe && run loadimage loaddtb && bootz ${loadaddr} - ${fdtaddr}
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
device 0 offset 0x200000, size 0x400000
SF: 4194304 bytes @ 0x200000 Read: OK
device 0 offset 0x120000, size 0x10000
SF: 65536 bytes @ 0x120000 Read: OK
Kernel image @ 0x80200000 [ 0x000000 - 0x395e58 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Using Device Tree in place at 88000000, end 8800d630
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.41-ge3a80a1c5c (sitara@sitara-sdk401) (gcc vers
ion 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP Wed Oct 25 14:53:44 CEST 20
17
[ 0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
...
[ 2.346390] systemd[1]: Detected architecture 'arm'.
Welcome to Arago 2017.06!
...
***************************************************************
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org am437x-evm ttyO0
Arago 2017.06 am437x-evm ttyO0
am437x-evm login:
7 Additional Tags
Booting Linux from QSPI on AMC1 with RFS on NFS Network settings for U-Boot on AMC1