I made the DietPi modification to boot on TV Box RK3318/3328.
You cannot simply flash, dd, or rsync the SD card image directly to eMMC. There is hidden boot code stored at the beginning of the internal storage. During boot, it loads this internal boot code from eMMC. If the internal storage is erased, it will only use the hidden boot settings for SD card booting.
It is not always easy to find the correct settings to boot from internal storage, so I do not recommend flashing directly to internal storage. If DietPi gets corrupted or something else happens, you may lose access to the TV box.
Always create a backup with Multitool of your internal storage before flashing to internal storage.
To get DietPi booting from SD card, I copied (dd) the Multitool boot settings:
sudo dd if=multitool.img of=uboot_multitool_rk3328.img bs=1M count=16 conv=fsync
This copies the first 16 MB from Multitool.
Download Multitool from : CSC Armbian for RK3318/RK3328 TV box boards - Rockchip CPU Boxes - Armbian Community Forums
Flash to internal storage using Multitool.
Read : Quick installation instructions on eMMC:
CSC Armbian for RK3318/RK3328 TV box boards
MANUAL install to internal storage:
It is important not to erase the first 20 MB of internal storage.
Create the ext4 partition after that.
DietPi running from SD card, then create a backup of first 16MB
sudo dd if=/dev/INTERNAL of=internal-first-16MB.img bs=1M count=16 status=progress conv=fsync
sync
Then I recommend copying over the DietPi image, and you need to change the UUID in dietpiEnv.txt and /etc/fstab to match the UUID of the internal ext4 partition.
Boot SD card
Creating the ext4 partition on internal storage, find the UUID:
lsblk -f
NAME FSTYPE FSVER LABEL UUID
mmcblk2
└─mmcblk2p1 ext4 1.0 1e85bdca-391e-4f6c-9155-e0b60409ea95
DD method
If you use dd, shrink the partition on the SD card first so there is a minimum of 2 GB free space afterward.
Do this from a Linux PC. I recommend using GParted on a desktop Linux distribution like Ubuntu.
Then boot from the SD card and use dd to copy the root partition from the SD card to internal storage.
Create the partition on internal storage:
sudo su
DEV=/dev/internal_storage # example: mmcblk2
parted -s "$DEV" mkpart primary ext4 20MB 90%
partprobe "$DEV"
Use lsblk -f to find the partition name of internal storage (mmcblk2)
sudo su
# dd if=/dev/SDCARD_ext4_part of=/dev/eMMC_ext4_part bs=1M status=progress
dd if=/dev/mmcblk1p1 of=/dev/mmcblk2p1 bs=1M status=progress conv=fsync
e2fsck -f /dev/mmcblk2p1
resize2fs /dev/mmcblk2p1
lsblk -f
Or use rsync
Create the partition on internal storage:
sudo su # Run all cmd as root
DEV=/dev/internal_storage # example: mmcblk2
parted -s "$DEV" mkpart primary ext4 20MB 90%
Skip the first 20 MB and use 90% of the internal storage.
Format:
mkfs.ext4 -F "${DEV}p1"
Mount internal storage:
mkdir -vp /mnt/root_internal
mount /dev/mmcblk2p1 /mnt/root_internal
Copy files:
sudo su
rsync -aAXHvx --numeric-ids --info=progress2 \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/root_internal/*","/media/*","/lost+found","/swapfile"} \
/ /mnt/root_internal/
Edit:
nano /mnt/root_internal/boot/dietpiEnv.txt
Change:
rootdev=UUID=XXXXX
Edit:
nano /mnt/root_internal/etc/fstab
## PHYSICAL DRIVES
UUID=XXXXXX-ZZZZZZZZZZZ / ext4 noatime,lazytime,rw 0 1
Remove the SD card and test booting.
If boot fails, write the first 16 MB of Multitool to internal storage.
Boot from SD card.
I recommend making a backup of the first 16 MB from the SD card using a Linux PC such as Ubuntu:
dd if=/dev/SDCARD of=sdcard-first-16MB.img bs=1M count=16 status=progress conv=fsync
sync
Then copy sdcard-first-16MB.img to the DietPi SD card.
Boot from SD card and run:
dd if=sdcard-first-16MB.img of=/dev/INTERNAL conv=fsync bs=1 count=442
dd if=sdcard-first-16MB.img of=/dev/INTERNAL conv=fsync bs=512 skip=1 seek=1
I have successfully set up DietPi on internal storage:
inxi -Fxxx
System:
Host: DietPi115
Kernel: 6.18.22-current-rockchip64
arch: aarch64
bits: 64
compiler: gcc v:13.3.0
clocksource: arch_sys_counter
Console:
pty: pts/0
Distro:
Debian GNU/Linux 13 (trixie)
Machine:
Type: ARM
System: Rockchip RK3318 BOX
details: N/A
serial: 97df7a1872ad4e7c
Drives:
Local Storage: total: 58.24 GiB
used: 3.8 GiB (6.5%)
ID-1:
/dev/mmcblk2
vendor: Samsung
model: CGND3R
size: 58.24 GiB
type: Removable
tech: SSD
serial: 0xf5a2b4f3
fw-rev: 0x7
scheme: MBR