[SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M2)

Suggestions for features and software you would like to see in DietPi, goes here.
User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: Request: Support for NanoPC-T3 (very similar to NanoPi-M

Post by Fourdee » Sat Oct 22, 2016 8:16 pm

Have you tried different size SD cards? The issue I uncovered gets more likely (1) the larger the target partition (SD/EMMC) is and (2) the more write accesses you made between image install and resize.
Sandisk Ultra, Sandisk Extreme (uhs-3), Samsung EVO. I actually have a M2 in use daily for ARMv7 testing (faster than the H3's). Its yet to give me any issues (touching wood with a grin lol). But i'll check dmesg tomorrow, maybe its been occurring already and i've been blindly unaware.
The wiki headline is misleading: They talk about compiling u-boot and kernel on your own, but not the rootfs image (with device tree and Debian arm base image). In order to make this a full image, I would exactly have to copy an existing Debian root file system infrastructure from "somewhere", so IMHO fsarchiver clearly is the way to go...
Yep.

Ok, so, current issues are (please correct me if i'am wrong, just trying to break this down into a list so we can work on it):
  • Friendly ARM image is possible already corrupt due to a possible bug in Android make_ext4fs.
  • Resize of partition on 1st run results in filesystem corruption, and/or, could accelerate a failure occurring.
Have a nice Sunday!
Sunday roast! gonna be a good one ;), you too :)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

awl29
Posts: 33
Joined: Fri Aug 26, 2016 11:29 pm

Re: Request: Support for NanoPC-T3 (very similar to NanoPi-M

Post by awl29 » Sun Oct 23, 2016 6:23 pm

Hello again,
Fourdee wrote:Ok, so, current issues are (please correct me if i'am wrong, just trying to break this down into a list so we can work on it):
  • Friendly ARM image is possible already corrupt due to a possible bug in Android make_ext4fs.
  • Resize of partition on 1st run results in filesystem corruption, and/or, could accelerate a failure occurring.
so, finally, I have now indeed resolved both issues. I have also successfully installed and resized this new image onto the built-in emmc of my NanoPC-T3. :D

Another good news is that, while I was at it and used to running fsarchiver, I decided to try and fix the same ext 4 file system/resize issue for your existing v129 M2 image. As I don't have access to this device, it's of course untested, but as I repeated the exact same steps/commands based on your image that I did before on mine (fsarchiver savefs, clean partition, fsarchiver restfs, zerofree, patch initramfs, fsck, read and repackage image) I'm 99,9% certain that it will just work. Please verify nevertheless... ;)

Upload of the following new files to your dropbox has just completed (in two subfolders):
  • DietPi_NanoPiM3T3-armv7-(Jessie).7z (with md5sum):
    my final v134 image for M3/T3
  • DietPi_NanoPiM2-armv7-(Jessie).7z (with md5sum):
    your original v129 image for M2/T2, but migrated to newly created ext4 filesystems created by mkfs.ext4 through fsarchiver, and with my updated initramfs (root.img.gz) as described above to do online (instead of offline) resize2fs and a forced file system check afterwards on first boot
So I am pretty confident that this time, this finally indeed concludes my work on the final v134 image for NanoPi-M3/NanoPC-T3. :D

Thanks again for your great job in creating DietPi and your help with this porting effort! Much appreciated!

Best regards
awl

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: [SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M

Post by Fourdee » Sun Oct 23, 2016 7:51 pm

so, finally, I have now indeed resolved both issues. I have also successfully installed and resized this new image onto the built-in emmc of my NanoPC-T3. :D
Whooohooo, legend :D Great stuff.
I'll test the updated M2 image tomorrow. Once completed, i'll put the images live and let you know when they are online.
Thanks again for your great job in creating DietPi and your help with this porting effort! Much appreciated!
All credit to you for adding the M3/T3 to DietPi!
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: [SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M

Post by Fourdee » Mon Oct 24, 2016 1:52 pm

Great work on this AWL29, cracking job :)

Your M3/T3 image is now live:
Doc = http://dietpi.com/phpbb/viewtopic.php?f ... 3482#p3482
DL = http://dietpi.com/download
M2 image. As I don't have access to this device, it's of course untested, but as I repeated the exact same steps/commands based on your image that I did before on mine (fsarchiver savefs, clean partition, fsarchiver restfs, zerofree, patch initramfs, fsck, read and repackage image) I'm 99,9% certain that it will just work. Please verify nevertheless...
Works a treat, great work! I've updated it to v135 and will update download once v135 is released.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

User avatar
Fourdee
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: [SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M

Post by Fourdee » Mon Oct 24, 2016 2:03 pm

Whats the physical mount locations for the onboard EMMC on T3 (eg: blkid)? I would like to create a doc similar to https://github.com/Fourdee/DietPi/issue ... -220782308 allow user to install DietPi on EMMC.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

awl29
Posts: 33
Joined: Fri Aug 26, 2016 11:29 pm

Re: [SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M

Post by awl29 » Mon Oct 24, 2016 11:19 pm

Hi again,

and many thanks for officially releasing "my" M3/T3 image... :)
Fourdee wrote:Whats the physical mount locations for the onboard EMMC on T3 (eg: blkid)? I would like to create a doc similar to https://github.com/Fourdee/DietPi/issue ... -220782308 allow user to install DietPi on EMMC.
if only it were so simple... :(

I can definitely tell you that on my T3 (and I assume, things are the same for the T2), the particular devices for emmc and SD depend on the boot mode:
  • boot mode emmc (boot button not pressed during power on): emmc is /dev/mmcblk0, SD is /dev/mmcblk1
  • boot mode SD (boot button pressed during power on): SD is /dev/mmcblk0, emmc is /dev/mmcblk1
While all content on emmc and SD is exactly the same from block 2048 onwards, unfortunately, there are a number of binary differences in the blocks before (0-2047) between SD and emmc (e.g. bootparams), although u-boot bootloader and partition table are equal.

I have used the following multi-step, but relatively straightforward approach to install DietPi on my emmc:

Write FriendlyARM's eflasher utility: http://www.mediafire.com/file/9d220h5ut ... ull.img.7z onto an SD card (of at least 8GB in size), then boot from this SD card (using the boot button), and install Debian onto emmc from the graphical installer. This prepares emmc blocks 0-2048 to properly boot into Linux (as opposed to Android) from emmc, and writes FriendlyARM's Debian images into emmc partitions p1 (boot) and p2 (rootfs).

Now switch to a login prompt using Alt+F2 and login as root (password is "fa"). Note that, as this still is from the command prompt of the eflasher (i.e. running off the SD card), the emmc device is currently still called mmcblk1 (and not mmcblk0 like as it would once we've booted from emmc):

Code: Select all

Disk /dev/mmcblk1: 7.3 GiB, 7818182656 bytes, 15269888 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: 0x4dc52160

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1        2048   133119   131072   64M 83 Linux
/dev/mmcblk1p2      133120 15269887 15136768  7.2G 83 Linux
Then, using fdisk, delete the maxed out rootfs partition /dev/mmcblk1p2: enter "d" and "2", and recreate it to be the exact size of the DietPi raw rootfs partition as contained in the DietPi image (which happens to be exactly 1024000 blocks of 512 bytes each, i.e. 500MB): enter "n"(ew) "p"(rimary) "2" "133120" "+1023999". This results in:

Code: Select all

Disk /dev/mmcblk1: 7.3 GiB, 7818182656 bytes, 15269888 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: 0x4dc52160

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk1p1        2048  133119  131072   64M 83 Linux
/dev/mmcblk1p2      133120 1157119 1024000  500M 83 Linux
Write this modified partition map to emmc by entering "w", and then quit fdisk with "q". Finally copy blocks 2048 and following of the DietPi image to block 2048 and following of the emmc using dd:

Code: Select all

dd if=DietPi_v134_NanoPiM3T3-armv7-(Jessie).img of=/dev/mmcblk1 ibs=512 skip=2048 obs=512 seek=2048
Now shutdown the eflasher command propmpt, switch off the device and switch it back on again, this time without pressing the boot button. You will now be booting into DietPi from emmc, and it will resize the emmc rootfs partition on first run from 1024000 blocks (500MB) to the full 15136768 blocks (7.2GB).

That's how I did it, unfortunately, the process is quite complex. It might be possible to tweak the code available from here: https://github.com/friendlyarm/sd-fuse_s5p6818 to do all of this in only one step, but - at least for me - it wasn't worth the effort, as the above method worked for me...

Hope this helps & best regards
awl

thieums
Posts: 1
Joined: Tue Jan 30, 2018 11:59 am

Re: [SOLVED] Support for NanoPC-T3 (very similar to NanoPi-M

Post by thieums » Tue Jan 30, 2018 12:18 pm

Hello!
sorry to up a thread this old, but it seem the most appropriate for what i've found.
I own a nanopi M3 and while looking for a lightweight OS i found dietpi (i have rpi too i think i'll try it on them)...
Works fine, but if i understood it right, only in 32b... so, back on google! and found https://github.com/rafaello7/debian-installer-nanopi-m3
it a net install for jessie, stretch or buster wich support wifi/bluetooth/arm64 on the M3 :)
tried it (the stretch one), and beside some install pb due to the sd card i think, looks like it work fine (didn't yet test the bluetooth tho)
maybe if someone from the team get in touch with the maker it could be used as a start to make another image of dietpi for the M3

Post Reply