Boot Stage | Terminology #1 | Terminology #2 | Actual Program Name |
---|---|---|---|
1 | Primary Program Loader | - | ROM code |
2 | Secondary Program Loader(SPL) | 1st stage bootloader | u-boot SPL (여기서는 MLO) |
3 | - | 2nd stage bootloader | u-boot |
4 | - | - | kernel |
I. ROM
1st stage bootloader: ROM Code
II. SPL
2nd stage bootloader: SPL
III. u-boot
3rd stage bootloader: u-boot
mmcblk0p2
)에 포함되며, ext3 파일시스템으로 포맷된다.lsblk
로 어떻게 마운트 되있는지 찾아보기umount
$ umount /dev/sda1
$ umount /dev/sda2
fdisk
명령 실행, 이전 파티션 제거$ sudo fdisk /dev/sda # sda1 같은게 아닌 '디바이스 기준'
Command (m for help): d # d는 파티션 삭제 명령
Selected partition 1
...중략
Command (m for help): d
Selected partition 2
Partition 2 has been deleted.
Command (m for help): p # p로 디바이스 정보 조회
Disk /dev/sda: 29.8 GiB, 32026656768 bytes, 62552064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (local/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7b59cb23
Command (m for help):
Command (m for help): n # n 으로 새로운 파티션 생성
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p # p나 엔터를 쳐도 디폴트로 primary된다.
Partition number (1-4, default 1): 1 # 파티션 넘버 1 지정
First sector (2048-62552063, default 2048): # First Sector: 2048
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62552063, default 62552063): +32M # 2048 + 32MB
Created a new partition 1 of type 'Linux' and of size 32 MiB.
Partition #1 contains a vfat signature.
Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (67584-62552063, default 67584):
Using default value 67584
Last sector, +sectors or +size{K,M,G} (67584-62552063, default 62552063):
Create a new partition 2 of type 'Linux' and of size 29.8 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.
first partition은 boot flag 설정
fdisk
에서 a
옵션은 부팅 파티션 설정이다.Command (m for help): a
Partition number (1,2, default 2): 1
The bootable flag on partition 1 is enabled now.
Command (m for help): t # t 명령은 파티션의 시스템 ID 변경(파일 시스템 종류 변경)
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): L
...중략...
c W95 FAT32 (LBA)
...중략...
Hex code (type L to list all codes): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): p
Disk /dev/sda: 29.8 GiB, 32026656768 bytes, 62552064 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: 0x7b59cb23
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 67583 65536 32M c w95 FAT32 (LBA)
/dev/sda2 67584 62552063 62484480 29.8G 83 Linux
Filesystem/RAID signature on partition 1 will be wiped.
Filesystem/RAID signature on partition 2 will be wiped.
Command (m for help): w # 꼭 w 로 저장후 fdisk 명령을 종료해야함
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
$ sudo mkfs.vfat -n "BOOT" /dev/sda1
$ sudo mkfs.ext4 -L "ROOT" /dev/sda2
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 7810560 4k blocks and 1954064 inodes
Filesystem UUID: eb928e08-5745-4b1a-9f16-31c17af70077
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: # 1~2 분 소요됨 -> done
/media/${USER}
에 마운트된다.$ sudo mount /dev/sda1 /media/${USER}/BOOT
$ sudo mount /dev/sda2 /media/${USER}/ROOT
$ mount
...중략...
/dev/sda2 on /media/$USER/ROOT type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
/dev/sda1 on /media/$USER/BOOT type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
$ sudo cp MLO /media/${USER}/BOOT
$ sudo cp u-boot.img /media/${USER}/BOOT
$ sudo cp zImage /media/${USER}/BOOT
$ sudo cp am335x-boneblack.dtb/${USER}/BOOT
Check files
$ sudo tar -xf core-image-minimal-beaglebone-yocto.tar.bz2 -C /media/${USER}/ROOT
Check files
$ sync
명령!!sync
명령sync
명령을 내려 동기화$ sudo umount /media/$USER/BOOT
$ sudo umount /media/$USER/ROOT
Host와 Target(beaglebone black)을 시리얼 통신
USB TTL-2303(PL2303) for serial communication
J1 Pin | USB TTL Function |
---|---|
1 | GND ground |
4 | RXL |
5 | TXL |
$ dmesg
$ sudo minicom -s
minicom
명령으로 Target과 Serial 통신위와 같이 설정후 Save setup as...
dfl
은 디폴트임로그인 화면이 뜬다.
beaglebone-yocto logrin:
root
로그인 성공
# mmc dev 1
# mmc erase 0 512
https://layers.openembedded.org/layerindex/branch/master/layers/
에서 라즈베리파이 BSP 레이어 다운로드git clone
한다.$ git clone git://git.yoctoproject.org/meta-raspberrypi
주의!! poky 브랜치와 같은 코드네임으로 checkout!
meta-openembedded
레이어 다운!$ git clone git://git.openembedded.org/meta-openembedded
meta-raspberrypi
레이어는 meta-openembedded 에서 meta-oe
, meta-multimedia
, meta-networking
, meta-python
레이어 사용함을 명심build/conf/bblayers.conf
에 meta-raspberrypi 레이어와 하위 디펜던시 레이어를 추가한다.$ bitbake-layers show-layers
build/conf/local.conf
에 MACHINE
변수에 추가할 MACHINE.conf 레시피 확인conf/machine
에서 확인build/conf/local.conf
에 MACHINE = "raspberrypi4-64"
으로 변경
추가적으로 저장공간 아끼고 싶으면 INHERIT += "rm_work"
추가
meta-raspberrypi
BSP 레이어에서 지원하는 이미지 체크$ ls poky/meta-raspberrypi/recipes-*/images
build/conf/local.conf
에서 ENABLE_UART = "1"
하면 UART 사용 가능$ bitbake rpi-basic-image
poky/build/tmp/deploy/images/raspberrypi3/rpi-basic-image-raspberrypi3.wic.bz2 생성확인
주의!! wic
파일이 이미지파일임
1. wic.bz2 -> $ bunzip2 로 bz2 압축풀기 -> wic 파일만 flash 해야함
2. $ bunzip2 -f ./image.wic.bz2
3. $ wic ls ./image.wic
로 확인 (wic는 현재 쉘이 source oe-init-env
가 적용된 상태에서 사용할 수 있음)
4. flash
$ sudo dd if=[img위치]/rpi-basic-image-raspberrypi3.wic of=/dev/sdb bs=4096 status=progress && sync
$ sudo eject /dev/sdb
RPI
Stage 1 Booting - OnChip ROM
Stage 2 Booting - bootcode.bin
Stage 3 Booting - start.elf
J8 Pin | USB TTL Function |
---|---|
6 | GND |
8 | RXL |
10 | TXL |
$ sudo minicom -s
-> Serial port setup -> 115200 8N1
-> Save setup as dfl
192.168.0.100
이다.Default value : 0
IMAGE_ROOTFS_EXTRA_SPACE = "4194304"
build $ bitbake -e rpi-basic-image | grep ^IMAGE_ROOTFS_EXTRA_SPACE=
build/conf/local.conf
에서 IMAGE_ROOTFS_EXTRA_SPACE = "4194304"
$ bitbake rpi-basic-image
$ sudo dd if=rpi-basic-image-raspberrypi4.rpi-sdimg of=/dev/sdb bs=4096 && sync