Add basic change for v1453
Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
diff --git a/target/linux/mmp/base-files/bin/adb_shell b/target/linux/mmp/base-files/bin/adb_shell
new file mode 100755
index 0000000..befe636
--- /dev/null
+++ b/target/linux/mmp/base-files/bin/adb_shell
@@ -0,0 +1,14 @@
+#!/bin/sh
+export ENV='/etc/adb_profile'
+
+USER_NAME=root
+
+#if [ $1 = '-' ];then
+# /bin/login
+#elif [ $1 = '-c' ];then
+# /bin/login -c "$2"
+#else
+# /bin/login
+#fi
+
+/bin/login $USER_NAME
diff --git a/target/linux/mmp/base-files/etc/adb_profile b/target/linux/mmp/base-files/etc/adb_profile
new file mode 100755
index 0000000..3296d20
--- /dev/null
+++ b/target/linux/mmp/base-files/etc/adb_profile
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+. /etc/profile
\ No newline at end of file
diff --git a/target/linux/mmp/base-files/etc/config/network b/target/linux/mmp/base-files/etc/config/network
old mode 100644
new mode 100755
index a3e94df..10a5fc5
--- a/target/linux/mmp/base-files/etc/config/network
+++ b/target/linux/mmp/base-files/etc/config/network
@@ -17,7 +17,7 @@
config interface lan
option device br-lan
option proto static
- option ipaddr 192.168.1.1
+ option ipaddr 192.168.100.1
option netmask 255.255.255.0
option ip6assign 60
diff --git a/target/linux/mmp/base-files/etc/group b/target/linux/mmp/base-files/etc/group
old mode 100644
new mode 100755
index 1dbf901..02a94c6
--- a/target/linux/mmp/base-files/etc/group
+++ b/target/linux/mmp/base-files/etc/group
@@ -1 +1,2 @@
root:x:0:
+mbtk:x:1000:
diff --git a/target/linux/mmp/base-files/etc/init.d/enable_autosleep b/target/linux/mmp/base-files/etc/init.d/enable_autosleep
index 50a3c8a..5641a8b 100755
--- a/target/linux/mmp/base-files/etc/init.d/enable_autosleep
+++ b/target/linux/mmp/base-files/etc/init.d/enable_autosleep
@@ -14,11 +14,11 @@
[ -e /sys/class/devfreq/devfreq-ddr/polling_interval ] && {
echo 50 > /sys/class/devfreq/devfreq-ddr/polling_interval
}
-
- [ -e /sys/power/autosleep ] && {
- echo booting 8000000000 > /sys/power/wake_lock
- echo mem > /sys/power/autosleep
- }
+#close for mbtk
+ #[ -e /sys/power/autosleep ] && {
+ # echo booting 8000000000 > /sys/power/wake_lock
+ # echo mem > /sys/power/autosleep
+ #}
[ -e /sys/devices/platform/soc/d4000000.apb/pxa2xx-i2c.1/i2c-1/1-0030/88pm80x-wdt/pm80x_wdt_sec ] && {
echo 128:1 > /sys/devices/platform/soc/d4000000.apb/pxa2xx-i2c.1/i2c-1/1-0030/88pm80x-wdt/pm80x_wdt_sec
diff --git a/target/linux/mmp/base-files/etc/init.d/sdcard_mount b/target/linux/mmp/base-files/etc/init.d/sdcard_mount
index ee6b104..45490e5 100755
--- a/target/linux/mmp/base-files/etc/init.d/sdcard_mount
+++ b/target/linux/mmp/base-files/etc/init.d/sdcard_mount
@@ -1,7 +1,8 @@
#!/bin/sh /etc/rc.common
# Marvell sd card detect & mount script
-START=50
+# Change by mbtk
+START=10
STOP=91
WEBDAV_SD=/www/webdav/sdcard
diff --git a/target/linux/mmp/base-files/etc/init.d/services.init b/target/linux/mmp/base-files/etc/init.d/services.init
index a843afc..fe3afc8 100755
--- a/target/linux/mmp/base-files/etc/init.d/services.init
+++ b/target/linux/mmp/base-files/etc/init.d/services.init
@@ -58,7 +58,13 @@
start_instance 0 "hawk" "${PATH_BIN}" -p
fi
+#edit for mbtk
+ if [ -f /etc/init.d/mbtk_platform_version ]
+ then
+ echo "--mbtk platform version--" > /dev/kmsg
+ else
[ -e /sys/devices/platform/asr-gps* ] && {
start_instance 0 "gnss_demo" "${PATH_BIN}"
}
+ fi
}
diff --git a/target/linux/mmp/base-files/etc/passwd b/target/linux/mmp/base-files/etc/passwd
old mode 100644
new mode 100755
index 4e5e0b8..dcfb4a9
--- a/target/linux/mmp/base-files/etc/passwd
+++ b/target/linux/mmp/base-files/etc/passwd
@@ -1 +1,2 @@
root:x:0:0:root:/root:/bin/ash
+mbtk:x:1000:1000:mbtk:/home/mbtk:/bin/ash
diff --git a/target/linux/mmp/base-files/etc/shadow b/target/linux/mmp/base-files/etc/shadow
old mode 100644
new mode 100755
index 3f96672..d05132b
--- a/target/linux/mmp/base-files/etc/shadow
+++ b/target/linux/mmp/base-files/etc/shadow
@@ -1 +1,2 @@
root:$1$tR1FaG6u$aT1PfA0UAU0tAYhmlogog0:16666:0:99999:7:::
+mbtk:$1$tR1FaG6u$aT1PfA0UAU0tAYhmlogog0:16666:0:99999:7:::
\ No newline at end of file
diff --git a/target/linux/mmp/base-files/lib/preinit/81_mount_ubifs_overlay b/target/linux/mmp/base-files/lib/preinit/81_mount_ubifs_overlay
old mode 100644
new mode 100755
index b16677a..1f83e86
--- a/target/linux/mmp/base-files/lib/preinit/81_mount_ubifs_overlay
+++ b/target/linux/mmp/base-files/lib/preinit/81_mount_ubifs_overlay
@@ -45,6 +45,12 @@
[ -z "$mtdpart_idx_oem" ] && return 1
fi
fi
+
+ # Add by liubin for user_data
+ mtdpart_idx_user="$(find_mtd_index user_data)"
+ [ -z "$mtdpart_idx_user" ] && return 1
+ # End by liubin
+
grep -qs ubifs /proc/filesystems || return 1
echo "found rootfs_data partition and ubifs support"
return 0
@@ -67,47 +73,50 @@
# no volume
recover_ubifs=1
else
- # check for "data" volume
+ # check for "overlay" volume
ubi0_0_nod_id=`cat /sys/class/ubi/ubi0_0/dev | tr -s ":" " "`
[ ! -e /dev/ubi0_0 ] && mknod /dev/ubi0_0 c ${ubi0_0_nod_id}
- { ubinfo /dev/ubi0_0 | grep Name | grep -qs "data" ; } || \
+ { ubinfo /dev/ubi0_0 | grep Name | grep -qs "overlay" ; } || \
recover_ubifs=1
fi
fi
if [ $recover_ubifs -eq 1 ]
then
echo "ubifs syscfg partition is damaged"
- echo "try to recover by formatting $mtdpart..."
- [ -e /dev/ubi0 ] && ubidetach -m $mtdpart_idx
- ubiformat -y -q /dev/mtd$mtdpart_idx
- ubiattach -m $mtdpart_idx /dev/ubi_ctrl
+ echo "try to recover by formatting $mtdpart_idx..."
+ #[ -e /dev/ubi0 ] && ubidetach -m $mtdpart_idx
+ #ubiformat -y -q /dev/mtd$mtdpart_idx
+ #ubiattach -m $mtdpart_idx /dev/ubi_ctrl
ubi0_nod_id=`cat /sys/class/ubi/ubi0/dev | tr -s ":" " "`
[ ! -e /dev/ubi0 ] && mknod /dev/ubi0 c ${ubi0_nod_id}
- ubimkvol /dev/ubi0 -n 1 -N etc -t dynamic -s 5MiB
- ubimkvol /dev/ubi0 -n 2 -N nvm -t dynamic -s 4MiB
- ubimkvol /dev/ubi0 -n 0 -N data -t dynamic --maxavsize
+# ubimkvol /dev/ubi0 -n 1 -N etc -t dynamic -s 5MiB
+# ubimkvol /dev/ubi0 -n 2 -N nvm -t dynamic -s 4MiB
+# ubimkvol /dev/ubi0 -n 0 -N overlay -t dynamic --maxavsize
+ ubimkvol /dev/ubi0 -n 0 -N syscfg -t dynamic --maxavsize
fi
# finally mount the ubifs
- mount -t ubifs -o noatime ubi0:data /data || return 1
- mount -t ubifs -o noatime ubi0:data /mnt || return 1
- mount -t ubifs -o noatime ubi0:data /log || return 1
- mount -t ubifs -o noatime ubi0:etc $overlay_mountpoint/etc || return 1
- mount -t ubifs -o noatime ubi0:nvm $overlay_mountpoint/nvm || return 1
+# mount -t ubifs -o noatime ubi0:overlay $overlay_mountpoint || return 1
+# mount -t ubifs -o noatime ubi0:data /mnt || return 1
+# mount -t ubifs -o noatime ubi0:data /log || return 1
+# mount -t ubifs -o noatime ubi0:etc $overlay_mountpoint/etc || return 1
+# mount -t ubifs -o noatime ubi0:nvm $overlay_mountpoint/nvm || return 1
+ mount -t ubifs -o noatime ubi0_0 $overlay_mountpoint || return 1
# clean up uci tmp file to avoid wirtable partition full
- rm -rf $overlay_mountpoint/etc/root/config/.*.uci-*
+ rm -rf $overlay_mountpoint/root/config/.*.uci-*
+
return 0
}
try_ubifs_syscfg_mount() {
__try_ubifs_syscfg_mount || {
echo "roofs_data mount fail, try to recover by erase..."
- umount $overlay_mountpoint/nvm
- umount $overlay_mountpoint/etc
- umount /log
- umount /mnt
- umount /data
+ umount $overlay_mountpoint
+# umount $overlay_mountpoint/etc
+# umount /log
+# umount /mnt
+# umount /data
mtd erase rootfs_data
__try_ubifs_syscfg_mount
}
@@ -149,10 +158,67 @@
return 0
}
+ubifs_user_data_mount() {
+ recover_ubifs=0
+ [ ! -e /dev/ubi2 ] && ubiattach /dev/ubi_ctrl -m $mtdpart_idx_user -d 2 || recover_ubifs=1
+ if [ $recover_ubifs -eq 0 ]
+ then
+ ubi2_nod_id=`cat /sys/class/ubi/ubi2/dev | tr -s ":" " "`
+ [ ! -e /dev/ubi2 ] && mknod /dev/ubi2 c ${ubi2_nod_id}
+ if [ ! -e /sys/class/ubi/ubi2_0/dev ]
+ then
+ # no volume
+ recover_ubifs=1
+ else
+ # check for "oem_data" volume
+ ubi2_0_nod_id=`cat /sys/class/ubi/ubi2_0/dev | tr -s ":" " "`
+ [ ! -e /dev/ubi2_0 ] && mknod /dev/ubi2_0 c ${ubi2_0_nod_id}
+ { ubinfo /dev/ubi2_0 | grep Name | grep -qs "user_data" ; } || \
+ recover_ubifs=1
+ fi
+ fi
+ if [ $recover_ubifs -eq 1 ]
+ then
+ echo "ubifs user_data partition is damaged"
+ echo "try to recover by formatting $mtdpart..."
+ [ -e /dev/ubi2 ] && ubidetach -m $mtdpart_idx_user
+ ubiformat -y -q /dev/mtd$mtdpart_idx_user
+ ubiattach -m $mtdpart_idx_user /dev/ubi_ctrl
+ ubi2_nod_id=`cat /sys/class/ubi/ubi2/dev | tr -s ":" " "`
+ [ ! -e /dev/ubi2 ] && mknod /dev/ubi2 c ${ubi2_nod_id}
+ ubimkvol /dev/ubi2 -n 0 -N user_data -t dynamic --maxavsize
+ fi
+
+ mkdir -p /user_data
+ mount -t ubifs -o noatime,bulk_read ubi2:user_data /user_data
+ return 0
+}
+
+
+pivot() { # <new_root> <old_root>
+ /bin/mount -o noatime,move /proc $1/proc && \
+ pivot_root $1 $1$2 && {
+ /bin/mount -o noatime,move $2/dev /dev
+ /bin/mount -o noatime,move $2/tmp /tmp
+ /bin/mount -o noatime,move $2/sys /sys 2>&-
+ /bin/mount -o noatime,move $2/overlay /overlay 2>&-
+# /bin/mount -o ro,noatime,move $2/NVM/oem_data /NVM/oem_data 2>&-
+ return 0
+ }
+}
+
+# /bin/mount -o noatime,lowerdir=/,upperdir=/overlay/root,workdir=/overlay/work -t overlay "overlayfs:/overlay/root" /mnt
+fopivot() { # <rw_root> <ro_root> <dupe?>
+ /bin/mount -o noatime,lowerdir=/,upperdir=$1,workdir=$2 -t overlay "overlayfs:$1" /mnt
+ pivot /mnt $3
+}
+
+
create_overlay() { # <lowerdir> <upper_dir> <target>
- mkdir -p $2/root $2/work
- /bin/mount -o noatime,lowerdir=$1,upperdir=$2/root,workdir=$2/work -t overlay "overlayfs:$2" $3
- /bin/umount $2
+ mkdir -p $1/root $1/work
+
+# /bin/mount -o noatime,lowerdir=$1,upperdir=$2/root,workdir=$2/work -t overlay "overlayfs:$2" $3
+ fopivot $1/root $1/work /rom 1
}
ubifs_syscfg_rootfs_pivot() {
@@ -161,10 +227,11 @@
mount -o bind / /rom
# Dir /etc and /NVM can be written after creating overlay
- create_overlay /system/etc $overlay_mountpoint/etc /system/etc
- create_overlay /NVM $overlay_mountpoint/nvm /NVM
+ create_overlay $overlay_mountpoint
+# create_overlay /NVM $overlay_mountpoint/nvm /NVM
ubifs_oem_data_mount
-
+ ubifs_user_data_mount
+
if [ -e /etc/selinux ] && [ ! -e /etc/selinux/restorecon_stat ]; then
restorecon -r /mnt /data /log /NVM /system/etc
echo "/mnt /data /log /NVM /system/etc" >> /etc/selinux/restorecon_stat