Skip to content

Commit 799c923

Browse files
jmentipraneethbajjuri
authored andcommitted
feat(linux): Add documentation for MMCSD boot from eMMC UDA in FS mode
Due to errata [0], am62lx device does not support eMMC boot, since this is the recommended boot mode that K3 boards support and the only boot mode that we document, we must now add a guide for booting with MMCSD boot from eMMC UDA (FS mode). While we are here, include an instantiation that descibes the various MMC bootmodes supported by ROM. [0] https://www.ti.com/lit/pdf/sprz582 Signed-off-by: Judith Mendez <[email protected]>
1 parent 03ed0e1 commit 799c923

File tree

2 files changed

+388
-100
lines changed

2 files changed

+388
-100
lines changed

source/linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD.rst

Lines changed: 253 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,28 @@ Driver Configuration
481481
482482
|
483483
484-
.. _create-partitions-in-emmc-uda-from-linux:
484+
Listing MMC devices from Linux
485+
******************************
486+
eMMC and SD cards are registered to the MMC subsystem and availiable as a block device
487+
as :file:`/dev/mmcblk{n}`. To find which device index **n** corresponds to eMMC device,
488+
check which device includes :file:`mmcblk{n}boot0` and :file:`mmcblk{n}boot1`. Here,
489+
mmcblk0 is eMMC.
485490

486-
Create software partitions in eMMC UDA
487-
**************************************
491+
.. code-block:: console
492+
493+
root@<machine>:~# ls -l /dev/mmcblk*
494+
brw-rw---- 1 root disk 179, 0 Jan 1 00:10 /dev/mmcblk0
495+
brw-rw---- 1 root disk 179, 32 Jan 8 2025 /dev/mmcblk0boot0
496+
brw-rw---- 1 root disk 179, 64 Jan 8 2025 /dev/mmcblk0boot1
497+
brw-rw---- 1 root disk 179, 1 Jan 1 00:14 /dev/mmcblk0p1
498+
crw------- 1 root root 239, 0 Jan 1 00:00 /dev/mmcblk0rpmb
499+
brw-rw---- 1 root disk 179, 96 Jan 8 2025 /dev/mmcblk1
500+
brw-rw---- 1 root disk 179, 97 Jan 1 00:00 /dev/mmcblk1p1
501+
brw-rw---- 1 root disk 179, 98 Jan 8 2025 /dev/mmcblk1p2
488502
489-
In eMMC, the User Data Area (UDA) HW partition is the primary storage
490-
space generally used to flash the rootfs. To prepare the UDA, use
491-
the :command:`fdisk` command. For ex: :samp:`fdisk /dev/mmcblkN` in
492-
which **N** is 0 or 1. To find which device index is eMMC use the command
493-
:command:`lsblk`, like so:
503+
The software partitions for each MMC device are displayed as :file:`/dev/mmcblk{n}p{x}`,
504+
to see what software partitions exist for an eMMC device and if they are mounted, use the
505+
command :command:`lsblk`, like so:
494506

