Running OpenWrt on Raspberry Pi 3

12 minute read

Checking out OpenWrt code

git clone https://www.github.com/openwrt/openwrt

Configuration

menuconfig can be used for configuring openwrt, go to project direcotry, type:

make menuconfig

Then make the following selection:

  • select ‘Broadcom BCM27xx’ under ‘Target System’
  • select ‘BCM2709/BCM2710 32 bit based boards’ under ‘Subtarget’
  • select ‘Raspberry Pi 2B/3B/3B+/3CM’ under ‘Target Profile’
  • deselect ‘squashfs’ under ‘Target Images’

Finally, press <Esc><Esc> to exit, remember save the config before exit when prompted.

After that default configuration will be save with the name .config under current directory, board configuration can be generated with diffconfig script after .config file created:

./scripts/diffconfig.sh > target/linux/brcm2708/configs/rpi3b_defconfig

cat target/linux/brcm2708/configs/rpi3b_defconfig

CONFIG_TARGET_brcm2708=y
CONFIG_TARGET_brcm2708_bcm2709=y
CONFIG_TARGET_brcm2708_bcm2709_DEVICE_rpi-2=y
# CONFIG_TARGET_ROOTFS_SQUASHFS is not set

Download required packages and build

Download all the required packages before build with:

./scripts/feeds update -a
./scripts/feeds install -a
make download

The default download directry is dl

Simply issue make command will do the build, and the final image can be found under bin directory:

bin/targets/brcm2708/bcm2709/openwrt-brcm2708-bcm2709-rpi-2-ext4-factory.img

Or if you wanna see logs during build process, use the below command:

make -j3 V=s 2>&1 | tee build.log | grep -i '[^_-"a-z]error[^_-.a-z]'

Next time when we changed the configuration simply do the following will be ok:

cp target/linux/brcm2708/configs/rpi3b_defconfig .config
make download
make defconfig
make -j3 V=s

Flash the image to board

sudo dd bs=4M if=openwrt-brcm2708-bcm2709-rpi-2-ext4-factory.img of=/dev/sdc conv=fsync

MAKE SURE YOU SPECIFIED THE CORRECT DEVICE NODE

