This commit adds the logic required to install OpenWrt on a Cisco/Viptela vEdge 1000 while nicely integrating with the already present bootloader and making it possible to roll back to stock OS. The vEdge 1000 has a built-in SSD with a ext2 partition from which the stock u-boot boots the Linux kernel from. In order for Linux not to be confused about which partition the root file system is on, there are some tricks needed to ensure the partition is identifiable at boot time. For this we use blkid as part of the scripts, and sfdisk as part of the manual installation process documented on the wiki. Thus, those packages have been added as a platform dependency. Finally, the u-boot environment is updated which requires the use of uboot-envtools. Tested on a Cisco vEdge 1000. Signed-off-by: Christian Svensson <blue@cmd.nu> Link: https://github.com/openwrt/openwrt/pull/16140 Signed-off-by: Robert Marko <robimarko@gmail.com>
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
# 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
|