495507
.. code-block:: console
496508
@@ -503,51 +515,256 @@ which **N** is 0 or 1. To find which device index is eMMC use the command
503515
|-mmcblk1p1 179:97 0 128M 0 part /run/media/boot-mmcblk1p1
504516
`-mmcblk1p2 179:98 0 1.9G 0 part /
505517
506-
Where the eMMC will have hardware partitions :file:`mmcblkNboot0`
507-
and :file:`mmcblkNboot1`. The :file:`mmcblkN` is the eMMC device.
518+
Use the :command:`umount` and :command:`mount` commands to mount and unmount software partitions
519+
if they are formated, usally to vfat or ext4 types.
520+
521+
.. _create-partitions-in-emmc-uda-from-linux:
522+
523+
Create software partitions in eMMC UDA
524+
**************************************
525+
526+
In eMMC, the User Data Area (UDA) HW partition is the primary storage space generally used
527+
to flash the rootfs. To create logical paritions in UDA, use the :command:`fdisk` command.
528+
For ex: :samp:`fdisk /dev/mmcblk{n}` in which **n** is typically 0 or 1. In the example above,
529+
eMMC is :samp:`fdisk /dev/mmcblk0`.
530+
531+
For documentation on using fdisk, please go to: `fdisk how-to <https://tldp.org/HOWTO/Partition/fdisk_partitioning.html>`__.
532+
533+
.. _create-boot-partition-in-emmc-uda-from-linux:
534+
535+
Create "boot" partition
536+
=======================
537+
538+
In this example create a "boot" partition of size 400 MiB which can be formatted to vfat type
539+
and will store the bootloader binaries.
540+
541+
.. code-block:: console
542+
543+
root@<machine>:~# fdisk /dev/mmcblk0
544+
545+
Welcome to fdisk (util-linux 2.39.3).
546+
Changes will remain in memory only, until you decide to write them.
547+
Be careful before using the write command.
548+
549+
Command (m for help): n
550+
Partition type
551+
p primary (0 primary, 0 extended, 4 free)
552+
e extended (container for logical partitions)
553+
Select (default p):
554+
555+
Using default response p.
556+
Partition number (1-4, default 1):
557+
First sector (2048-31080447, default 2048):
558+
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31080447, default 31080447): +400M
559+
560+
Created a new partition 1 of type 'Linux' and of size 400 MiB.
561+
Partition #1 contains a vfat signature.
562+
563+
Do you want to remove the signature? [Y]es/[N]o: y
564+
565+
The signature will be removed by a write command.
566+
567+
Command (m for help): a
568+
Selected partition 1
569+
The bootable flag on partition 1 is enabled now.
570+
571+
Command (m for help): t
572+
Selected partition 1
573+
Hex code or alias (type L to list all): c
574+
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
575+
576+
Command (m for help): w
577+
The partition table has been altered.
578+
[ 644.818358] mmcblk0: p1
579+
Calling ioctl() to re-read partition table.
580+
Syncing disks.
581+
root@<machine>:~# fatlabel /dev/mmcblk0p1 boot
582+
583+
Make sure bootable flag is set for "boot" partition, ROM may not boot from this patitition
584+
if bootable flag is not set.
585+
586+
.. _create-root-partition-in-emmc-uda-from-linux:
587+
588+
Create "root" partition
589+
=======================
590+
591+
In this example create a "root" partition which can be formatted to ext4 type and will store
592+
Linux kernel Image, DTB, and the rootfs.
593+
594+
.. code-block:: console
595+
596+
root@<machine>:~# fdisk /dev/mmcblk0
597+
598+
Welcome to fdisk (util-linux 2.39.3).
599+
Changes will remain in memory only, until you decide to write them.
600+
Be careful before using the write command.
601+
602+
This disk is currently in use - repartitioning is probably a bad idea.
603+
It's recommended to umount all file systems, and swapoff all swap
604+
partitions on this disk.
605+
606+
607+
Command (m for help): n
608+
Partition type
609+
p primary (1 primary, 0 extended, 3 free)
610+
e extended (container for logical partitions)
611+
Select (default p):
612+
613+
Using default response p.
614+
Partition number (2-4, default 2):
615+
First sector (821248-31080447, default 821248):
616+
Last sector, +/-sectors or +/-size{K,M,G,T,P} (821248-31080447, default 31080447):
617+
618+
Created a new partition 2 of type 'Linux' and of size 14.4 GiB.
619+
620+
Command (m for help): t
621+
Partition number (1,2, default 2): 2
622+
Hex code or alias (type L to list all): 83
623+
624+
Changed type of partition 'Linux' to 'Linux'.
625+
626+
Command (m for help): w
627+
The partition table has been altered.
628+
Syncing disks.
629+
root@<machine>:~# e2label /dev/mmcblk0p2 root
630+
631+
**Verify partitions**
632+
633+
Verify :file:`mmcblk0p1` and :file:`mmcblk0p2` now exist using :command:`lsblk` command.
508634

