Raspberry Pi 4 released

Hello I need to know what packages i need to download to use USB drive as FTP server and also use smb to access files from it inside windows. And how to setup password for it

Here is what I did to get an RPi 3B to work. Just to be on the safe side, I installed modules/drivers for seven commonly used USB ethernet adapter chipsets, including some gigabit chipsets. Mostly because I saved the image to use for friends, so it works out that I can share this procedure and support pretty much any USB to ethernet adapter. Also I kept running into a problem where the logs were flooded with messages about not being able to set the CPU clock speed. This would wear out the flash, and it made it nearly impossible to find anything in the logs, so I set the min and max clock speeds to 600mhz, and also set that in the config.txt.
I'm currently on a 50mbps internet connection and I setup OpenWRT on this Pi as a VPN client. I can fully max out my connection and the CPU rarely breaks 1% usage, even though its under-clocked to 600mhz. I have yet to test this on a faster connection. Theoretically you should be able to max out VPN throughput to wire speeds without having the CPU as a bottleneck, even at 600mhz. Also the CPU on an RPi4 is going to get more done at a given clock speed. Under-clocking also reduces the power consumption.

This is done with OpenWrt 19.07.2 r10947-65030d81f3 / LuCI openwrt-19.07 branch git-20.057.55219-13dd17f

Also I use a TrendNET TU3-ETG USB3 to gigabit adapter, it is common to find them for less than $20 US. Its not made in China, and the chipset is made in Taiwan... because from a moral perspective China seems to be doing their best to make Nazi Germany look like saints.

Here is the short version of what I did, connect a screen and keyboard to get this done. Also you'll want to use the onboard NIC for your LAN in case something happens to the USB device.

After you login...

uci set network.lan.ipaddr=192.168.168.xx
uci set network.lan.gateway=192.168.168.1
uci set network.lan.dns=192.168.168.1
service network restart

#DO NOT uci commit as this just makes a mess to clean up... restarting the network services uses the above values, restarting the PI reverts to a functional router.

Once you have it talking to your LAN...

opkg update
opkg install nano kmod-usb-core kmod-nls-base kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-rndis kmod-usb-ohci kmod-usb-uhci kmod-usb2 usb-modeswitch kmod-usb-net-asix-ax88179 openvpn-openssl luci-app-openvpn
opkg install kmod-usb-net-mcs7830 kmod-usb-net-pegasus kmod-usb-net-rtl8150 kmod-usb-net-kaweth kmod-usb-net-rtl8152 kmod-usb-net-sr9700

reboot

From the web interface, add the following line to the startup in openwrt:
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq


Added the following lines to config.txt using an SD card reader on my PC:

#As a router, 600mhz X4 cores should be plenty. Also trying to get rid of errors setting CPU freq.
arm_freq=600
arm_freq_min=600

Cheers!

Also I forgot to mention that I'm using one of those metal cases that acts as a heatsink, its very durable. Running the pi at 600 mhz means it doesn't generate much heat LOL.

They make them for the Pi4 now, Vilros has them.

Although with that case it would probably be fine to put this in some overheated place in the summer and not have any problems.

Greetings everyone. Got my hands on the Rpi 4 last week and look forward to using it as the router here at home. I have a few questions for the veterans here.

  1. Reading around and came upon an old post which talks about optimised compiling. How much of an impact does it make for a device ours (compared to the standard snapshot)?

  2. I recently attempted (and managed) to compile an image on the pi itself (took hours obviously). I wanted to see if the -march=native -mtune=native flags worked within the menuconfig. How do I go about looking to see if it worked (at all if not accurately).

  3. Out of pure curiosity. Is it even possible to run Open-WRT entirely in RAM and use the sd card for logging and backing up settings and such. If it were possible would it not increase the life of the sd card (or ssd for the adventerous)?

Thanks!
p.s looking forward to learning a lot from all of you.

  1. for such a powerful device, why bother... set min_freq to max and call it a day
  2. check your make logs
  3. possible with an initramfs... with good sdcards less than $20AUD/$12US unless you are mounting it as an 'installation' in some hard to reach remote place... again, why bother (ok, an uber secure / tripwire type setup would be another use)? just make sure anything (custom installed that is) data heavy is working on tmpfs and you'll get more life out of your sdcard than if it were in a phone...
2 Likes

…and for OpenWrt, you neither need a particularly good, nor fast, nor large sdhc card (100 MB are already plenty - and OpenWrt reduces writes to a minimum, with >=1 GB RAM or the RPi4, the whole rootfs is probably cached in RAM anyways).

3 Likes

Thanks for the clarification.

Went through the logs and here's what I wound up with:
-mlittle-endian -mabi=lp64 -march=armv8-a+crc -mtune=cortex-a72

Interestingly there's a difference between cpuinfo's output when running 32-bit vs 64-bit (features to be more specific). Running 64-bit to make all 8GB available to see what's going on.

Time to go and try a bunch of other things on the pi. Going to get a 2GB 4B for Open-WRT.

p.s 8GB is overkill right?

Edit: @wulfy23 That's not doable in my case since it's hot and humid for most of the year where I live. Besides I was asking with respect to efficiency rather than all out performance.

1 Like

For OpenWRT even 1GB is overkill. LOL

