BOOTPART=/dev/sda1
move_config() {
- grep -q 'MyBook Live' /proc/cpuinfo || return
+ . /lib/functions.sh
+
+ [ "$(board_name)" = "mbl" ] || return
if [ -b $BOOTPART ]; then
mkdir -p /boot
mount -t ext4 -o rw,noatime $BOOTPART /boot
merakinand_do_upgrade() {
local tar_file="$1"
- local board_name="$(cat /tmp/sysinfo/board_name)"
+ local board_name="$(board_name)"
# Do we need to do any platform tweaks?
case "$board_name" in
local cal_src=$1
local cal_dst=$2
local ubidev="$(nand_find_ubi $CI_UBIPART)"
- local board_name="$(cat /tmp/sysinfo/board_name)"
+ local board_name="$(board_name)"
local rootfs_size="$(ubinfo /dev/ubi0 -N rootfs_data | grep "Size" | awk '{ print $6 }')"
# Setup partitions using board name, in case of future platforms
merakinand_do_upgrade() {
local tar_file="$1"
- local board_name="$(cat /tmp/sysinfo/board_name)"
+ local board_name="$(board_name)"
# Do we need to do any platform tweaks?
case "$board_name" in
board_config_update
-board=$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)
-
-case "$board" in
+case "$(board_name)" in
netgear,r8000)
ucidef_set_led_usbport "usb2" "USB 2.0" "bcm53xx:white:usb2" "usb1-port2" "usb2-port2"
ucidef_set_led_usbport "usb3" "USB 3.0" "bcm53xx:white:usb3" "usb1-port1" "usb2-port1" "usb4-port1"
board_config_update
-board=$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)
+board=$(board_name)
case "$board" in
tenda,ac9)
}
-model="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"
+model="$(board_name)"
boardtype="$(nvram get boardtype)"
boardnum="$(nvram get boardnum)"
zyxel_do_upgrade() {
local tar_file="$1"
- local board=$(cat /tmp/sysinfo/board_name)
+ local board=$(board_name)
local rootfs="$(zyxel_get_rootfs)"
local kernel=
platform_do_upgrade() {
local tar_file="$1"
- local board="$(cat /tmp/sysinfo/board_name)"
+ local board="$(board_name)"
echo "flashing kernel"
tar xf $tar_file sysupgrade-$board/kernel -O | mtd write - kernel
platform_check_image() {
local tar_file="$1"
- local board=$(cat /tmp/sysinfo/board_name)
+ local board=$(board_name)
case "$board" in
mediatek,mt7623-rfb-nand-ephy |\
}
platform_pre_upgrade() {
- local board=$(cat /tmp/sysinfo/board_name)
- case "$board" in
+ case "$(board_name)" in
mediatek,mt7623-rfb-nand-ephy |\
mediatek,mt7623-rfb-nand)
nand_do_upgrade $1
board_config_update
-case "$(cat /tmp/sysinfo/board_name)" in
+case "$(board_name)" in
erlite)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
# Copyright (C) 2014 OpenWrt.org
move_config() {
- case "$(cat /tmp/sysinfo/board_name)" in
+ . /lib/functions.sh
+
+ case "$(board_name)" in
erlite)
mount -t vfat /dev/sda1 /mnt
[ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz /
}
platform_copy_config() {
- local board="$(cat /tmp/sysinfo/board_name)"
-
- case "$board" in
+ case "$(board_name)" in
erlite)
mount -t vfat /dev/sda1 /mnt
cp -af "$CONF_TAR" /mnt/
platform_do_upgrade() {
local tar_file="$1"
- local board=$(cat /tmp/sysinfo/board_name)
+ local board=$(board_name)
local rootfs="$(platform_get_rootfs)"
local kernel=
}
platform_check_image() {
- local board=$(cat /tmp/sysinfo/board_name)
+ local board=$(board_name)
case "$board" in
erlite | \
}
}
+. /lib/functions.sh
+
[ "$FIRMWARE" = "n810-cal-bme-pmm.fw" ] && {
- [ -z "$(grep -e 'Nokia N810' /proc/cpuinfo)" ] || {
+ [ "$(board_name)" != "nokia,n810" ] || {
[ -e /lib/firmware/n810-cal-bme-pmm.fw ] ||\
n810_cal_bme_pmm_extract
}
}
}
+. /lib/functions.sh
+
[ "$FIRMWARE" = "3826.eeprom" ] && {
- [ -z "$(grep -e 'Nokia N810' /proc/cpuinfo)" ] || {
+ [ "$(board_name)" != "nokia,n810" ] || {
[ -e /lib/firmware/3826.eeprom ] ||\
p54spi_eeprom_extract
}
}
get_usb_led() {
- local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+ . /lib/functions.sh
- case "${hardware}" in
+ case "$(board_name)" in
'Linksys WRT350N v2')
usb_led='wrt350nv2:green:usb'
usb_device='1-1:1.0'
# This script sets system defaults for the hardware on firstboot
#
-hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+. /lib/functions.sh
wrt350nv2_default() {
# leds
}
}
-case "${hardware}" in
+case "$(board_name)" in
'Linksys WRT350N v2')
wrt350nv2_default
;;
platform_check_image() {
[ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
- local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+ local hardware="$(board_name)"
local magic="$(get_magic_word "$1")"
local magic_long="$(get_magic_long "$1")"
}
platform_nand_pre_upgrade() {
- local board_name="$(cat /tmp/sysinfo/board_name)"
-
mtd erase kernel
- tar xf "$1" sysupgrade-$board_name/kernel -O | nandwrite -o /dev/mtd0 -
+ tar xf "$1" "sysupgrade-$(board_name)/kernel" -O | nandwrite -o /dev/mtd0 -
}
platform_do_upgrade() {
board_config_update
-board=$(cat /tmp/sysinfo/board_name) 2>/dev/null
-
-case "$board" in
+case "$(board_name)" in
pc-engines-apu|pc-engines-apu2)
ucidef_set_led_netdev "wan" "WAN" "apu2:green:led3" "eth0"
ucidef_set_led_netdev "lan" "LAN" "apu2:green:led2" "br-lan"
board_config_update
-board="$(cat /tmp/sysinfo/board_name)" 2>/dev/null
-
-case "$board" in
+case "$(board_name)" in
pc-engines-apu|pc-engines-apu2)
ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
;;
board_config_update
-case "$(cat /tmp/sysinfo/board_name)" in
+case "$(board_name)" in
xlnx,zynq-zc702|xlnx,zynq-zed|xlnx,zynq-zybo)
ucidef_set_interface_lan 'eth0'
;;