509-
Now we use :samp:`fdisk /dev/mmcblk0` to create one software partition
510-
in UDA. For documentation on using fdisk, please go to:
511-
`fdisk how-to <https://tldp.org/HOWTO/Partition/fdisk_partitioning.html>`__.
635+
.. code-block:: console
636+
637+
root@<machine>:~# lsblk -o name,mountpoint,label,size,uuid
638+
NAME MOUNTPOINT LABEL SIZE UUID
639+
mmcblk0 14.8G
640+
|-mmcblk0p1 boot 400M E4D4-4879
641+
`-mmcblk0p2 root 14.4G 74d40075-07e4-4bce-9401-6fccef68e934
642+
mmcblk0boot0 31.5M
643+
mmcblk0boot1 31.5M
644+
mmcblk1 29.7G
645+
|-mmcblk1p1 /run/media/boot-mmcblk1p1 boot 128M 681F-55DD
646+
`-mmcblk1p2 / root 8.7G ead4c8bb-fa37-4c4d-9ba3-47a1f3824764
512647
513648
.. _formatting-mmc-partition-from-linux:
514649

515650
Formatting eMMC partitions from Linux
516651
*************************************
517652

518-
After creating a partition/s, the partition can be formated with
519-
the :command:`mkfs` command. For ex: :samp:`mkfs -t ext4 /dev/mmcblkN`
520-
where **mmcblkN** is the MMC device with the software partition to format.
521-
The general syntax for formatting disk partitions in Linux is:
653+
After creating a partition/s, the partition can be formated with the :command:`mkfs` command.
654+
For ex: :samp:`mkfs -t ext4 /dev/mmcblk{n}` where **mmcblk{n}** is the MMC device with the new
655+
software partitions to format. The general syntax for formatting disk partitions in Linux is:
522656

523657
.. code-block:: console
524658
525659
mkfs [options] [-t type fs-options] device [size]
526660
527-
For example, to format a partition in eMMC UDA to ext4 file system:
661+
.. _format-partition-vfat:
662+
663+
Format to vfat
664+
==============
665+
666+
In this example, format the first created partition to type vfat.
667+
668+
.. code-block:: console
669+
670+
root@<machine>:~# mkfs -t vfat /dev/mmcblk0p1
671+
672+
.. _format-partition-ext4:
673+
674+
Format to ext4
675+
==============
676+
677+
In this example, format the first created partition to type ext4.
678+
679+
.. code-block:: console
680+
681+
root@<machine>:~# mkfs -t ext4 /dev/mmcblk0p2
682+
683+
.. _flash-emmc-mmcsd-boot-uda-fs:
684+
685+
Flash eMMC for MMCSD boot from eMMC UDA in FS mode
686+
**************************************************
687+
688+
In this example, we show one simple method for flashing to eMMC for MMCSD boot from
689+
eMMC UDA in FS mode. Please know this is not the only method for flashing the eMMC
690+
for this bootmode.
691+
692+
This example assumes the current bootmode is MMCSD boot from SD (FS mode)
693+
694+
Flash to eMMC "boot" software partition
695+
=======================================
696+
697+
.. code-block:: console
698+
699+
root@<machine>:~# mkdir eboot sdboot
700+
root@<machine>:~# mount /dev/mmcblk0p1 eboot
701+
root@<machine>:~# mount /dev/mmcblk1p1 sdboot
702+
703+
Verify the partitions are mounted to the correct folders using :command:`lsblk` command in the
704+
column labeled :file:`MOUNTPOINTS`.
528705

