mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
Tinker board support
This commit is contained in:
parent
4d6d9a4a1a
commit
58ea6811c8
@ -108,6 +108,10 @@ proc ::rmupdate::get_rpi_version {} {
|
|||||||
set fp [open /proc/cpuinfo r]
|
set fp [open /proc/cpuinfo r]
|
||||||
set data [read $fp]
|
set data [read $fp]
|
||||||
foreach d [split $data "\n"] {
|
foreach d [split $data "\n"] {
|
||||||
|
regexp {^Hardware\s*:\s*(\S+)} $d match hardware
|
||||||
|
if { [info exists hardware] && $hardware == "Rockchip" } {
|
||||||
|
return "tinkerboard"
|
||||||
|
}
|
||||||
regexp {^Revision\s*:\s*(\S+)\s*$} $d match revision
|
regexp {^Revision\s*:\s*(\S+)\s*$} $d match revision
|
||||||
if { [info exists revision] && [info exists revision_map($revision)] } {
|
if { [info exists revision] && [info exists revision_map($revision)] } {
|
||||||
return $revision_map($revision)
|
return $revision_map($revision)
|
||||||
@ -480,7 +484,11 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} {
|
|||||||
set new_root_partition 3
|
set new_root_partition 3
|
||||||
}
|
}
|
||||||
set part_uuid [get_part_uuid "${sys_dev}p${new_root_partition}"]
|
set part_uuid [get_part_uuid "${sys_dev}p${new_root_partition}"]
|
||||||
update_cmdline "${mnt_s}/cmdline.txt" "PARTUUID=${part_uuid}"
|
if { [get_rpi_version] == "tinkerboard" } {
|
||||||
|
update_cmdline "${mnt_s}/extlinux/extlinux.conf" "PARTUUID=${part_uuid}"
|
||||||
|
} else {
|
||||||
|
update_cmdline "${mnt_s}/cmdline.txt" "PARTUUID=${part_uuid}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
rest("GET", "/get_system_info", null, function(data) {
|
rest("GET", "/get_system_info", null, function(data) {
|
||||||
$("#system-info").empty();
|
$("#system-info").empty();
|
||||||
$("#system-info").append(
|
$("#system-info").append(
|
||||||
|
$('<div class="sub header">').html(i18next.t('system_type', {'system_type': data.system_type})),
|
||||||
$('<div class="sub header">').html(i18next.t('current_root_partiton', {'root_partition': data.root_partition}))
|
$('<div class="sub header">').html(i18next.t('current_root_partiton', {'root_partition': data.root_partition}))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -332,6 +333,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
title: 'System update',
|
title: 'System update',
|
||||||
system_info: 'System information',
|
system_info: 'System information',
|
||||||
current_root_partiton: 'Current root partition: {{root_partition}}',
|
current_root_partiton: 'Current root partition: {{root_partition}}',
|
||||||
|
system_type: 'System type: {{system_type}}',
|
||||||
firmwares: 'Firmwares',
|
firmwares: 'Firmwares',
|
||||||
current_installed_version: 'Current installed version',
|
current_installed_version: 'Current installed version',
|
||||||
latest_available_version: 'Latest available version',
|
latest_available_version: 'Latest available version',
|
||||||
@ -367,6 +369,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
title: 'System-Aktualisierung',
|
title: 'System-Aktualisierung',
|
||||||
system_info: 'System-Informationen',
|
system_info: 'System-Informationen',
|
||||||
current_root_partiton: 'Aktuelle Root-Partition: {{root_partition}}',
|
current_root_partiton: 'Aktuelle Root-Partition: {{root_partition}}',
|
||||||
|
system_type: 'System-Typ: {{system_type}}',
|
||||||
firmwares: 'Firmwares',
|
firmwares: 'Firmwares',
|
||||||
current_installed_version: 'Momentan installierte Version',
|
current_installed_version: 'Momentan installierte Version',
|
||||||
latest_available_version: 'Aktuellste verfügbare Version',
|
latest_available_version: 'Aktuellste verfügbare Version',
|
||||||
|
@ -35,8 +35,9 @@ proc process {} {
|
|||||||
} elseif {[lindex $path 1] == "get_firmware_info"} {
|
} elseif {[lindex $path 1] == "get_firmware_info"} {
|
||||||
return [rmupdate::get_firmware_info]
|
return [rmupdate::get_firmware_info]
|
||||||
} elseif {[lindex $path 1] == "get_system_info"} {
|
} elseif {[lindex $path 1] == "get_system_info"} {
|
||||||
|
set system_type [rmupdate::get_rpi_version]
|
||||||
set root_partition [rmupdate::get_current_root_partition]
|
set root_partition [rmupdate::get_current_root_partition]
|
||||||
return "\{\"root_partition\":${root_partition}\}"
|
return "\{\"system_type\":\"${system_type}\",\"root_partition\":${root_partition}\}"
|
||||||
} elseif {[lindex $path 1] == "get_addon_info"} {
|
} elseif {[lindex $path 1] == "get_addon_info"} {
|
||||||
return [rmupdate::get_addon_info 1 1 1]
|
return [rmupdate::get_addon_info 1 1 1]
|
||||||
} elseif {[lindex $path 1] == "start_install_firmware"} {
|
} elseif {[lindex $path 1] == "start_install_firmware"} {
|
||||||
|
@ -13,6 +13,11 @@ fi
|
|||||||
image_file="$(realpath $1)"
|
image_file="$(realpath $1)"
|
||||||
new_image_file="${image_file/\.img/\.rmupdate\.img}"
|
new_image_file="${image_file/\.img/\.rmupdate\.img}"
|
||||||
|
|
||||||
|
if [[ ! -e ${image_file} ]]; then
|
||||||
|
echo "File not found: ${image_file}." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! $image_file =~ .*\.img ]]; then
|
if [[ ! $image_file =~ .*\.img ]]; then
|
||||||
echo "Not an image file: ${image_file}." 1>&2
|
echo "Not an image file: ${image_file}." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -55,7 +60,13 @@ for line in $(parted $image_file unit B print | grep primary); do
|
|||||||
dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc
|
dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "*** Resizing / creating filesystems ***"
|
if [ $tinker == 1 ]; then
|
||||||
|
echo "*** Copying boot loader ***"
|
||||||
|
dd if=$image_file of=$new_image_file bs=512 skip=1 count=$((($part_start/512)-2)) seek=1 conv=notrunc
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "*** Creating / resizing filesystems ***"
|
||||||
umount /tmp/rmupdate.mnt 2>/dev/null || true
|
umount /tmp/rmupdate.mnt 2>/dev/null || true
|
||||||
rmdir /tmp/rmupdate.mnt 2>/dev/null || true
|
rmdir /tmp/rmupdate.mnt 2>/dev/null || true
|
||||||
rm /tmp/rmupdate.boot.tar 2>/dev/null || true
|
rm /tmp/rmupdate.boot.tar 2>/dev/null || true
|
||||||
@ -95,8 +106,11 @@ mount /dev/mapper/loop${LOOP_DEV}p1 /tmp/rmupdate.mnt
|
|||||||
(cd /tmp/rmupdate.mnt; tar xf /tmp/rmupdate.boot.tar .)
|
(cd /tmp/rmupdate.mnt; tar xf /tmp/rmupdate.boot.tar .)
|
||||||
|
|
||||||
bootconf=cmdline.txt
|
bootconf=cmdline.txt
|
||||||
[ $tinker == 1 ] && bootconf=extlinux/extlinux.conf
|
#[ $tinker == 1 ] && bootconf=extlinux/extlinux.conf
|
||||||
sed -i -r s"/root=\S+/root=PARTUUID=${partuuid}/" /tmp/rmupdate.mnt/${bootconf}
|
# /etc/init.d/S00eQ3SystemStart needs adaption before PARTUUID can be used
|
||||||
|
if [ $tinker == 0 ]; then
|
||||||
|
sed -i -r s"/root=\S+/root=PARTUUID=${partuuid}/" /tmp/rmupdate.mnt/${bootconf}
|
||||||
|
fi
|
||||||
umount /tmp/rmupdate.mnt
|
umount /tmp/rmupdate.mnt
|
||||||
|
|
||||||
rm /tmp/rmupdate.boot.tar
|
rm /tmp/rmupdate.boot.tar
|
||||||
|
Loading…
Reference in New Issue
Block a user