Tinker board support

This commit is contained in:
Jan Schneider 2018-01-27 09:10:10 +01:00
parent 4d6d9a4a1a
commit 58ea6811c8
4 changed files with 31 additions and 5 deletions

View File

@ -108,6 +108,10 @@ proc ::rmupdate::get_rpi_version {} {
set fp [open /proc/cpuinfo r]
set data [read $fp]
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
if { [info exists revision] && [info exists revision_map($revision)] } {
return $revision_map($revision)
@ -480,7 +484,11 @@ proc ::rmupdate::update_filesystems {image {dryrun 0}} {
set new_root_partition 3
}
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}"
}
}
}

View File

@ -251,6 +251,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
rest("GET", "/get_system_info", null, function(data) {
$("#system-info").empty();
$("#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}))
);
});
@ -332,6 +333,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
title: 'System update',
system_info: 'System information',
current_root_partiton: 'Current root partition: {{root_partition}}',
system_type: 'System type: {{system_type}}',
firmwares: 'Firmwares',
current_installed_version: 'Current installed 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',
system_info: 'System-Informationen',
current_root_partiton: 'Aktuelle Root-Partition: {{root_partition}}',
system_type: 'System-Typ: {{system_type}}',
firmwares: 'Firmwares',
current_installed_version: 'Momentan installierte Version',
latest_available_version: 'Aktuellste verfügbare Version',

View File

@ -35,8 +35,9 @@ proc process {} {
} elseif {[lindex $path 1] == "get_firmware_info"} {
return [rmupdate::get_firmware_info]
} elseif {[lindex $path 1] == "get_system_info"} {
set system_type [rmupdate::get_rpi_version]
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"} {
return [rmupdate::get_addon_info 1 1 1]
} elseif {[lindex $path 1] == "start_install_firmware"} {

View File

@ -13,6 +13,11 @@ fi
image_file="$(realpath $1)"
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
echo "Not an image file: ${image_file}." 1>&2
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
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
rmdir /tmp/rmupdate.mnt 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 .)
bootconf=cmdline.txt
[ $tinker == 1 ] && bootconf=extlinux/extlinux.conf
sed -i -r s"/root=\S+/root=PARTUUID=${partuuid}/" /tmp/rmupdate.mnt/${bootconf}
#[ $tinker == 1 ] && bootconf=extlinux/extlinux.conf
# /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
rm /tmp/rmupdate.boot.tar