Initial commit
This commit is contained in:
40
target/linux/octeon/base-files/lib/preinit/01_sysinfo
Normal file
40
target/linux/octeon/base-files/lib/preinit/01_sysinfo
Normal file
@@ -0,0 +1,40 @@
|
||||
do_sysinfo_octeon() {
|
||||
local machine
|
||||
local name
|
||||
|
||||
machine=$(grep "^system type" /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g")
|
||||
|
||||
case "$machine" in
|
||||
"UBNT_E100"*)
|
||||
name="erlite"
|
||||
;;
|
||||
|
||||
"UBNT_E200"*)
|
||||
name="er"
|
||||
;;
|
||||
|
||||
"UBNT_E220"*)
|
||||
name="erpro"
|
||||
;;
|
||||
|
||||
"UBNT_E300"*)
|
||||
# let generic 02_sysinfo handle it since device has its own device tree
|
||||
return 0
|
||||
;;
|
||||
|
||||
"ITUS_SHIELD"*)
|
||||
name="itus,shield-router"
|
||||
;;
|
||||
|
||||
*)
|
||||
name="generic"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
|
||||
|
||||
echo "$name" > /tmp/sysinfo/board_name
|
||||
echo "$machine" > /tmp/sysinfo/model
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main do_sysinfo_octeon
|
||||
31
target/linux/octeon/base-files/lib/preinit/79_move_config
Normal file
31
target/linux/octeon/base-files/lib/preinit/79_move_config
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
|
||||
move_config() {
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
local device="$1"
|
||||
[ -n "$device" ] && [ -b "$device" ] && {
|
||||
mount -t vfat "$device" /mnt
|
||||
[ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
|
||||
umount /mnt
|
||||
}
|
||||
}
|
||||
|
||||
octeon_move_config() {
|
||||
. /lib/functions.sh
|
||||
|
||||
case "$(board_name)" in
|
||||
erlite)
|
||||
move_config "/dev/sda1"
|
||||
;;
|
||||
itus,shield-router)
|
||||
move_config "/dev/mmcblk1p1"
|
||||
;;
|
||||
ubnt,edgerouter-4 | \
|
||||
ubnt,edgerouter-6p)
|
||||
move_config "/dev/mmcblk0p1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root octeon_move_config
|
||||
Reference in New Issue
Block a user