diff --git a/addon/lib/rmupdate.tcl b/addon/lib/rmupdate.tcl index 6cecdcd..a532683 100644 --- a/addon/lib/rmupdate.tcl +++ b/addon/lib/rmupdate.tcl @@ -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}" + } } } diff --git a/addon/www/index.html b/addon/www/index.html index 01f8ecd..54595a0 100644 --- a/addon/www/index.html +++ b/addon/www/index.html @@ -251,6 +251,7 @@ along with this program. If not, see . rest("GET", "/get_system_info", null, function(data) { $("#system-info").empty(); $("#system-info").append( + $('
').html(i18next.t('system_type', {'system_type': data.system_type})), $('
').html(i18next.t('current_root_partiton', {'root_partition': data.root_partition})) ); }); @@ -332,6 +333,7 @@ along with this program. If not, see . 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 . 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', diff --git a/addon/www/rest.cgi b/addon/www/rest.cgi index ecd8bed..3c06109 100644 --- a/addon/www/rest.cgi +++ b/addon/www/rest.cgi @@ -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"} { diff --git a/adjust_image.sh b/adjust_image.sh index cd886b2..b6e0e15 100755 --- a/adjust_image.sh +++ b/adjust_image.sh @@ -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