From 37b51aa3d336f0d48cd337c35d76e625d8333373 Mon Sep 17 00:00:00 2001 From: Brent Roman Date: Wed, 27 Nov 2024 22:55:42 -0800 Subject: [PATCH] Reduce the size of the CMA to 16MB Include the tiny fixMACaddress script in the S0 image to assign end0 MAC address from CPU serial # in case running U-Boot earlier than 2024.10 --- config/boards/rock-s0.conf | 18 +++++++++++++++++- .../etc/udev/rules.d/05-fixMACaddress.rules | 13 ++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/config/boards/rock-s0.conf b/config/boards/rock-s0.conf index c344cc05cb68..edfed9983a0d 100644 --- a/config/boards/rock-s0.conf +++ b/config/boards/rock-s0.conf @@ -28,5 +28,21 @@ function post_family_config__rocks0() { declare -g BOOTDIR="u-boot-${BOARD}" declare -g BOOTSCRIPT=boot-rockchip64-ttyS0.cmd:boot.cmd - unset family_tweaks_bsp # disable from rockchip64_common + family_tweaks_bsp() { #overrides rockchip64_common.inc + #Install udev script that derives fixed, unique MAC addresses for net interfaces + #that are assigned random ones + bsp=$SRC/packages/bsp/rockpis + rules=etc/udev/rules.d + + install -m 755 $bsp/lib/udev/fixEtherAddr $destination/lib/udev + } +} + +function pre_install_kernel_debs__enforce_cma() { + # Set CMA to 16 megabytes, to provide more usable RAM since Rock Pi S + # has usually a small amount of DRAM (512MB) + display_alert "$BOARD" "set CMA size to 16MB due to small DRAM size" + run_host_command_logged echo "extraargs=cma=16M" ">>" "${SDCARD}"/boot/armbianEnv.txt + + return 0 } diff --git a/packages/bsp/rockpis/etc/udev/rules.d/05-fixMACaddress.rules b/packages/bsp/rockpis/etc/udev/rules.d/05-fixMACaddress.rules index 87a948aa9779..884fcf20c6b1 100644 --- a/packages/bsp/rockpis/etc/udev/rules.d/05-fixMACaddress.rules +++ b/packages/bsp/rockpis/etc/udev/rules.d/05-fixMACaddress.rules @@ -1,6 +1,13 @@ -#If a network interface is being assigned a new, different address on each boot, -#enable the corresponding line below to derive its MAC addr from UUID of rootfs -#Beware that all the two digit hex code prefixes below must be unique! +#If a network interface is being assigned a different MAC address on each boot, +#or the MAC address is based on a disk image (rather than a hardware serial #), +#enable the corresponding line below to derive that interface's MAC address from +#the RK3308 SOC's unique serial number. + +#All the two digit hex code prefixes passed to fixEtherAddr should be unique +#and chosen such that (n-2)%4 == 0 KERNEL=="wlan0", ACTION=="add" RUN+="fixEtherAddr %k 0a" KERNEL=="p2p0", ACTION=="add" RUN+="fixEtherAddr %k 0e" + +#U-Boot >=V2024.10 sets the built-in Ethernet MAC adr from the SOC serial number +#KERNEL=="end0", ACTION=="add" RUN+="fixEtherAddr %k 06"