====== SD Card から起動する (bootloader 含む) ======
\\
===== Files =====
^ File ^ Stat ^ SHA1SUM ^ Note |
|{{ :max3xx_tips:boot_from_sd:sd_p1.tar.zst |}}|2022/12/15 09:59 8.1 MB|2c5deab7a525a261c08c2e00c6eafba27ad5edf8|SD partition1(試作機用)|
|{{ :max3xx_tips:boot_from_sd:sd_am6412_p1.tar.zst |}}|2023/03/10 13:40 8.2 MB|d03f4e4a49a7264b50509a11aa66dd013b112d47| 〃 (量産機用) |
\\
===== SDCard 作成手順 =====
==== fdisk ====
root@metis:/tmp# fdisk /dev/mmcblk1
Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/mmcblk1: 1.87 GiB, 2002780160 bytes, 3911680 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: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 3911679 3909632 1.9G c W95 FAT32 (LBA)
* 出荷時の FAT32 Partition 削除 (Optional)
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
* No.1 Partition 作成 (FAT32, 256MB)
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-3911679, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3911679, default 3911679): +256M
Created a new partition 1 of type 'Linux' and of size 256 MiB.
Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
* No.2 Partition 作成 (Linux, 残り全部)
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 (526336-3911679, default 526336):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (526336-3911679, default 3911679):
Created a new partition 2 of type 'Linux' and of size 1.6 GiB.
* 確認、書込して終了
Command (m for help): p
Disk /dev/mmcblk1: 1.87 GiB, 2002780160 bytes, 3911680 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: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk1p2 526336 3911679 3385344 1.6G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
\\
==== make filesystem ====
root@metis:/tmp# mkfs.vfat /dev/mmcblk1p1
mkfs.fat 4.2 (2021-01-31)
root@metis:/tmp# mkfs.ext4 -m 0 /dev/mmcblk1p2
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done
Creating filesystem with 423168 4k blocks and 105872 inodes
Filesystem UUID: a20ecf5a-b0ce-4d1f-8464-283bd34fc3e4
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
\\
==== ファイル展開 ====
=== Partition No.1 ===
root@metis:/tmp# mount /dev/mmcblk1p1 /mnt/sd/
root@metis:/tmp# cd /mnt/sd/
root@metis:/mnt/sd# tar axf /tmp/sd_p1.tar.zst
root@metis:/mnt/sd# sync
root@metis:/mnt/sd# cd ..
root@metis:/mnt# umount /mnt/sd
=== Partition No.2 ===
root@metis:/mnt# mount /dev/mmcblk1p2 /mnt/sd/
root@metis:/mnt# cd sd/
ここに [[download_software:max3xx:start|開発用 - Ubuntu 22.04LTS(Jammy Jellyfish) ベース]] に置いてある、root filesystem のアーカイブ(tar.xz ファイル)を展開
\\
==== boot ====
DIPSW OFF-**ON**-OFF-**ON** (SD boot, SD root filesystem で起動)