SDカード作成に失敗して正常にブートしないことが多いので、
作成手順をまとめる。
以下では、/dev/sdcとしてマッピングされた前提で記載する。
Contents
SDカードフォーマット
VMware上のUbuntuに接続すると自動マウントするので、一旦すべて解除
$ sudo umount /dev/sdc1
$ sudo umount /dev/sdc2
fdiskでフォーマットする。
パーティション1:FAT32, 1GB
パーティション2:Linux(ext4), 残り全部
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ sudo fdisk /dev/sdc o # clear the in-memory partition table n # new partition p # primary partition 1 # partition number 1 # default - start at beginning of disk +1G # 1 GB boot partition t # type partition b # VFAT to type of partition number 1 n # new partition p # primary partition 2 # partition number 2 # default - start immediately after preceding partition # default - extend partition to end of disk p # print the in-memory partition table w # write the partition table q # and we're done |
それぞれのパーティションをフォーマット。
|
1 2 |
$ sudo mkfs.vfat -F 32 -n boot /dev/sdc1 $ sudo mkfs.ext4 -L rootfs /dev/sdc2 |
ファイルコピー
bootデバイス
bootデバイス用のファイルは、[path]/pfm/wksp1/[Application Name]/Hardware/sd_card の下にあるので、これをコピーする。
|
1 |
$ cp [path]/pfm/wksp1/[Application Name]/Hardware/sd_card/* /media/[User]/boot/ |
rootfsデバイス
rootfsデバイス用のファイルは、プラットフォームのものを使用。
[path]/[platform name]/images/linux/rootfs.tar.gz
|
1 |
$ sudo tar xvzf [path]/[platform name]/images/linux/rootfs.tar.gz -C /media/[User]/rootfs/ |
FAQ
rootfsデバイス書き込み失敗
ext4フォーマットをマウントした後、以下のようにkernel panicが発生する場合は、rootfsデバイスの書き込みが失敗している。
手順としては上記で記述してる方法を使ってるだけだが、やり直したら上手く行った。
VM上のUbuntuにローカルPCのUSBメモリを渡してるんだけど、umountがかなり遅く、Ctrl-Cで抜けて強制切断をしたのが悪さをしてた気がする。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
[ 4.905234] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [ 4.910721] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2 [ 4.918375] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed [ 4.925027] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. [ 4.933209] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 4.19 [ 4.941468] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 4.948685] usb usb2: Product: xHCI Host Controller [ 4.953554] usb usb2: Manufacturer: Linux 4.19.0-xilinx-v2019.2 xhci-hcd [ 4.960246] usb usb2: SerialNumber: xhci-hcd.0.auto [ 4.965401] hub 2-0:1.0: USB hub found [ 4.969166] hub 2-0:1.0: 1 port detected [ 4.975134] i2c i2c-0: Added multiplexed i2c bus 2 [ 4.980070] i2c i2c-0: Added multiplexed i2c bus 3 [ 4.984999] i2c i2c-0: Added multiplexed i2c bus 4 [ 4.989931] i2c i2c-0: Added multiplexed i2c bus 5 [ 4.995458] tps65086 6-005e: Failed to read revision register [ 5.001298] i2c i2c-0: Added multiplexed i2c bus 6 [ 5.006724] ina2xx 7-0040: error configuring the device: -6 [ 5.012336] i2c i2c-0: Added multiplexed i2c bus 7 [ 5.017268] i2c i2c-0: Added multiplexed i2c bus 8 [ 5.022201] i2c i2c-0: Added multiplexed i2c bus 9 [ 5.026994] pca954x 0-0075: registered 8 multiplexed busses for I2C switch pca9548 [ 5.034586] cdns-i2c ff030000.i2c: 100 kHz mmio ff030000 irq 30 [ 5.041482] cdns-wdt fd4d0000.watchdog: Xilinx Watchdog Timer with timeout 60s [ 5.048987] cdns-wdt ff150000.watchdog: Xilinx Watchdog Timer with timeout 10s [ 5.087750] mmc0: SDHCI controller on ff160000.mmc [ff160000.mmc] using ADMA 64-bit [ 5.101548] sdhci-arasan ff170000.mmc: allocated mmc-pwrseq [ 5.107191] sdhci-arasan ff170000.mmc: Linked as a consumer to regulator.1 [ 5.143766] mmc1: SDHCI controller on ff170000.mmc [ff170000.mmc] using ADMA 64-bit [ 5.161429] input: gpio-keys as /devices/platform/gpio-keys/input/input0 [ 5.168577] rtc_zynqmp ffa60000.rtc: setting system clock to 1970-01-01 00:00:08 UTC (8) [ 5.174180] mmc0: new high speed SDHC card at address aaaa [ 5.176669] of_cfs_init [ 5.183032] mmcblk0: mmc0:aaaa SC32G 29.7 GiB [ 5.184648] of_cfs_init: OK [ 5.191968] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 5.193788] mmcblk0: p1 p2 [ 5.248016] mmc1: new high speed SDIO card at address 0001 [ 5.331746] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 5.335751] usb 1-1: new high-speed USB device number 2 using xhci-hcd [ 5.338290] clk: Not disabling unused clocks [ 5.349052] ALSA device list: [ 5.352010] #0: DisplayPort monitor [ 5.356171] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 [ 5.364787] cfg80211: failed to load regulatory.db [ 5.401048] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null) [ 5.409166] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 5.418992] devtmpfs: error mounting -2 [ 5.423190] Freeing unused kernel memory: 832K [ 5.427679] Run /sbin/init as init process [ 5.431784] Run /etc/init as init process [ 5.435797] Run /bin/init as init process [ 5.439812] Run /bin/sh as init process [ 5.443640] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. [ 5.457794] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.19.0-xilinx-v2019.2 #1 [ 5.465003] Hardware name: Avnet Ultra96 Rev1 (DT) [ 5.469777] Call trace: [ 5.472224] dump_backtrace+0x0/0x148 [ 5.475872] show_stack+0x14/0x20 [ 5.479176] dump_stack+0x90/0xb4 [ 5.482478] panic+0x120/0x268 [ 5.485524] kernel_init+0xe8/0xfc [ 5.488918] ret_from_fork+0x10/0x18 [ 5.492481] SMP: stopping secondary CPUs [ 5.496454] Kernel Offset: disabled [ 5.499932] CPU features: 0x0,20802004 [ 5.503663] Memory Limit: none [ 5.506709] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]--- |