guileschool/BEAGLEBONE-tutorials

mkcard 문제

Closed this issue · 8 comments

2016-09-02 19 42 52

mkcard.sh를 실행했을 때 위의 사진처럼 정상적으로 완료가 되지 않습니다.
제대로 완료되지 않아 보드에 삽입하고 부팅 했을 때도 반응이 없는 것 같습니다.

SD카드를 바꿔가면서 해봤지만 동일한 증상이 나타납니다.
어떤 식으로 해결 가능할까요?
걸림돌이 생길 때 마다 질문을 올리는 것 같아 죄송합니다 ㅠ.ㅠ
아직 리눅스에 익숙하지 못해서 이것저것 검색 해보면서 하는데 잘 안되는 부분도 있어서요~
답변 부탁드립니다.

추가적으로 minicom 사용 시 serial 설정을 변경하지 않고도 그냥 사용 가능한가요?
minicom serial을 변경하여 사용중인데 올려주신 내용만으로도 사용 가능한건지 궁금합니다.

mkcard.sh 스크립트에 오류가 있네요. 수정하였습니다 --> 7783c0b
다시 해봐도 안되거든 해당 sd카드를 윈도우나 다른 시스템에서 포맷을 해주시고 mkcard.sh 로 다시 시도해 보세요.

minicom -D/dev/ttyUSB0 혹은 minicom -D/dev/ttyUSB1 로 하시면 될 겁니다

새로 clone 하고 수정된 내용 확인 한 뒤에 실행 해봤는데도 동일한 증상이 나옵니다.
SD카드 부팅 버튼 누르고 전원을 넣으면 C만 반복적으로 나타납니다.

SD카드 부팅 버튼(S2)을 누른 상태를 유지하고 전원을 입력하신거 맞죠?

나의 4G용량 SD카드 초기화 영상을 공유합니다 http://d.pr/v/UtRE/2Xhj7UJn+

초기화 이후 SD카드에 파일이 유효함을 다음과 같이 확인합니다

user@ubuntu:/media/boot$ ls
MLO  rtosdemo.bin  u-boot.img  uEnv.txt
user@ubuntu:/media/boot$ ll
합계 436
drwx------ 2 user user   4096  1월  1  1970 ./
drwxr-xr-x 4 root root   4096  9월  4 19:55 ../
-rw-r--r-- 1 user user  67364  9월  4 19:45 MLO
-rw-r--r-- 1 user user  31680  9월  4 19:45 rtosdemo.bin
-rw-r--r-- 1 user user 330136  9월  4 19:45 u-boot.img
-rw-r--r-- 1 user user   1403  9월  4 19:45 uEnv.txt
user@ubuntu:/media/boot$ 

아래는 로그입니다

user@ubuntu:~/Desktop/BEAGLEBONE-tutorials/BBB-firmware/mkcard$ sudo ./mkcard.sh 


################################################################################

This script will create a bootable SD card from custom or pre-built binaries.

Example:
 $ sudo ./mkcard.sh

Formatting can be skipped if the SD card is already formatted and
partitioned properly.

################################################################################

ROOTDRIVE=sda

Availible Drives to write images to: 

#  major   minor    size   name 
1:   8       32    3872256 sdc

Enter Device Number or n to exit: 1

DEVICEDRIVENAME=sdc
sdc was selected

/dev/sdc is an sdx device
Current size of sdc1 3630689 bytes
Current size of sdc2 234484 bytes

################################################################################

    Select 2 partitions if only need boot and rootfs (most users)
    Select 3 partitions if need SDK & CCS on SD card.  This is usually used
        by device manufacturers with access to partition tarballs.

    ****WARNING**** continuing will erase all data on sdc

################################################################################


################################################################################

        Now making 2 partitions

################################################################################

1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 1.32929 s, 789 kB/s
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x18d847fc.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): 
Disk /dev/sdc: 3965 MB, 3965190144 bytes
122 heads, 62 sectors/track, 1023 cylinders, total 7744512 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
Disk identifier: 0x18d847fc

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): No partition is defined yet!

Command (m for help): 4: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): No partition is defined yet!

Command (m for help): 3: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): No partition is defined yet!

Command (m for help): 2: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): No partition is defined yet!

Command (m for help): 1: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
DISK SIZE - 3965190144 bytes HEAD - 122 SECTORS - 62
CYLINDERS - 1023
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdc: 1023 cylinders, 122 heads, 62 sectors/track
Old situation:
Units = cylinders of 3872768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdc1          0       -       0          0    0  Empty
/dev/sdc2          0       -       0          0    0  Empty
/dev/sdc3          0       -       0          0    0  Empty
/dev/sdc4          0       -       0          0    0  Empty
New situation:
Units = cylinders of 3872768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdc1   *      0+    959     960-   3630689    c  W95 FAT32 (LBA)
/dev/sdc2        961    1022      62     234484   83  Linux
/dev/sdc3          0       -       0          0    0  Empty
/dev/sdc4          0       -       0          0    0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

################################################################################

        Partitioning Boot

################################################################################
mkfs.vfat 3.0.12 (29 Oct 2011)

################################################################################

        Partitioning rootfs

################################################################################
mke2fs 1.42 (29-Nov-2011)
Filesystem label=rootfs
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
58696 inodes, 234484 blocks
11724 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
29 block groups
8192 blocks per group, 8192 fragments per group
2024 inodes per group
Superblock backups stored on blocks: 
    8193, 24577, 40961, 57345, 73729, 204801, 221185

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done 



################################################################################

        Partitioning is now done
        Continue to install filesystem or select 'n\' to safe exit
        Warning Continuing will erase files any files in the partitions

