Skip to content

Commit f1831fd

Browse files
jmentipraneethbajjuri
authored andcommitted
feat: Move eMMC boot doc to how-to-guide
This patch moves boot from eMMC documentation to a how-to-guides in an effort to cleanup UG-Memory-K3 and consolidate all of boot from eMMC steps on two guides, one for eMMC boot and the second for MMCSD boot from eMMC UDA. Also filled in a few missing sections. While we are here, fix a few issues when describing partitioning: 1. SD only has one "hardware" partition which can be selected with mmc dev command 2. Fix naming conventions 'software partitions' to 'disk partitions' Signed-off-by: Judith Mendez <[email protected]>
1 parent ae3cb4e commit f1831fd

File tree

4 files changed

+582
-331
lines changed

4 files changed

+582
-331
lines changed

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

Lines changed: 97 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,14 @@ eMMC HS400 support in Linux
522522

523523
|
524524
525+
.. _mmc-listing-mmc-devices-linux:
526+
525527
Listing MMC devices from Linux
526528
******************************
527529
eMMC and SD cards are registered to the MMC subsystem and availiable as a block device
528530
as :file:`/dev/mmcblk{n}`. To find which device index **n** corresponds to eMMC device,
529531
check which device includes :file:`mmcblk{n}boot0` and :file:`mmcblk{n}boot1`. Here,
530-
mmcblk0 is eMMC.
532+
mmcblk0* is in eMMC.
531533

532534
.. code-block:: console
533535
@@ -541,8 +543,8 @@ mmcblk0 is eMMC.
541543
brw-rw---- 1 root disk 179, 97 Jan 1 00:00 /dev/mmcblk1p1
542544
brw-rw---- 1 root disk 179, 98 Jan 8 2025 /dev/mmcblk1p2
543545
544-
The software partitions for each MMC device are displayed as :file:`/dev/mmcblk{n}p{x}`,
545-
to see what software partitions exist for an eMMC device and if they are mounted, use the
546+
The disk partitions for each MMC device are displayed as :file:`/dev/mmcblk{n}p{x}`,
547+
to see what disk partitions exist for an eMMC device and if they are mounted, use the
546548
command :command:`lsblk`, like so:
547549

548550
.. code-block:: console
@@ -556,22 +558,34 @@ command :command:`lsblk`, like so:
556558
|-mmcblk1p1 179:97 0 128M 0 part /run/media/boot-mmcblk1p1
557559
`-mmcblk1p2 179:98 0 1.9G 0 part /
558560
559-
Use the :command:`umount` and :command:`mount` commands to mount and unmount software partitions
561+
Use the :command:`mount` and :command:`umount` commands to mount and unmount disk partitions
560562
if they are formated, usally to vfat or ext4 types.
561563

562-
.. _create-partitions-in-emmc-uda-from-linux:
564+
.. _mmc-create-partitions-in-emmc-linux:
563565

564-
Create software partitions in eMMC UDA
565-
**************************************
566+
Create partitions in eMMC UDA
567+
*****************************
566568

567569
In eMMC, the User Data Area (UDA) HW partition is the primary storage space generally used
568-
to flash the rootfs. To create logical paritions in UDA, use the :command:`fdisk` command.
570+
to flash the rootfs. To create disk partitions in UDA, use the :command:`fdisk` command.
569571
For ex: :samp:`fdisk /dev/mmcblk{n}` in which **n** is typically 0 or 1. In the example above,
570572
eMMC is :samp:`fdisk /dev/mmcblk0`.
571573

572574
For documentation on using fdisk, please go to: `fdisk how-to <https://tldp.org/HOWTO/Partition/fdisk_partitioning.html>`__.
573575

574-
.. _create-boot-partition-in-emmc-uda-from-linux:
576+
**Erase eMMC UDA**
577+
578+
In Linux, before creating disk partitions, we can optionally erase eMMC UDA using :command:`dd`
579+
command:
580+
581+
.. code-block:: console
582+
583+
root@<machine>:~# umount /dev/mmcblk0*
584+
root@<machine>:~# dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=n
585+
586+
where ``n`` should be determined according the the following formula: ``count = total size UDA (bytes) / bs``.
587+
588+
.. _mmc-create-boot-partition-emmc-linux:
575589

