From 97e3d165a6d7e02fc967dd8555dfa9476af7c28c Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Mon, 27 Apr 2026 09:35:50 -0400 Subject: [PATCH] raspberrypi2: add usb networking and change to usb storage Add support for USB networking and change to USB storage for the boot device. This requires adding in a workaround of "dwc_otg.fiq_fsm_enable=0" to prevent a hang during boot. Booting from a USB devices prevents and issues with "power of 2" for emulated SD cards and seems to be more reliable. Also, add in the early console help with future debugging. Also, adding in init-ifupdown file to automatically get an IP address on the USB network interface. This is the same file currently in OE Core, only with the USB interface being automatically brought up and given a dynamic address. This will help when testimage support is added. Signed-off-by: Jon Mason --- conf/machine/raspberrypi2.conf | 9 +++--- recipes-core/init-ifupdown/files/interfaces | 31 +++++++++++++++++++ .../init-ifupdown/init-ifupdown_1.0.bbappend | 6 ++++ 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 recipes-core/init-ifupdown/files/interfaces create mode 100644 recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend diff --git a/conf/machine/raspberrypi2.conf b/conf/machine/raspberrypi2.conf index 1d4655e..f502034 100644 --- a/conf/machine/raspberrypi2.conf +++ b/conf/machine/raspberrypi2.conf @@ -22,9 +22,10 @@ QB_SYSTEM_NAME = "qemu-system-arm" QB_MACHINE = "-machine raspi2b" QB_MEM = "-m 1024" QB_DTB = "bcm2709-rpi-2-b.dtb" -QB_NET = "none" -QB_KERNEL_ROOT = "/dev/mmcblk0" -QB_KERNEL_CMDLINE_APPEND = "rootwait" +QB_NETWORK_DEVICE = "-device usb-net,netdev=net0,mac=@MAC@" +QB_KERNEL_ROOT = "/dev/sda" +# The dwc_otg.fiq_fsm_enable setting is necessary to get USB devices (both disk and net) working. Without this, boot hangs +QB_KERNEL_CMDLINE_APPEND = "rootwait earlycon=pl011,0x3f201000 dwc_otg.fiq_fsm_enable=0" QB_RNG = "" -QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=sd,format=raw" +QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device usb-storage,drive=disk0" QB_DEFAULT_FSTYPE = "ext3" diff --git a/recipes-core/init-ifupdown/files/interfaces b/recipes-core/init-ifupdown/files/interfaces new file mode 100644 index 0000000..6785c87 --- /dev/null +++ b/recipes-core/init-ifupdown/files/interfaces @@ -0,0 +1,31 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +auto lo +iface lo inet loopback + +# Wireless interfaces +iface wlan0 inet dhcp + wireless_mode managed + wireless_essid any + wpa-driver wext + wpa-conf /etc/wpa_supplicant.conf + +iface atml0 inet dhcp + +# Wired or wireless interfaces including predictable names +auto eth0 +iface eth0 inet dhcp +iface eth1 inet dhcp + +# Busybox ifupdown won't process /en* correctly +auto /en*=eth +iface eth inet dhcp + +# Ethernet/RNDIS gadget (g_ether) +# ... or on host side, usbnet and random hwaddr +auto usb0 +iface usb0 inet dhcp + +# Bluetooth networking +iface bnep0 inet dhcp diff --git a/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend new file mode 100644 index 0000000..65e1728 --- /dev/null +++ b/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -0,0 +1,6 @@ +# +# Enable second network interface on startup +# +PACKAGE_ARCH = "${MACHINE_ARCH}" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:"