################################################################################

Would you like to continue? [y/n] : y



Mount the partitions 

Emptying partitions 


Syncing....


now installing:  /home/user/바탕화면/BEAGLEBONE-tutorials/BBB-firmware/mkcard
################################################################################

    Copying files now... will take minutes

################################################################################

Copying boot partition

MLO copied


u-boot.img copied
rtosdemo.bin copied

uEnv.txt copied



Syncing...

Un-mount the partitions 

Remove created temp directories 

Operation Finished

user@ubuntu:~/Desktop/BEAGLEBONE-tutorials/BBB-firmware/mkcard$

mkcard_darby.txt

제가 mkcard.sh를 실행한 결과입니다.
"Could not delete partition 1"이라는 오류가 뜨면서 정상 동작하지 않는듯 합니다.
사용한 SD카드는 8GB이며 윈도우에서 포맷 후에 우분투에서 인식한 것을 확인 하고 실행 하였습니다.

그리고 추가적으로 USB나 CD ROM이 /media 에 위치하는 것이 아니라
/media/user 아래에 위치합니다. 구글링하면서 본 자료들은 /media바로 아래 있던데 이건 관련 없는건가요?

다시 한번 해보세요. 설마 인터페이스카드에 문제가 있는 건 아니겠지요?
free-logo-micro-sd-card-1-64gb
$ sudo dd if=/dev/zero of=/dev/sdb bs=1024 count=10240 <---- 디스크 파티션 정보 강제 삭제
$ sudo ./mkcard.sh <---- 디스크 초기화

올려주신 로그, 제가 실행한 로그, mkcard.sh 파일을 천천히 비교해보면서 문제를 찾아보고 있습니다.

우선 fdisk가 실행 되면서부터 로그가 조금 달라집니다.(버전차이가 아닐까 싶습니다.)
fdisk를 command line으로 partition을 삭제하고, 생성하고, 변경해 봤을 때 없는이 동작하는걸 봐서는 인터페이스 카드나 fdsik 버전 문제는 아닐 것 같습니다.

문제로 보이는 부분이 sfdsik를 실행하는 부분입니다.
-D 옵션이 유효하지 않다고 나오면서 파티션이 제대로 생성되지 않는듯 합니다.
올려주신 로그에는 sdc 1, 2, 3, 4로 나뉘는 것이 보이는데 제가 실행한 결과에는 sdb가 나뉘지 않습니다.

스스로 해결해보고자 구글링을 열심히 해보고 있으나 sfdisk의 해당 옵션이 검색되지 않아 다시 코멘트 올립니다.

원인을 찾으신것 같습니다 ^^ . SungDarby님이 예상하신대로 sfdisk 버젼 문제인 듯 싶네요.

user@ubuntu:~$ sfdisk --help

Usage:
sfdisk [options] [...]

Options:
-s, --show-size list size of a partition
-c, --id change or print partition Id
--change-id change Id
--print-id print Id
-l, --list list partitions of each device
-d, --dump idem, but in a format suitable for later input
-i, --increment number cylinders etc. from 1 instead of from 0
-u, --unit units to be used; can be one of
S (sectors), C (cylinders), B (blocks), or M (MB)
-1, --one-only reserved option that does nothing currently
-T, --list-types list the known partition types
-D, --DOS for DOS-compatibility: waste a little space <--------------------- 문제의 옵션입니다
-E, --DOS-extended DOS extended partition compatibility
-R, --re-read make the kernel reread the partition table
-N change only the partition with this
-n do not actually write to disk
-O save the sectors that will be overwritten to
-I restore sectors from
-V, --verify check that the listed partitions are reasonable
-v, --version display version information and exit
-h, --help display this help text and exit

Dangerous options:
-f, --force disable all consistency checking
--no-reread do not check whether the partition is in use
-q, --quiet suppress warning messages
-L, --Linux do not complain about things irrelevant for Linux
-g, --show-geometry print the kernel's idea of the geometry
-G, --show-pt-geometry print geometry guessed from the partition table
-A, --activate[=] activate bootable flag
-U, --unhide[=] set partition unhidden
-x, --show-extended also list extended partitions in the output,
or expect descriptors for them in the input
--leave-last do not allocate the last cylinder
--IBM same as --leave-last
--in-order partitions are in order
--not-in-order partitions are not in order
--inside-outer all logicals inside outermost extended
--not-inside-outer not all logicals inside outermost extended
--nested every partition is disjoint from all others
--chained like nested, but extended partitions may lie outside
--onesector partitions are mutually disjoint

Override the detected geometry using:
-C, --cylinders set the number of cylinders to use
-H, --heads set the number of heads to use
-S, --sectors set the number of sectors to use

user@ubuntu:~$ sfdisk -v
sfdisk from util-linux 2.20.1 <-------------------------------------- 버젼정보

util-linux 2.20. 해당 버젼을 찾아서 설치하셔야 할 것 같습니다( 의존성 문제가 없어야 될 텐데요... )

sfdisk구버전 util-linux 2.20 vs sfdisk신버젼 util-linux 2.27

글 남겨주시면 제 가상 이미지(vmdk) 다운로드 링크를 알려 드리겠습니다

sfdisk_version

util-linux 버전을 낮추는 방법으로 실행해보니 정상적으로 동작 했습니다.
util-linux와 의존성이 있는 다른 프로그램들이 모두 정상적으로 동작하는지는 아직 잘 모르겠습니다.
(같이 공부하는 지인은 버전 낮춘 후에 우분투 부팅이 안되서 12.04 설치하는 방법으로 해결했습니다 ^^;)

빠른 답변 감사합니다!