576590
Create "boot" partition
577591
=======================
@@ -619,12 +633,11 @@ and will store the bootloader binaries.
619633
[ 644.818358] mmcblk0: p1
620634
Calling ioctl() to re-read partition table.
621635
Syncing disks.
622-
root@<machine>:~# fatlabel /dev/mmcblk0p1 boot
623636
624637
Make sure bootable flag is set for "boot" partition, ROM may not boot from this patitition
625638
if bootable flag is not set.
626639

627-
.. _create-root-partition-in-emmc-uda-from-linux:
640+
.. _mmc-create-root-partition-emmc-linux:
628641

629642
Create "root" partition
630643
=======================
@@ -667,79 +680,82 @@ Linux kernel Image, DTB, and the rootfs.
667680
Command (m for help): w
668681
The partition table has been altered.
669682
Syncing disks.
670-
root@<machine>:~# e2label /dev/mmcblk0p2 root
671683
672-
**Verify partitions**
673-
674-
Verify :file:`mmcblk0p1` and :file:`mmcblk0p2` now exist using :command:`lsblk` command.
675-
676-
.. code-block:: console
677-
678-
root@<machine>:~# lsblk -o name,mountpoint,label,size,uuid
679-
NAME MOUNTPOINT LABEL SIZE UUID
680-
mmcblk0 14.8G
681-
|-mmcblk0p1 boot 400M E4D4-4879
682-
`-mmcblk0p2 root 14.4G 74d40075-07e4-4bce-9401-6fccef68e934
683-
mmcblk0boot0 31.5M
684-
mmcblk0boot1 31.5M
685-
mmcblk1 29.7G
686-
|-mmcblk1p1 /run/media/boot-mmcblk1p1 boot 128M 681F-55DD
687-
`-mmcblk1p2 / root 8.7G ead4c8bb-fa37-4c4d-9ba3-47a1f3824764
688-
689-
.. _formatting-mmc-partition-from-linux:
684+
.. _mmc-format-partition-linux:
690685

691686
Formatting eMMC partitions from Linux
692687
*************************************
693688

694689
After creating a partition/s, the partition can be formated with the :command:`mkfs` command.
695690
For ex: :samp:`mkfs -t ext4 /dev/mmcblk{n}` where **mmcblk{n}** is the MMC device with the new
696-
software partitions to format. The general syntax for formatting disk partitions in Linux is:
691+
disk partitions to format. The general syntax for formatting disk partitions in Linux is:
697692

698693
.. code-block:: console
699694
700-
mkfs [options] [-t type fs-options] device [size]
695+
mkfs.vfat [OPTIONS] TARGET [BLOCKS]
696+
mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size]
701697
702-
.. _format-partition-vfat:
698+
.. _mmc-format-partition-vfat:
703699

704700
Format to vfat
705701
==============
706702

707-
In this example, format the first created partition to type vfat.
703+
In this example, format the "boot" partition to type vfat.
708704

709705
.. code-block:: console
710706
711-
root@<machine>:~# mkfs -t vfat /dev/mmcblk0p1
707+
root@<machine>:~# mkfs.vfat -F 32 -n "boot" /dev/mmcblk0p1
712708
713-
.. _format-partition-ext4:
709+
.. _mmc-format-partition-ext4:
714710

715711
Format to ext4
716712
==============
717713

718-
In this example, format the first created partition to type ext4.
714+
In this example, format the "root" partition to type ext4.
719715

720716
.. code-block:: console
721717
722-
root@<machine>:~# mkfs -t ext4 /dev/mmcblk0p2
718+
root@<machine>:~# mkfs.ext4 -L "root" /dev/mmcblk0p2
723719
724-
.. _flash-emmc-mmcsd-boot-uda-fs:
720+
**Verify partitions**
725721