Using a 1GB board, mine is barely using 6% of the RAM.

Hahahaha. That is true. Got mine as a gift so was wondering.

@madfade35 I'm running the 2Gb model and using around 200mb with a bunch of ad-block lists and a few other odds and ends. Waiting for a bandwidth upgrade before I attempt anything with openVPN, but it hasn't broken a sweat yet.

Does anyone know if I can plug a pi zero into my pi 4b and use the usb ethernet adapter to run a pi-hole? Not sure if offloading the adblock stuff is going to make a huge difference in performance when I get a gigabit line, but if so I'm ready to offload to the zero. I have heard pi-hole is more robust than the openWRT adblock for mobile ads, but I would like to know if someone has done a comparison.

1 Like

My RPi4 is using a mere 120MB of its memory. Pihole is running on a couple of other boards. You won't have any issues running both adblock and routing a gigabit line.

1 Like

Just checking in and giving feedback-I have been running the snapshot build from August on my Pi 4 1Gb-interfacing to a 150/150 PON link-it's never broke a sweat. Using a Plume Mesh system off a D-Link managed switch for wi-fi and a Realtek £10 USB to Ethernet adaptor as the (extra) WAN link- all in all, it seems a match made in heaven, I wish I had made the switch from my N600 years ago (well, when the Pi 4 came out!). Just waiting for it to make it into mainline builds now :slight_smile:
I'd recommend this setup to anyone, its brilliant to have 14GB of free disk space and 1GB of RAM!

1 Like

That's great! I'm waiting for the 2GB pi to arrive. I'm thinking of using the one I currently have for image building. On that I have a few questions.

  1. What's the absolute minimum required drivers/firmware for building this device's image?
    Note: The 2GB is going to be between WAN and WiFI AP. Won't be using the WiFi module. TP-Link UE300 connecting to WiFi AP. Services will be LUCI, NAT, firewall and pi-hole & VPN. Mainly home use.

  2. Which package would be best suited for monitoring device temperature?

  3. Which firewall service/package is best suited for easier setup (automatic would be nice)? So family don't have a hard time if something is out of whack.

  4. OpenVPN or Wireguard for VPN? (Pi-hole on the go)

Finally, is there any advantage or useful info that can be gathered from building on the target device itself?

For my use case, is wireguard is the best home VPN. It's the next gen one and more simplistic. I ran openvpn for years and switched to WG about 18 months ago. No issues now that their iOS app has been improved since the initial betas. The on-demand setting is great. Auto on/off based on SSIDs I select. Walk into work, WiFi connects and WG gets activates. Leave, deactivates. Enter a public WiFi, activates, etc.

YMMV.

2 Likes

As of the OpenWrt tag/release v19.07.4, the Raspberry Pi 4B still not supported officially.
Only the snapshot code supports RPI4.

Also, water is wet..

But jesting aside, it's pretty much standard that devices don't move from snapshots to 'official' support until there's a major release. I wouldn't expect to see anything other than snapshot builds for the RPi4 until OpenWRT 20.

I tried building an update image and got this error

error: ext4_allocate_best_fit_partial: failed to allocate 734 blocks, out of space?

From my searching it seems this is because the defined image size is smaller than my package requirements. Is there a way to make the image size bigger when using the instructions provided above to build the image?

#!/bin/bash

ib_dir="YOURFOLDERHERE"


fixupsizes() {

IBCONFIG=$(find $ib_dir  -maxdepth 1 -type f | grep '/.config$')
IBCONFIGpsB=$(cat $IBCONFIG | grep '^CONFIG_TARGET_KERNEL_PARTSIZE' | cut -d'=' -f2)
IBCONFIGpsR=$(cat $IBCONFIG | grep '^CONFIG_TARGET_ROOTFS_PARTSIZE' | cut -d'=' -f2)

echo ">>> Modding PARTSIZE bootpartsize: $IBCONFIGpsB > $1 rootfssize: $IBCONFIGpsR > $2"

sed -i s/CONFIG_TARGET_KERNEL_PARTSIZE=${IBCONFIGpsB}/CONFIG_TARGET_KERNEL_PARTSIZE=$1/ $IBCONFIG
sed -i s/CONFIG_TARGET_ROOTFS_PARTSIZE=${IBCONFIGpsR}/CONFIG_TARGET_ROOTFS_PARTSIZE=$2/ $IBCONFIG
}

fixupsizes "384" "960"


Thanks I'm not 100% on what's going on here, but It looks like it's trying to find something in the .config file and assigns it to the IBCONFIG variable the is looks up
CONFIG_TARGET_KERNEL_PARTSIZE and CONFIG_TARGET_ROOTFS_PARTSIZE and combines them with IBCONFIG into some new variables then it applies those new values to the config file.

Hopefully I am understanding what is going on well enough. Though when I try to run the steps the first one fails:

IBCONFIG=$(find $ib_dir depth 1 .config)
find: ‘depth’: No such file or directory
find: ‘1’: No such file or directory

I don't have much experience with find so I'm not sure what to do here.

1 Like

yep... pulled it from a larger script so its missing a line or two...

you can just open .config and search for PARTSIZE :face_with_monocle:

( fixed up code above a little... should be a bit better now... )

1 Like