529706
.. code-block:: console
530707
531708
root@<machine>:~# lsblk
532709
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
533710
mmcblk0 179:0 0 14.8G 0 disk
534-
`-mmcblk0p1 179:1 0 14.8G 0 part /run/media/mmcblk0p1
711+
|-mmcblk0p1 179:1 0 400M 0 part /root/eboot
712+
`-mmcblk0p2 179:2 0 14.4G 0 part
535713
mmcblk0boot0 179:32 0 31.5M 1 disk
536714
mmcblk0boot1 179:64 0 31.5M 1 disk
537-
mmcblk1 179:96 0 14.8G 0 disk
538-
|-mmcblk1p1 179:97 0 128M 0 part /run/media/boot-mmcblk1p1
539-
`-mmcblk1p2 179:98 0 8.8G 0 part /
540-
root@<machine>:~# umount /run/media/mmcblk0p1
541-
[ 43.648532] EXT4-fs (mmcblk0p1): unmounting filesystem f8ecc7b8-ab1a-4240-ab4b-470d242c0539.
542-
root@<machine>:~# mkfs -t ext4 /dev/mmcblk0p1
543-
mke2fs 1.47.0 (5-Feb-2023)
544-
Discarding device blocks: done
545-
Creating filesystem with 3884800 4k blocks and 972944 inodes
546-
Filesystem UUID: 842929dd-4e57-47b6-afa1-c03abc3100b1
547-
Superblock backups stored on blocks:
548-
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
549-
550-
Allocating group tables: done
551-
Writing inode tables: done
552-
Creating journal (16384 blocks): done
553-
Writing superblocks and filesystem accounting information: done
715+
mmcblk1 179:96 0 29.7G 0 disk
716+
|-mmcblk1p1 179:97 0 128M 0 part /root/sdboot
717+
| /run/media/boot-mmcblk1p1
718+
`-mmcblk1p2 179:98 0 8.7G 0 part /
719+
720+
Now we can copy bootloader binaries to eMMC and umount the partitions when writes finish.
721+
722+
.. code-block:: console
723+
724+
root@<machine>:~# cd sdboot/
725+
root@<machine>:~# ls
726+
tiboot3.bin tispl.bin u-boot.img uEnv.txt
727+
root@<machine>:~# cp tiboot3.bin tispl.bin u-boot.img ../eboot/
728+
root@<machine>:~# cd ../ && umount sd* && umount e*
729+
730+
.. _flash-emmc-mmcsd-boot-uda-fs-root:
731+
732+
Flash to eMMC "root" software partition
733+
=======================================
734+
735+
.. code-block:: console
736+
737+
root@<machine>:~# mkdir eroot sdroot
738+
root@<machine>:~# mount /dev/mmcblk0p2 eroot
739+
[69229.982452] EXT4-fs (mmcblk0p2): mounted filesystem 74d40075-07e4-4bce-9401-6fccef68e934 r/w with ordered data mode. Quota mode: none.
740+
root@<machine>:~# mount /dev/mmcblk1p2 sdroot
741+
742+
Verify the partitions are mounted to the correct folders using :command:`lsblk` command in the
743+
column labeled :file:`MOUNTPOINTS`.
744+
745+
.. code-block:: console
746+
747+
root@<machine>:~# lsblk
748+
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
749+
mmcblk0 179:0 0 14.8G 0 disk
750+
|-mmcblk0p1 179:1 0 400M 0 part
751+
`-mmcblk0p2 179:2 0 14.4G 0 part /root/eroot
752+
mmcblk0boot0 179:32 0 31.5M 1 disk
753+
mmcblk0boot1 179:64 0 31.5M 1 disk
754+
mmcblk1 179:96 0 29.7G 0 disk
755+
|-mmcblk1p1 179:97 0 128M 0 part
756+
| /run/media/boot-mmcblk1p1
757+
`-mmcblk1p2 179:98 0 8.7G 0 part /root/sdroot
758+
/
759+
760+
Now we can copy rootfs to eMMC and umount the partitions when writes finish.
761+
762+
.. code-block:: console
763+
764+
root@<machine>:~# cd sdroot
765+
root@<machine>:~# ls
766+
bin dev home lost+found mnt proc run srv tmp var
767+
boot etc lib media opt root sbin sys usr
768+
root@<machine>:~# cp -r ./* ../eroot/
769+
root@<machine>:~# cd ../ && umount sd* && umount e*
770+
[70154.205154] EXT4-fs (mmcblk0p2): unmounting filesystem 74d40075-07e4-4bce-9401-6fccef68e934.

0 commit comments

Comments
 (0)