11-02-2018, 05:27 AM
(11-01-2018, 02:26 PM)Radioman Wrote: I'm thinking I can overwrite the TOS with the new ELAR OS, is that correct?
Yes, you're correct. The variation is to change the content of the second partition, AKA rootfs. But it takes some care that the extlinux.conf in the first partition must point to the rootfs partition. For TinkerOS is omitted, because the u-boot has it set as default. So check carefully the append statement.
If we look at the ELAR partition scheme, we'll find that is the same as linaro one (TinkerOS). The first partition is vfat of few tenth of Mb, and contains the files for booting, later is mounted on /boot.
If you'll plan such switch, then you need to understand which partition you should copy. That is a bit trickier than simply copy the whole image.
First we need to see the image partition scheme
Code:
$ sudo fdisk -l TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img ## after unrar-ed
Disk TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img: 2.9 GiB, 3038773248 bytes, 5935104 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00f43486
Device Boot Start End Sectors Size Id Type
TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img1 * 8192 212991 204800 100M c W95
TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img2 212992 5935103 5722112 2.7G 83 Linux
$ dmesg |tail ## find which is the kernel name when the SD card is plugged in
[ 5850.123697] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00
[ 5850.124769] sd 6:0:0:0: [sdc] No Caching mode page found
[ 5850.124778] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[ 5850.130022] sdc: sdc1 sdc2 sdc3
[ 5850.134126] sd 6:0:0:0: [sdc] Attached SCSI removable disk
$ sudo fdisk -l /dev/sdc ## check the partition scheme
Disk /dev/sdc: 14.6 GiB, 15665725440 bytes, 30597120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x58bc1052
Device Boot Start End Sectors Size Id Type
/dev/sdc1 8192 139263 131072 64M c W95 FAT32 (LBA)
/dev/sdc2 139264 6283263 6144000 3G 83 Linux
/dev/sdc3 10117120 30597119 20480000 9.8G 83 LinuxThen from those details we'll understand where to start to skip the unnecessary blocks. In particular where the first sector of rootfs starts.
So for the case we may give the command
Code:
$ sudo dd if=TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img of=/dev/sdc bs=512 seek=212992 skip=139264But it must check that the host partition is big enough 5722112 < 6144000. Later just try it out. Don't try to modify the partition prior a new reboot, because the system needs to expand the partition to the maximum.
A second approach would be to format the linaro rootfs and then write the ElarOS onto the partition.
Code:
$ sudo su ## be a master :-)
# mkfs.ext4 /dev/sdc2 ## new format
# mkdir /tmp/dest_root ## destination mount point
# mkdir /tmp/src_root ## source mount point
# mount <path_to_file>/TinkerBoard-Lubuntu18.04LTS_ELAR-Systems-SD-v2.img /tmp/src_root -o loop,offset=104M
# rsync -axHAWXS --numeric-ids --info=progress2 /tmp/src_root /tmp/dest_root
# umount /tmp/dest_root
# umount /tmp/src_root
# e2label /dev/sdc2 <rootfs_partition_name>Before to start it up, care must be taken to modify the extlinux.conf and set the new rootfs pointer. So by the help of gparted (the simplest way) set a name to the partitions (unless done). Later browse the plugged TBS and open the extlinux.conf for editing (as administrator), that should reside in the smaller partition.
if there's a statement root=<something> or none, then we need to modify to root=LABEL=<rootfs_partition_name>
A side note, I used to set a second partition for /home, so the system may change but my data won't disappear along the system.
Light blue words might be a link. Have you try to click on them?



![[-]](https://tinkerboarding.co.uk/forum/images/collapse.png)