[bootlin/training-materials updates] master: Add a sdcard.img to simplify the process (ae2a3ef3)
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Fri Oct 29 10:46:37 CEST 2021
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/ae2a3ef3ce942046dcbc18d6551c5fbc1e7c10c9
>---------------------------------------------------------------
commit ae2a3ef3ce942046dcbc18d6551c5fbc1e7c10c9
Author: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Date: Mon May 3 09:58:16 2021 +0200
Add a sdcard.img to simplify the process
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
>---------------------------------------------------------------
ae2a3ef3ce942046dcbc18d6551c5fbc1e7c10c9
.../common/bootloader/beaglebone-black/README.txt | 36 ++++++---------------
lab-data/common/bootloader/beaglebone-black/gen.sh | 10 ++++++
.../bootloader/beaglebone-black/genimage.cfg | 25 ++++++++++++++
.../common/bootloader/beaglebone-black/sdcard.img | Bin 0 -> 6291968 bytes
4 files changed, 44 insertions(+), 27 deletions(-)
diff --git a/lab-data/common/bootloader/beaglebone-black/README.txt b/lab-data/common/bootloader/beaglebone-black/README.txt
index 27bcf205..c6398e5b 100644
--- a/lab-data/common/bootloader/beaglebone-black/README.txt
+++ b/lab-data/common/bootloader/beaglebone-black/README.txt
@@ -32,34 +32,10 @@ partitions. Umount them with a command such as
'sudo umount /dev/mmcblk0p1' or 'sudo umount /dev/sdb1',
depending on how the system sees the media card device.
-Now type the below command to partition the micro-SD card
-(we assume that the card is seen as '/dev/mmcblk0'):
+Now type the below command to flash your micro-SD card (we assume that
+the card is seen as '/dev/mmcblk0'):
-sudo sfdisk /dev/mmcblk0 << EOF
-1,,0xE,*
-EOF
-
-Remove the SD card and insert it again (to make sure new
-partitions are detected properly)
-
-Now, format the first partition in FAT format:
-
-sudo mkfs.vfat -F 32 /dev/mmcblk0p1 -n boot
-
-Remove the card and insert it again. It should automatically be mounted
-on '/media/$USER/boot'.
-
-Now, copy the below files to this partition:
-
-cp zImage dtb MLO MLO.final u-boot.img u-boot.img.final MBR /media/$USER/boot
-
-Note that we're using two versions of U-Boot:
-- MLO, u-boot.img: just used for booting from external MMC and booting the kernel/rootfs
- that will reflash U-Boot
-- MLO.final, u-boot.img.final: corresponding to U-Boot that we flash
- on the board.
-
-Now, unmount '/media/$USER/boot' and you are done!
+sudo dd if=sdcard.img of=/dev/mmcblk0 bs=1M
Using your bootable micro-SD card
---------------------------------
@@ -204,3 +180,9 @@ Copy the arch/arm/boot/dts/am335x-boneblack-wireless.dtb to "dtb"
(this dtb will work fine for both BeagleBone Black
and BeagleBoneBlack Wireless, at least for the purpose of
reflashing U-Boot).
+
+Assembling all files into sdcard.img
+------------------------------------
+
+This is done using the ./gen.sh script, which itself uses the genimage
+tool.
diff --git a/lab-data/common/bootloader/beaglebone-black/gen.sh b/lab-data/common/bootloader/beaglebone-black/gen.sh
new file mode 100755
index 00000000..b8409ed7
--- /dev/null
+++ b/lab-data/common/bootloader/beaglebone-black/gen.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+trap 'rm -rf "${ROOTPATH_TMP}" "${GENIMAGE_TMP}"' EXIT
+ROOTPATH_TMP="$(mktemp -d)"
+GENIMAGE_TMP="$(mktemp -d)"
+genimage \
+ --rootpath "${ROOTPATH_TMP}" \
+ --tmppath "${GENIMAGE_TMP}" \
+ --inputpath . \
+ --outputpath . \
+ --config genimage.cfg
diff --git a/lab-data/common/bootloader/beaglebone-black/genimage.cfg b/lab-data/common/bootloader/beaglebone-black/genimage.cfg
new file mode 100644
index 00000000..f682b461
--- /dev/null
+++ b/lab-data/common/bootloader/beaglebone-black/genimage.cfg
@@ -0,0 +1,25 @@
+image boot.vfat {
+ vfat {
+ files = {
+ "zImage",
+ "dtb",
+ "MLO",
+ "MLO.final",
+ "u-boot.img",
+ "u-boot.img.final",
+ "MBR"
+ }
+ }
+ size = 6M
+}
+
+image sdcard.img {
+ hdimage {
+ }
+
+ partition boot {
+ partition-type = 0xC
+ bootable = "true"
+ image = "boot.vfat"
+ }
+}
diff --git a/lab-data/common/bootloader/beaglebone-black/sdcard.img b/lab-data/common/bootloader/beaglebone-black/sdcard.img
new file mode 100644
index 00000000..d7e771f4
Binary files /dev/null and b/lab-data/common/bootloader/beaglebone-black/sdcard.img differ
More information about the training-materials-updates
mailing list