Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
50
target/linux/octeon/base-files/lib/preinit/01_sysinfo
Normal file
50
target/linux/octeon/base-files/lib/preinit/01_sysinfo
Normal file
@@ -0,0 +1,50 @@
|
||||
do_sysinfo_octeon() {
|
||||
local machine
|
||||
local name
|
||||
|
||||
machine=$(grep "^system type" /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g")
|
||||
of_machine=$(head -n1 /sys/firmware/devicetree/base/compatible)
|
||||
|
||||
# Sadly for whatever reason the N821 (Cisco Viptela vEdge 1000) uses the
|
||||
# same supposedly unique board ID as the EdgeRouter. This is bad, so
|
||||
# we override what cpuinfo gives us using the device tree as a hint.
|
||||
case "$of_machine" in
|
||||
"cisco,vedge1000"*)
|
||||
return 0
|
||||
esac
|
||||
|
||||
case "$machine" in
|
||||
"UBNT_E100"*)
|
||||
name="erlite"
|
||||
;;
|
||||
|
||||
"UBNT_E200"*)
|
||||
name="er"
|
||||
;;
|
||||
|
||||
"UBNT_E220"*)
|
||||
name="erpro"
|
||||
;;
|
||||
|
||||
"UBNT_E300"*|\
|
||||
"UBNT_USG"*)
|
||||
# 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
|
||||
50
target/linux/octeon/base-files/lib/preinit/79_move_config
Normal file
50
target/linux/octeon/base-files/lib/preinit/79_move_config
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
|
||||
move_config() {
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
local device="$1"
|
||||
local fstype="$2"
|
||||
[ -n "$device" ] && [ -b "$device" ] && {
|
||||
mount -t "${fstype}" "$device" /mnt
|
||||
[ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
|
||||
umount /mnt
|
||||
}
|
||||
}
|
||||
|
||||
octeon_get_n821_disk() {
|
||||
local partnum=$1
|
||||
local MAJOR MINOR DEVNAME DEVTYPE
|
||||
while read line; do
|
||||
export -n "${line}"
|
||||
done < $(find /sys/bus/platform/devices/16f0000000000.ehci/ -path \*block/sd[a-z]/uevent)
|
||||
echo "/dev/${DEVNAME}${partnum}"
|
||||
}
|
||||
|
||||
octeon_move_config() {
|
||||
. /lib/functions.sh
|
||||
|
||||
case "$(board_name)" in
|
||||
erlite|\
|
||||
ubnt,usg)
|
||||
move_config "/dev/sda1" "vfat"
|
||||
;;
|
||||
itus,shield-router)
|
||||
move_config "/dev/mmcblk1p1" "vfat"
|
||||
;;
|
||||
er|\
|
||||
ubnt,edgerouter-4|\
|
||||
ubnt,edgerouter-6p)
|
||||
move_config "/dev/mmcblk0p1" "vfat"
|
||||
;;
|
||||
cisco,vedge1000)
|
||||
# Copy from the internal USB disk's first partition.
|
||||
# It is resolved from the device path to not be dependent on which
|
||||
# /dev/sd? path it is at, nor which UUID it happens to have.
|
||||
move_config "$(octeon_get_n821_disk 1)" "ext2"
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root octeon_move_config
|
||||
Reference in New Issue
Block a user