This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am making a UBI image to boot our board DM3730.
mkfs.ubifs -r -F /home/bradlee/targetfs/rootfs -m 2048 -e 129024 -c 3996 -o ubifs.img
ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 512 ubinize.cfg
results:
[ 29.877014] UBI: attaching mtd4 to ubi0
[ 29.880859] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 29.887207] UBI: logical eraseblock size: 129024 bytes
[ 29.892669] UBI: smallest flash I/O unit: 2048
[ 29.897369] UBI: sub-page size: 512
[ 29.902038] UBI: VID header offset: 512 (aligned 512)
[ 29.907897] UBI: data offset: 2048
[ 30.848876] UBI: attached mtd4 to ubi0
[ 30.852722] UBI: MTD device name: "File System"
[ 30.858215] UBI: MTD device size: 499 MiB
[ 30.863220] UBI: number of good PEBs: 3996
[ 30.867980] UBI: number of bad PEBs: 0
[ 30.872436] UBI: max. allowed volumes: 128
[ 30.877075] UBI: wear-leveling threshold: 4096
[ 30.881805] UBI: number of internal volumes: 1
[ 30.886291] UBI: number of user volumes: 1
[ 30.890777] UBI: available PEBs: 0
[ 30.895233] UBI: total number of reserved PEBs: 3996
[ 30.900238] UBI: number of PEBs reserved for bad PEB handling: 39
[ 30.906372] UBI: max/mean erase counter: 1/0
[ 30.910644] UBI: image sequence number: 393079821
[ 30.915405] UBI: background thread "ubi_bgt0d" started, PID 572
UBI device number 0, total 3996 LEBs (515579904 bytes, 491.7 MiB), available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
[ 30.959197] UBIFS: recovery needed
[ 31.031616] UBIFS: recovery completed
[ 31.035308] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 31.041381] UBIFS: file system size: 508612608 bytes (496692 KiB, 485 MiB, 3942 LEBs)
[ 31.049438] UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
[ 31.056793] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 31.062652] UBIFS: default compressor: lzo
[ 31.066772] UBIFS: reserved for root: 0 bytes (0 KiB)
Failed to switch_root, dropping to a shell
ubinize.cfg list below:
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=450MiB
vol_type=dynamic
vol_alignment=1
vol_name=rootfs
vol_flags=autoresize
then I burn the image using following command:
/burn_flash.sh 192.168.0.13
burn_flash.sh is list below:
#!/bin/sh
echo tftp server ipaddr is $1
tftp -gr rootfs.ubi $1
umount /newroot
ubidetach /dev/ubi_ctrl -m 4
flash_erase /dev/mtd4 0 0
#ubiformat -y /dev/mtd4 -f rootfs.ubi
ubiformat /dev/mtd4 -f rootfs.ubi
ubiattach /dev/ubi_ctrl -m 4
mount -t ubifs ubi0:rootfs /newroot
init
!/bin/sh
echo "Start initramfs from /init"
mount -t proc proc /proc
mount -t sysfs sysfs /sys
#echo 0 > /proc/sys/kernel/printk
#clear
busybox --install -s
mkdir -p /dev/
#mknod /dev/null c 1 3
#mknod /dev/tty c 5 0
#mknod /dev/console c 5 1
mdev -s
get_opt() {
echo "$@" | cut -d "=" -f 2
}
init="/sbin/init"
#root="/opt/test1/buildroot-2011.11/output/target"
for i in $(cat /proc/cmdline); do
case $i in
root\=*)
root=$(get_opt $i)
;;
init\=*)
init=$(get_opt $i)
;;
esac
done
echo "root=$root init=$init"
echo "Mount..."
#mount -t nfs -o nolock 192.168.1.1:"${root}" /newroot
mkdir -p /newroot
ubiattach /dev/ubi_ctrl -m 4
mount -t ubifs ubi0:rootfs /newroot
if [[ -x "/newroot/${init}" ]] ; then
umount /sys /proc
exec switch_root /newroot "${init}"
fi
echo "Failed to switch_root, dropping to a shell"
#exec sh
exec /sbin/init