ユーザ用ツール

サイト用ツール


max3xx_tips:boot_from_sd:start

SD Card から起動する (bootloader 含む)


Files

File Stat SHA1SUM Note
sd_p1.tar.zst2022/12/15 09:59 8.1 MB2c5deab7a525a261c08c2e00c6eafba27ad5edf8SD partition1(試作機用)
sd_am6412_p1.tar.zst2023/03/10 13:40 8.2 MBd03f4e4a49a7264b50509a11aa66dd013b112d47 〃 (量産機用)


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 filesystem アーカイブの展開)

SD Card ファイルシステムの mount

root@metis:/mnt# mount /dev/mmcblk1p2 /mnt/sd/

ここに USB Memory や SFTP などで持ってきて、mount した場所で展開します。

root@metis:~# cd /mnt/sd/
root@metis:/mnt/sd# tar axf /tmp/MAX3xx_rootfs_jammy_v6_1_1.tar.xz 
root@metis:/mnt/sd#   
root@metis:/mnt/sd# ls -l
total 76
lrwxrwxrwx  1 root root     7 Dec 15  2021 bin -> usr/bin
drwxr-xr-x  2 root root  4096 Dec  5 08:27 boot
drwxr-xr-x  4 root root  4096 Aug 21 08:40 dev
drwxr-xr-x 78 root root  4096 Dec  2 07:58 etc
drwxr-xr-x  3 root root  4096 Aug 21 08:40 home
lrwxrwxrwx  1 root root     7 Dec 15  2021 lib -> usr/lib
drwx------  2 root root 16384 Dec 19 16:58 lost+found
drwxr-xr-x  2 root root  4096 Aug 21 08:40 media
drwxr-xr-x  5 root root  4096 Aug 21 08:40 mnt
drwxr-xr-x  3 root root  4096 Aug 21 08:40 opt
drwxr-xr-x  2 root root  4096 Aug 21 08:40 proc
drwx------  4 root root  4096 Dec  2 07:58 root
drwxr-xr-x 12 root root  4096 Sep 13 10:34 run
lrwxrwxrwx  1 root root     8 Dec 15  2021 sbin -> usr/sbin
drwxr-xr-x  2 root root  4096 Aug 21 08:40 srv
drwxr-xr-x  2 root root  4096 Aug 21 08:40 sys
drwxrwxrwt  2 root root  4096 Dec  5 08:23 tmp
drwxr-xr-x 11 root root  4096 Aug 21 08:40 usr
drwxr-xr-x 12 root root  4096 Aug 21 08:40 var
root@metis:/mnt/sd# 

Kernel module のコピー

起動している Kernel の Kernel module を SD Card にコピーします。

これをコピーしておかないと、driver が組み込めず LTE など各種デバイスが使用できません。
本体のファームウェアが変更された場合もコピーし直しが必要です。
root@metis:/mnt/sd# cd lib/modules
root@metis:/mnt/sd/lib/modules# cp -af /lib/modules/6.1.46 .
root@metis:/mnt/sd/lib/modules# ls -l
total 4
drwxr-xr-x 3 root root 4096 Dec  2 08:00 6.1.46
root@metis:/mnt/sd/lib/modules# 


SD Card の umount

unmount しておきます。

root@metis:/mnt/sd/lib/modules# cd
root@metis:~# umount /mnt/sd 
root@metis:~# 


boot

DIPSW OFF-ON-OFF-ON (SD boot, SD root filesystem で起動)
max3xx_tips/boot_from_sd/start.txt · 最終更新: 2024/09/02 17:39 by サポート