Bootup message

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.90 (fdbai@fdbai-desktop) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r8985-ddc9fd5)) #0 SMP Sun Jan 6 07:33:11 2019
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 16 MiB at 0x3a400000
[    0.000000] random: get_random_bytes called from start_kernel+0x84/0x35c with crng_init=0
[    0.000000] percpu: Embedded 16 pages/cpu @b9c35000 s33932 r8192 d23412 u65536
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 240792
[    0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=640 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 kgdboc=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 937856K/970752K available (4651K kernel code, 148K rwdata, 1212K rodata, 1024K init, 351K bss, 16512K reserved, 16384K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xbb400000   ( 948 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x8058ac64   (5644 kB)
[    0.000000]       .init : 0x80700000 - 0x80800000   (1024 kB)
[    0.000000]       .data : 0x80800000 - 0x80825380   ( 149 kB)
[    0.000000]        .bss : 0x8082a150 - 0x80881dc8   ( 352 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000020] Switching to timer-based delay loop, resolution 52ns
[    0.000220] Console: colour dummy device 80x30
[    0.000679] console [tty1] enabled
[    0.000714] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000749] pid_max: default: 32768 minimum: 301
[    0.000882] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000911] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001438] CPU: Testing write buffer coherency: ok
[    0.001780] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002093] Setting up static identity map for 0x100000 - 0x100060
[    0.002208] Hierarchical SRCU implementation.
[    0.002716] smp: Bringing up secondary CPUs ...
[    0.003302] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.003920] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.004506] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.004584] smp: Brought up 1 node, 4 CPUs
[    0.004647] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.004665] CPU: All CPU(s) started in HYP mode.
[    0.004680] CPU: Virtualization extensions available.
[    0.013692] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.013905] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.013945] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.014587] pinctrl core: initialized pinctrl subsystem
[    0.015248] NET: Registered protocol family 16
[    0.017483] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.020841] cpuidle: using governor ladder
[    0.020879] cpuidle: using governor menu
[    0.021331] Serial: AMBA PL011 UART driver
[    0.022726] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.023123] uart-pl011 3f201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
[    0.047317] bcm2835-dma 3f007000.dma: DMA legacy API manager at bb813000, dmachans=0x1
[    0.049016] SCSI subsystem initialized
[    0.049208] usbcore: registered new interface driver usbfs
[    0.049266] usbcore: registered new interface driver hub
[    0.049332] usbcore: registered new device driver usb
[    0.050031] raspberrypi-firmware soc:firmware: Attached to firmware from 2018-11-23 19:36
[    0.051057] clocksource: Switched to clocksource arch_sys_counter
[    0.055502] NET: Registered protocol family 2
[    0.056050] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.056175] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.056375] TCP: Hash tables configured (established 8192 bind 8192)
[    0.056507] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.056565] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.056750] NET: Registered protocol family 1
[    0.057870] Crashlog allocated RAM at address 0x3f00000
[    0.058037] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.061776] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.063198] io scheduler noop registered
[    0.063218] io scheduler deadline registered
[    0.063330] io scheduler cfq registered (default)
[    0.065880] BCM2708FB: allocated DMA memory fa510000
[    0.065926] BCM2708FB: allocated DMA channel 0 @ bb813000
[    0.075553] Console: switching to colour frame buffer device 80x30
[    0.084661] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[    0.088409] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    0.094584] vc-sm: Videocore shared memory driver
[    0.104275] brd: module loaded
[    0.110834] loop: module loaded
[    0.114178] libphy: Fixed MDIO Bus: probed
[    0.117151] usbcore: registered new interface driver lan78xx
[    0.120097] usbcore: registered new interface driver smsc95xx
[    0.122923] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    0.153563] dwc_otg 3f980000.usb: base=0xf0980000
[    0.356420] Core Release: 2.80a
[    0.359076] Setting default values for core params
[    0.361766] Finished setting default values for core params
[    0.564626] Using Buffer DMA mode
[    0.567223] Periodic Transfer Interrupt Enhancement - disabled
[    0.569895] Multiprocessor Interrupt Enhancement - disabled
[    0.572560] OTG VER PARAM: 0, OTG VER FLAG: 0
[    0.575160] Dedicated Tx FIFOs mode
[    0.578007] WARN::dwc_otg_hcd_init:1046: FIQ DMA bounce buffers: virt = 0xba504000 dma = 0xfa504000 len=9024
[    0.583475] FIQ FSM acceleration enabled for :
[    0.583475] Non-periodic Split Transactions
[    0.583475] Periodic Split Transactions
[    0.583475] High-Speed Isochronous Endpoints
[    0.583475] Interrupt/Control Split Transaction hack enabled
[    0.597090] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x80412cc8
[    0.599727] WARN::hcd_init_fiq:460: FIQ ASM at 0x80412fe4 length 36
[    0.602330] WARN::hcd_init_fiq:486: MPHI regs_base at 0xf0006000
[    0.604953] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.607605] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.612921] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    0.615770] Init: Port Power? op_state=1
[    0.618532] Init: Power Port (0)
[    0.621427] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.624277] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.629844] usb usb1: Product: DWC OTG Controller
[    0.632696] usb usb1: Manufacturer: Linux 4.14.90 dwc_otg_hcd
[    0.635541] usb usb1: SerialNumber: 3f980000.usb
[    0.638724] hub 1-0:1.0: USB hub found
[    0.641516] hub 1-0:1.0: 1 port detected
[    0.644836] usbcore: registered new interface driver uas
[    0.647608] usbcore: registered new interface driver usb-storage
[    0.650268] mousedev: PS/2 mouse device common for all mice
[    0.652877] i2c /dev entries driver
[    0.655926] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    0.658897] bcm2835-cpufreq: min=600000 max=1200000
[    0.661997] sdhci: Secure Digital Host Controller Interface driver
[    0.664782] sdhci: Copyright(c) Pierre Ossman
[    0.667822] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe
[    0.670959] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[    0.673998] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.680157] vchiq: vchiq_init_state: slot_zero = ba580000, is_master = 0
[    0.682780] [vc_sm_connected_init]: start
[    0.691183] [vc_sm_connected_init]: end - returning 0
[    0.693096] NET: Registered protocol family 10
[    0.695008] Segment Routing with IPv6
[    0.697295] NET: Registered protocol family 17
[    0.700085] 8021q: 802.1Q VLAN Support v1.8
[    0.703201] Registering SWP/SWPB emulation handler
[    0.710620] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    0.713497] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    0.720261] console [ttyS0] disabled
[    0.723133] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 166, base_baud = 31250000) is a 16550
[    0.861152] Indeed it is in host mode hprt0 = 00021501
[    0.866459] console [ttyS0] enabled
[    1.121081] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.125454] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    1.141132] Indeed it is in host mode hprt0 = 00001101
[    1.149153] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    1.412696] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    1.434951] random: fast init done
[    1.438027] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.471567] sdhost: log_buf @ ba507000 (fa507000)
[    1.481889] hub 1-1:1.0: USB hub found
[    1.523456] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.533567] hub 1-1:1.0: 5 ports detected
[    1.540817] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.679907] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.691401] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.701081] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.710458] of_cfs_init
[    1.715955] of_cfs_init: OK
[    1.742816] Waiting for root device /dev/mmcblk0p2...
[    1.828676] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.845560] mmc0: new high speed SD card at address cb7d
[    1.854260] mmcblk0: mmc0:cb7d SD01G 947 MiB
[    1.862564]  mmcblk0: p1 p2
[    1.872949] mmc1: new high speed SDIO card at address 0001
[    1.895448] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    1.908788] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.920367] Freeing unused kernel memory: 1024K
[    1.941092] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.980284] init: Console is alive
[    1.987066] init: - watchdog -
[    2.071125] Under-voltage detected! (0x00050005)
[    2.081324] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    2.091346] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.107195] smsc95xx v1.0.6
[    2.116187] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.128905] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.144990] init: - preinit -
[    2.204169] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:c3:53:cc
[    2.204912] random: procd: uninitialized urandom read (4 bytes read)
[    2.331117] usb 1-1.5: new full-speed USB device number 4 using dwc_otg
[    2.362807] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    2.373875] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    2.484867] usb 1-1.5: New USB device found, idVendor=0a5c, idProduct=21ec
[    2.495346] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.509364] usb 1-1.5: Product: BCM20702A0
[    2.516790] usb 1-1.5: Manufacturer: Broadcom Corp
[    2.524877] usb 1-1.5: SerialNumber: 00198600164E
[    5.182453] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    5.192872] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[    6.452573] mount_root: mounting /dev/root
[    6.460514] EXT4-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
[    6.482081] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    6.522181] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    6.540592] urandom-seed: Seed file not found (/etc/urandom.seed)
[    6.567927] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    6.582590] procd: - early -
[    6.589014] procd: - watchdog -
[    7.232179] procd: - watchdog -
[    7.238738] procd: - ubus -
[    7.251474] random: ubusd: uninitialized urandom read (4 bytes read)
[    7.295656] random: ubusd: uninitialized urandom read (4 bytes read)
[    7.305314] random: ubusd: uninitialized urandom read (4 bytes read)
[    7.315176] procd: - init -
Please press Enter to activate this console.
[    7.358784] EXT4-fs error (device mmcblk0p2): ext4_lookup:1587: inode #242: comm find: deleted inode referenced: 245
[    7.376810] EXT4-fs (mmcblk0p2): Remounting filesystem read-only
[    7.386025] EXT4-fs error (device mmcblk0p2): ext4_lookup:1587: inode #242: comm find: deleted inode referenced: 246
[    7.471945] kmodloader: loading kernel modules from /etc/modules.d/*
[    7.500539] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    7.517208] hidraw: raw HID events driver (C) Jiri Kosina
[    7.529903] bcm2835_alsa bcm2835_alsa: card created with 8 channels
[    7.553031] Loading modules backported from Linux version v4.19.7-0-g61c68f2a2af0
[    7.566738] Backport generated by backports.git v4.19.7-1-0-g148b072d
[    7.578197] ip_tables: (C) 2000-2006 Netfilter Core Team
[    7.591445] nf_conntrack version 0.5.0 (15360 buckets, 61440 max)
[    7.617386] usbcore: registered new interface driver usbhid
[    7.626159] usbhid: USB HID core driver
[    7.638949] xt_time: kernel timezone is -0000
[    7.659765] PPP generic driver version 2.4.2
[    7.668039] NET: Registered protocol family 24
[    7.684974] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    7.718902] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt failed with error -2
[    7.737857] brcmfmac mmc1:0001:1: Falling back to user helper
[    7.757969] firmware brcm!brcmfmac43430-sdio.raspberrypi,3-model-b.txt: firmware_loading_store: map pages failed
[    7.901018] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    7.917136] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.clm_blob failed with error -2
[    7.934718] brcmfmac mmc1:0001:1: Falling back to user helper
[    7.953965] firmware brcm!brcmfmac43430-sdio.clm_blob: firmware_loading_store: map pages failed
[    7.970316] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-11), device may have limited channels available
[    7.992892] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[    8.058244] usbcore: registered new interface driver brcmfmac
[    8.070199] kmodloader: done loading kernel modules from /etc/modules.d/*
[    8.202556] EXT4-fs error (device mmcblk0p2): ext4_lookup:1587: inode #242: comm ls: deleted inode referenced: 245
[    8.222918] EXT4-fs error (device mmcblk0p2): ext4_lookup:1587: inode #242: comm ls: deleted inode referenced: 246
[   10.253123] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   10.267040] br-lan: port 1(eth0) entered blocking state
[   10.276546] br-lan: port 1(eth0) entered disabled state
[   10.286257] device eth0 entered promiscuous mode
[   10.295947] br-lan: port 1(eth0) entered blocking state
[   10.305122] br-lan: port 1(eth0) entered forwarding state
[   10.314479] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   11.191098] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   11.202239] br-lan: port 1(eth0) entered disabled state
[   11.868797] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[   11.884648] br-lan: port 1(eth0) entered blocking state
[   11.893529] br-lan: port 1(eth0) entered forwarding state
[   20.791133] Voltage normalised (0x00000000)



BusyBox v1.30.0 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r8985-ddc9fd5
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/#

References