humphrey
(humphrey hung)
September 13, 2016, 11:12am
1
How do I flash my root file system info SD card ?
And where can I found the partition table in source ?
The instruction seems not include root file system.
sudo dd if=boot0_sdcard.fex of=${card} bs=1k seek=8
sudo dd if=u-boot.fex of=${card} bs=1k seek=19096
sudo dd if=sunxi_mbr.fex of=${card} bs=1k seek=20480
sudo dd if=boot-resource.fex of=${card} bs=1k seek=36864
sudo dd if=env.fex of=${card} bs=1k seek=69632
sudo dd if=boot.fex of=${card} bs=1k seek=86016
My boot log shows
[ 5.425270] Waiting for root device /dev/sda2…
[ 5.426970] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 5.443752] sd 0:0:0:0: [sda] Test WP failed, assume Write Enabled
[ 5.454127] sd 0:0:0:0: [sda] Asking for cache data failed
[ 5.462581] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 5.475373] sd 0:0:0:0: [sda] Test WP failed, assume Write Enabled
[ 5.485624] sd 0:0:0:0: [sda] Asking for cache data failed
[ 5.493997] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 5.503048] sd 0:0:0:0: [sda] Attached SCSI disk
[ 5.550287] VFS: Cannot open root device “sda2” or unknown-block(8,2): error -6
[ 5.560752] Please append a correct “root=” boot option; here are the available partitions:
[ 5.572484] b300 7563264 mmcblk0 driver: mmcblk
[ 5.580845] b301 22226 mmcblk0p1 00000000-0000-0000-0000-000000000000
[ 5.591773] b302 7534953 mmcblk0p2 00000000-0000-0000-0000-000000000000
[ 5.602599] b310 7634944 mmcblk1 driver: mmcblk
[ 5.611024] b330 4096 mmcblk1boot1 (driver?)
[ 5.619437] b320 4096 mmcblk1boot0 (driver?)
[ 5.627837] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)
NoKey
September 13, 2016, 12:41pm
2
You need to put your own root filesystem into the second (“BPI_ROOT”) partition of the SD card you image with the stick.
It is possible though to do that right at the time of creation of the image but that’s getting somewhat more complicated.
Prepare a first die SD Card:
#!/bin/bash
fdisk /dev/mmcblk1 <<EOF
o
n
p
1
204800
409599
n
p
2
409600
t
1
b
w
EOF
mkfs.fat -F32 -v -I -n "BOOT" /dev/mmcblk1p1 <<EOF
EOF
mkfs.ext4 -F -L "ROOT" /dev/mmcblk1p2 <<EOF
EOF
&&
overwrite with Zeros
export card=/dev/mmcblk1
# dd if=/dev/zero of=${card} bs=1M count=1
# dd if=/dev/zero of=${card} bs=1k count=1023 seek=1
and then
dd if=boot0_sdcard.fex of=${card} bs=1k seek=8
dd if=u-boot.fex of=${card} bs=1k seek=19096
dd if=sunxi_mbr.fex of=${card} bs=1k seek=20480
dd if=boot-resource.fex of=${card} bs=1k seek=36864
dd if=env.fex of=${card} bs=1k seek=69632
dd if=boot.fex of=${card} bs=1k seek=86016
1 Like
humphrey
(humphrey hung)
September 14, 2016, 3:22am
4
Hi,
Thanks a lot for your information.
I try to put the rootfs.ext4 provided in BSP into 2nd partition of SD card with
dd if=rootfs.ext4 of=/dev/sdb2,
But it still get kernel panic.
Any suggestion ?
humphrey
(humphrey hung)
September 15, 2016, 2:52pm
5
OK, I figure out the problem.
The rootfs.ext4 inside BSP is nothing.
I made a rootfs and put into the 2nd partition of SD card,
Just can’t use dd command (I don’t know why it occurs kernel panic),
sudo mount -t ext4 /dev/sdb2 /mnt/
sudo cp -a rootfs/* /mnt/
sudo umount /mnt
Modify env.cfg with
mmc_root=/dev/mmcblk0p2 rootwait
It boot into my rootfs successfully.
[ 4.427606] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 4.436646] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 4.456482] devtmpfs: mounted
[ 4.460275] Freeing init memory: 352K
Loading, please wait…
Now, execute /init…
Welcome to ALLWINNER DEV
mount: mounting none on /proc failed: Device or resource busy
mount: mounting none on /sys failed: Device or resource busy
[ 4.720096] [DISP] disp_hdmi_set_detect,line:404:hdmi1’s mgr is NULL
[ 4.730121] [DISP] disp_device_attached_and_enable,line:159:attched ok, mgr0<–>device1, type=4, mode=5
[ 5.057721] rtc_gettime(333): read time 1970-1-1 1:0:13
Please press Enter to activate this console.
[root@AW /]# ls
bin dev init linuxrc proc scripts tmp var
conf etc lib mnt sbin sys usr
[root@AW /]#