726-
Flash eMMC for MMCSD boot from eMMC UDA in FS mode
727-
**************************************************
722+
Verify setup of :file:`mmcblk0p1` and :file:`mmcblk0p2` with :command:`lsblk` command.
723+
724+
.. code-block:: console
725+
726+
root@<machine>:~# lsblk -o name,mountpoint,label,size,uuid
727+
NAME MOUNTPOINT LABEL SIZE UUID
728+
mmcblk0 14.8G
729+
|-mmcblk0p1 boot 400M E4D4-4879
730+
`-mmcblk0p2 root 14.4G 74d40075-07e4-4bce-9401-6fccef68e934
731+
mmcblk0boot0 31.5M
732+
mmcblk0boot1 31.5M
733+
mmcblk1 29.7G
734+
|-mmcblk1p1 /run/media/boot-mmcblk1p1 boot 128M 681F-55DD
735+
`-mmcblk1p2 / root 8.7G ead4c8bb-fa37-4c4d-9ba3-47a1f3824764
736+
737+
.. _mmc-flash-emmc-uda:
738+
739+
Flash eMMC for MMCSD boot
740+
*************************
728741

729742
In this example, we show one simple method for flashing to eMMC for MMCSD boot from
730743
eMMC UDA in FS mode. Please know this is not the only method for flashing the eMMC
731744
for this bootmode.
732745

733746
This example assumes the current bootmode is MMCSD boot from SD (FS mode)
734747

735-
Flash to eMMC "boot" software partition
736-
=======================================
748+
.. _mmc-flash-emmc-uda-boot:
749+
750+
Flash to eMMC "boot" partition
751+
==============================
737752

738753
.. code-block:: console
739754
740-
root@<machine>:~# mkdir eboot sdboot
741-
root@<machine>:~# mount /dev/mmcblk0p1 eboot
742-
root@<machine>:~# mount /dev/mmcblk1p1 sdboot
755+
root@<machine>:~# umount /run/media/*
756+
root@<machine>:~# mkdir /mnt/eboot /mnt/sdboot
757+
root@<machine>:~# mount /dev/mmcblk0p1 /mnt/eboot
758+
root@<machine>:~# mount /dev/mmcblk1p1 /mnt/sdboot
743759
744760
Verify the partitions are mounted to the correct folders using :command:`lsblk` command in the
745761
column labeled :file:`MOUNTPOINTS`.
@@ -749,36 +765,35 @@ column labeled :file:`MOUNTPOINTS`.
749765
root@<machine>:~# lsblk
750766
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
751767
mmcblk0 179:0 0 14.8G 0 disk
752-
|-mmcblk0p1 179:1 0 400M 0 part /root/eboot
768+
|-mmcblk0p1 179:1 0 400M 0 part /mnt/eboot
753769
`-mmcblk0p2 179:2 0 14.4G 0 part
754770
mmcblk0boot0 179:32 0 31.5M 1 disk
755771
mmcblk0boot1 179:64 0 31.5M 1 disk
756772
mmcblk1 179:96 0 29.7G 0 disk
757-
|-mmcblk1p1 179:97 0 128M 0 part /root/sdboot
758-
| /run/media/boot-mmcblk1p1
773+
|-mmcblk1p1 179:97 0 128M 0 part /mnt/sdboot
759774
`-mmcblk1p2 179:98 0 8.7G 0 part /
760775
761776
Now we can copy bootloader binaries to eMMC and umount the partitions when writes finish.
762777

763778
.. code-block:: console
764779
765-
root@<machine>:~# cd sdboot/
766-
root@<machine>:~# ls
780+
root@<machine>:~# ls /mnt/sdboot/
767781
tiboot3.bin tispl.bin u-boot.img uEnv.txt
768-
root@<machine>:~# cp tiboot3.bin tispl.bin u-boot.img ../eboot/
769-
root@<machine>:~# cd ../ && umount sd* && umount e*
782+
root@<machine>:~# cp /mnt/sdboot/* /mnt/eboot/
783+
root@<machine>:~# sync && umount /mnt/*
770784
771-
.. _flash-emmc-mmcsd-boot-uda-fs-root:
785+
.. _mmc-flash-emmc-uda-root:
772786

