NanoPi R4S-RK3399 is a great new OpenWrt device

should the R4S build be listed here? I only see R2S https://downloads.openwrt.org/releases/21.02.0-rc4/targets/rockchip/armv8/

No, r4s support has only been merged after openwrt-21.02 was branched off - unless it gets backported to this stable branch (at this point probably not too likely), it's not going to be part of the 21.02.x stable releases (but will be part of the next major stable release after that).

The commits were in june... /sigh/ and it was in patch notes that there was updated rockchip targets.
git.openwrt.org Git - openwrt/openwrt.git/commit

well balls to it. I'll keep using anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds: OpenWRT Builds for NanoPi R2S & R4S from official Openwrt source code with minimal set of patches (github.com) once he builds off RC4.

I still have that reboot bug on the snapshot (updated yesterday). Every time I reboot, I have to pull off the power supply and plug it again. I think it's related to the MicroSD card reader/driver. Anyone also having this issue? Is it easily solvable (i.e. without patching and recompiling manually)?
I haven't had this on FriendlyWRT.

I bought one of these to tinker with due to the promising initial results in this thread, but have been unable to get mine to boot. Tried snapshot and compiling from a fresh clone of master (my x86_64 and ipq806x builds work perfectly). I have been prepping the SD card with the following:

>sudo shred -f -v -n 0 -z /dev/sde   (clear all sectors)

>sudo fdisk /dev/sde                 (to write dos disklabel then quit)

>sudo dd if=openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img of=/dev/sde

SD card then shows the following from fdisk:

Disk /dev/sde: 30.01 GiB, 32220643328 bytes, 62930944 sectors
Disk model: USB3.0 CRW-SD/MS
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: 0x5452574f

Device     Boot  Start    End Sectors  Size Id Type
/dev/sde1  *     65536  98303   32768   16M 83 Linux
/dev/sde2       131072 344063  212992  104M 83 Linux

Insert SD card into R4S and connect power. Red power light comes on but that's it. Ethernets never come up.

Can someone point out if I am doing something obviously wrong before I have to open the unit and connect to serial? Perhaps I have a bad unit?

This sounds familiar to my first tries with this device, if the microSD is not properly formatted no LEDs or anything will boot. I even purchased a UART cable to see the serial output, apparently if the microsd is also not properly formatted then serial output will also be nil.

My recommendation is to try using balenaEtcher to flash the SD card using a known image like snapshots from owrt and go from there.

Soft reboot issue is mentioned earlier in this post.

1 Like

you did untar/zip the image right?

I made that mistake when i flashed first time however i have a serial connection and once i figured it out and reflashed it booted fine.

Also try both ethernet ports. Mine got flipped on a couple of builds.

resize2fs

There is a guide here. RPi Resize Flash Partitions - eLinux.org
Its for the pi but the section you want is right at the bottom. - Manually resizing the SD card on Raspberry Pi.

1 Like

Yeah, that's why I asked. I was hoping that these patches had already been added to OpenWRT.

It looks like the resize can't be done while openwrt is booted?

root@meow:/# resize.f2fs /dev/mmcblk0p2
        Error: In use by the system!

I did fdisk, deleted, created new partition and rebooted. Final step seems is where I am stuck.

I did try gparted on the ext4 image but I keep reading that squashfs is better to keep the life of the microsd? Anyhow any tips appreciated on resizing the SD on squashfs while booted.

1 Like

It needs to be unmounted. Probably easier to do it with a card reader on linux if you can. There's a section on that link which shows you how.

but

umount /dev/mmcblk0p2

then resize it.

Nice info on squashfs. Is it true? I'm thinking about resizing the partition so I can keep the collectd logs on reboot but I'm currently using ext4.

This is very good / easy to resize partition (instead of fdisk) but after resizing partition the filesystem needs to be expanded, no?

Followed @mercygroundabyss recommendation and unmmounted and tried but it still claims its mounted?

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *     65536   147455    81920   40M 83 Linux
/dev/mmcblk0p2      196608 31116287 30919680 14.7G 83 Linux
root@meow:/# [   31.702153] vbus_typec: disabling
^C
root@meow:/# umount /dev/mmcblk0p2
root@meow:/# resize.f2fs /dev/mmcblk0p2
        Error: In use by the system!

root@meow:/# umount -f -l /dev/mmcblk0p2
umount: /dev/mmcblk0p2: not mounted.
root@meow:/# resize.f2fs /dev/mmcblk0p2
        Error: In use by the system!

mtab

root@meow:/# cat /etc/mtab
proc /proc proc rw,nosuid,nodev,noexec,noatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,noatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0
/dev/loop0 /overlay f2fs rw,lazytime,noatime,background_gc=on,discard,no_heap,us                      er_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=ad                      aptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix 0 0
overlayfs:/overlay / overlay rw,noatime,lowerdir=/,upperdir=/overlay/upper,workd                      ir=/overlay/work 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,size=512k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0
cgroup /sys/fs/cgroup tmpfs rw,relatime,mode=755 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/net_prio cgroup rw,relatime,net_prio 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup rw,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,relatime,pids 0 0
cgroup /sys/fs/cgroup/rdma cgroup rw,relatime,rdma 0 0
debugfs /sys/kernel/debug debugfs rw,noatime 0 0
none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,noatime,mode=700 0 0
overlayfs:/overlay /opt/docker overlay rw,noatime,lowerdir=/,upperdir=/overlay/u                      pper,workdir=/overlay/work 0 0
root@meow:/#

Tried also

root@meow:/# umount -f -l /
root@meow:/# df -h
Filesystem                Size      Used Available Use% Mounted on
df: /proc/mounts: No such file or directory
root@meow:/# fsck.f2fs -f /dev/mmcblk0p2
Info: Force to fix corruption
        Error: Failed to get the device stat!
root@meow:/# resize.f2fs /dev/mmcblk0p2
        Error: Failed to get the device stat!

I can't find the same thread but this one mentions it. squashfs cached in memory so its a bit more efficient and less writes to disk (because its memory cache primarily)

1 Like

do it on another system with a card reader. You cant do it while running FROM the sd card. kinda like trying to add a stretch section to a limo while you driving it :slight_smile:

2 Likes

So, I went on a quick research and I've found this: https://openwrt.org/docs/techref/filesystems
It turns out that squashfs has its own problems on NAND Flash too. JFFS2 looks better in terms of wear leveling and so on. I have to admit that by no means I'm a specialist on this matter. But I think the discussion is valid as this equipment uses mainly SD Card storage.

You can easily resize your root partition, use resize2fs and tune2fs on OpenWrt itself.

  1. Install the required tools
opkg update
opkg install parted tune2fs resize2fs
  1. Start the parted utility
# parted
(parted) print                        //note the root parition number
(parted) resizepart 2 11000           //this will set the 2nd partition(root) end to 11GB
(parted) print                        //verify new partition end and size
(parted) q                            //exit parted
  1. remount root as RO (if fails, reboot and remount as ro)
mount -o remount,ro /
  1. Remove reserved GDT blocks (workaround as online resizing of root partition fails)
tune2fs -O^resize_inode /dev/mmcblk0p2        #verify your root parition
fsck.ext4 /dev/mmcblk0p2                      #answer y to all
  1. Reboot and
resize2fs /dev/mmcblk0p2
  1. Check new root partition size with:
df -h
7 Likes

There's no parted in RC4. Is there an alternative utility?

You can always install the ipk from snapshot.

https://downloads.openwrt.org/snapshots/packages/aarch64_generic/packages/parted_3.4-1_aarch64_generic.ipk

1 Like