This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
file_system [2017/08/14 20:13] 1.241.172.144 |
file_system [2017/08/14 21:35] (current) 1.241.172.144 |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== 최소사양으로 rootfs 만드는 법 ===== | ===== 최소사양으로 rootfs 만드는 법 ===== | ||
| + | |||
| + | 우선 현재 설치되어 있는 컴파일러를 사용할 예정이다. | ||
| + | linaro에서 다운받은 컴파일러 이다. | ||
| + | |||
| + | 1. 간단한 형태의 root filesystem 의 레이아웃을 우선 간단하게 잡아본다. | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_000.jpg}} | ||
| + | |||
| + | 2. 레이아웃에 맞게 디렉토리를 생성 | ||
| + | |||
| + | $ mkdir rootfs | ||
| + | $ cd rootfs | ||
| + | $ mkdir bin dev etc lib proc sys sbin usr | ||
| + | $ mkdir etc/init.d usr/bin usr/sbin | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_001.jpg}} | ||
| + | |||
| + | 3. Busybox 를 복제 | ||
| + | |||
| + | $ cd .. | ||
| + | $ git clone git://busybox.net/busybox.git | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_002.jpg}} | ||
| + | |||
| + | 4. Busybox 설정 | ||
| + | |||
| + | $ cd busybox | ||
| + | $ make defconfig | ||
| + | $ make menuconfig | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_003.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_004.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_005.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_006.jpg}} | ||
| + | |||
| + | Settings--->Build static library\\ | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_007.jpg}} | ||
| + | |||
| + | Settings->Cross Compile prefix : ~/VI/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf\bin\arm-linux-gnueabihf-\\ | ||
| + | ->설치된 자신의 크로스 컴파일러의 경로를 사용한다. | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_008.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_009.jpg}} | ||
| + | |||
| + | Settings->Destination path for 'make install' : ~/VI/rootfs\\ | ||
| + | ->위에서 만들었던 root file system 폴더 | ||
| + | |||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_010.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_011.jpg}} | ||
| + | {{wiki:atmel_sama5d42:rootfs:rootfs_012.jpg}} | ||
| + | |||
| + | 5. Busybox 를 빌드하고 인스톨 | ||
| + | |||
| + | $ make | ||
| + | $ make install | ||
| + | |||
| + | 6. 이제 BusyBox나 그 외 실행파일들이 사용하는 Shared library를 lib 폴더로 복사한다. | ||
| + | |||
| + | $ cp -a ~/x-tools/arm-cortexa5-linux-uclibcgnueabihf/arm-cortexa5-linux-uclibcgnueabihf/sysroot/lib/* ./lib | ||
| + | |||
| + | 7. 이제 inittab 파일과 rcS 파일을 설정하여, /proc /sys 폴더를 마운트한다. | ||
| + | inittab 파일 샘플은 busybox 소스폴더의 example 폴더에 있다. | ||
| + | 우선 이 파일을 복사한 후 수정한다. | ||
| + | |||
| + | $ cd ~/VI/busybox/examples | ||
| + | $ cp inittab ~/VI/rootfs/etc | ||
| + | $ cd ~/VI/rootfs/etc | ||
| + | $ vi inittab | ||
| + | |||
| + | ::sysinit:/etc/init.d/rcS | ||
| + | | ||
| + | # Start an "askfirst" shell on the console (whatever that may be) | ||
| + | ttyS0::askfirst:/bin/sh | ||
| + | | ||
| + | # Start an "askfirst" shell on /dev/tty2-4 | ||
| + | tty2::askfirst:/bin/sh | ||
| + | tty3::askfirst:/bin/sh | ||
| + | tty4::askfirst:/bin/sh | ||
| + | | ||
| + | # Stuff to do when restarting the init process | ||
| + | ::restart:/sbin/init | ||
| + | | ||
| + | # Stuff to do before rebooting | ||
| + | ::ctrlaltdel:/sbin/reboot | ||
| + | ::shutdown:/bin/umount -a -r | ||
| + | ::shutdown:/sbin/swapoff -a | ||
| + | |||
| + | $ cd ~/VI/rootfs/etc/init.d | ||
| + | $ vi rcS | ||
| + | |||
| + | #!/bin/sh | ||
| + | mount -t proc proc /proc | ||
| + | mount -t sysfs sysfs /sys | ||
| + | |||
| + | 8. 앞서 구성했던 레이아웃을 다시 한번 살펴보면 아래와 같이 구성되어진 것을 확인할 수 있다. | ||
| + | $ tree -d | ||
| + | . | ||
| + | ├── bin => BusyBox에 의해서 구성 | ||
| + | ├── dev => Kernel의 devtmpfs 에 의해서 구성 | ||
| + | ├── etc => inittab 파일 추가 | ||
| + | │ └── init.d => rc.S 파일 추가 | ||
| + | ├── lib => sysroot/lib 폴더에서 파일 복사 | ||
| + | ├── proc => rcS 파일에서 마운트 | ||
| + | ├── sbin => BusyBox에 의해서 구성 | ||
| + | ├── sys => rcS 파일에서 마운트 | ||
| + | ├── usr => BusyBox에 의해서 구성 | ||
| + | ├── bin | ||
| + | └── sbin | ||
| + | |||
| + | 이를 NFS로 하여 사용해 본다. | ||
| + | |||
| ===== Buildroot로 rootfs 만드는 법 ===== | ===== Buildroot로 rootfs 만드는 법 ===== | ||
| - | {{wiki:atmel_sama5d42:nfs:nfs_1.jpg}} | + | ===== Yocto Poky로 rootfs 만드는 법 ===== |
| + | |||