773-
Flash to eMMC "root" software partition
774-
=======================================
787+
Flash to eMMC "root" partition
788+
==============================
775789

776790
.. code-block:: console
777791
778-
root@<machine>:~# mkdir eroot sdroot
779-
root@<machine>:~# mount /dev/mmcblk0p2 eroot
792+
root@<machine>:~# umount /run/media/*
793+
root@<machine>:~# mkdir /mnt/eroot /mnt/sdroot
794+
root@<machine>:~# mount /dev/mmcblk0p2 /mnt/eroot
780795
[69229.982452] EXT4-fs (mmcblk0p2): mounted filesystem 74d40075-07e4-4bce-9401-6fccef68e934 r/w with ordered data mode. Quota mode: none.
781-
root@<machine>:~# mount /dev/mmcblk1p2 sdroot
796+
root@<machine>:~# mount /dev/mmcblk1p2 /mnt/sdroot
782797
783798
Verify the partitions are mounted to the correct folders using :command:`lsblk` command in the
784799
column labeled :file:`MOUNTPOINTS`.
@@ -789,23 +804,38 @@ column labeled :file:`MOUNTPOINTS`.
789804
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
790805
mmcblk0 179:0 0 14.8G 0 disk
791806
|-mmcblk0p1 179:1 0 400M 0 part
792-
`-mmcblk0p2 179:2 0 14.4G 0 part /root/eroot
807+
`-mmcblk0p2 179:2 0 14.4G 0 part /mnt/eroot
793808
mmcblk0boot0 179:32 0 31.5M 1 disk
794809
mmcblk0boot1 179:64 0 31.5M 1 disk
795810
mmcblk1 179:96 0 29.7G 0 disk
796811
|-mmcblk1p1 179:97 0 128M 0 part
797-
| /run/media/boot-mmcblk1p1
798-
`-mmcblk1p2 179:98 0 8.7G 0 part /root/sdroot
812+
`-mmcblk1p2 179:98 0 8.7G 0 part /mnt/sdroot
799813
/
800814
801-
Now we can copy rootfs to eMMC and umount the partitions when writes finish.
815+
Now we can copy rootfs to eMMC (either from SD rootfs or from tarball) and umount the partitions
816+
when writes finish.
817+
818+
**From SD**
802819

803820
.. code-block:: console
804821
805-
root@<machine>:~# cd sdroot
806-
root@<machine>:~# ls
822+
root@<machine>:~# ls /mnt/sdroot
807823
bin dev home lost+found mnt proc run srv tmp var
808824
boot etc lib media opt root sbin sys usr
809-
root@<machine>:~# cp -r ./* ../eroot/
810-
root@<machine>:~# cd ../ && umount sd* && umount e*
825+
root@<machine>:~# cp -r -a /mnt/sdroot/* /mnt/eroot
826+
root@<machine>:~# sync
827+
root@<machine>:~# umount /mnt/*
811828
[70154.205154] EXT4-fs (mmcblk0p2): unmounting filesystem 74d40075-07e4-4bce-9401-6fccef68e934.
829+
830+
**From tarball**
831+
832+
This sections requires for tisdk-base-image-<soc>evm.rootfs.tar.xz to have been previously copied
833+
to the SD card rootfs.
834+
835+
.. code-block:: console
836+
837+
root@<machine>:~# ls
838+
tisdk-base-image-<soc>-evm.rootfs.tar.xz
839+
root@<machine>:~# tar -xpf tisdk-base-image-<soc>-evm.rootfs.tar.xz -C /mnt/eroot
840+
root@<machine>:~# sync
841+
root@<machine>:~# umount /mnt/*

0 commit comments

Comments
 (0)