Solved NanoBSD: issue including firmware for ral driver in image

Buzz Zaman

New Member

Thanks: 2
Messages: 7

#1
With my current NanoBSD build I'm not able to bring up the ral0 interface. Instead I get the following:
Code:
...
rt2561sfw: could not load firmware image, error 2
ral0: rt2661_load_microcode: unable to retrieve firmware image rt2561sfw
ral0: rt2661_init_locked: could not load 8051 microcode, error 22
...
I figured out that I need the firmware for the device which I hoped accomplishing with ral and ralfw modules in my nanobsd.conf file (as shown at the end).

However this leads nanobsd.sh to fail (during kernel install phase), more specifically I get the following error:
Code:
===> ral (install)
install -o root -g wheel -m 555 if_ral.ko /usr/obj/nanobsd.nano//_.w/boot/kernel
install -o root -g wheel -m 555 if_ral.ko.symbols /usr/obj/nanobsd.nano//_.w/boot/kernel
===> ralfw (install)
===> ralfw/rt2561 (install)
install -o root -g wheel -m 555 rt2561fw.ko /usr/obj/nanobsd.nano//_.w/boot/kernel
install: rt2561fw.ko: No such file or directory
*** Error code 71
I'm working with 10.1-RELEASE.

I Googled around but didn't find anything useful. I guess that this is basic FreeBSD module building stuff... but I don't see it.

Apart from that I'm really impressed with NanoBSD, it's simply great!

nanobsd.conf:
Code:
NANO_NAME="nano"

NANO_KERNEL=GENERIC
NANO_ARCH=i386
TARGET_ARCH=i386; export TARGET_ARCH
TARGET_CPUTYPE=i386; export TARGET_CPUTYPE
NO_CLEAN=YES
NANO_DRIVE=ad1

NANO_MEDIASIZE=1900000
NANO_CONFSIZE=40960
NANO_RAM_ETCSIZE=20480
NANO_RAM_TMPVARSIZE=102400
NANO_NEWFS="-m 0 -b 4096 -f 512 -i 8192 -O1"
# NANO_PMAKE="make -j 8"
NANO_PMAKE="${NANO_PMAKE} -DDB_FROM_SRC"
NANO_MODULES="pf pflog if_bridge bridgestp netgraph/netgraph netgraph/ether netgraph/pppoe netgraph/socket wlan wlan_xauth wlan_tkip wlan_ccmp wlan_wep wlan_rssadapt firmware amdtemp bios wlan_amrr ral ralfw"

# 0 -> Leave second image all zeroes so it compresses better.
# 1 -> Initialize second image with a copy of the first
NANO_INIT_IMG2=0


CONF_INSTALL='
WITHOUT_INSTALLLIB=yes
WITHOUT_TOOLCHAIN=yes
'

CONF_WORLD='
WITHOUT_ACCT=yes
WITHOUT_ACPI=yes
WITHOUT_AMD=yes
WITHOUT_APM=yes
WITHOUT_AT=yes
WITHOUT_ATM=yes
WITHOUT_AUDIT=yes
WITHOUT_AUTHPF=yes
WITHOUT_BLUETOOTH=yes
WITHOUT_CALENDAR=yes
WITHOUT_CDDL=yes
WITHOUT_CTM=yes
WITHOUT_CVS=yes
WITHOUT_DICT=yes
WITHOUT_EXAMPLES=yes
WITHOUT_FDT=yes
WITHOUT_FLOPPY=yes
WITHOUT_FREEBSD_UPDATE=yes
WITHOUT_GAMES=yes
WITHOUT_GCOV=yes
WITHOUT_GPIB=yes
WITHOUT_GPIO=yes
WITHOUT_INFO=yes
WITHOUT_IPFILTER=yes
WITHOUT_IPFW=yes
WITHOUT_IPX=yes
WITHOUT_JAIL=yes
WITHOUT_LOCALES=yes
WITHOUT_LOCATE=yes
WITHOUT_LPR=yes
WITHOUT_NDIS=yes
WITHOUT_NIS=yes
WITHOUT_NLS=yes
WITHOUT_NLS_CATALOGS=yes
WITHOUT_NS_CACHING=yes
WITHOUT_PC_SYSINSTALL=yes
WITHOUT_PORTSNAP=yes
WITHOUT_PROFILE=yes
WITHOUT_QUOTAS=yes
WITHOUT_RCMDS=yes
WITHOUT_RCS=yes
WITHOUT_ROUTED=yes
WITHOUT_SHAREDOCS=yes
WITHOUT_SOURCELESS=yes
WITHOUT_SYSINSTALL=yes
WITHOUT_USB=yes
WITHOUT_MAN=yes
WITHOUT_MAN_UTILS=yes
'

cust_local() {
echo '
sshd_enable=YES
ifconfig_re0="DHCP"
' >>${NANO_WORLDDIR}/etc/rc.conf
}

customize_cmd cust_pkg
customize_cmd cust_comconsole
customize_cmd cust_install_files
customize_cmd cust_allow_ssh_root
customize_cmd cust_local
 

junovitch@

Daemon
Developer

Thanks: 610
Messages: 1,773

#2
Is there any indications of build issues in your /usr/obj/nanobsd.nano/_.bk log? That seems to be the most logical guess. Can't install what isn't there. Although I would have expected a build error to be fatal.

What's under /usr/obj/nanobsd.nano/i386.i386/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw?

Personally, I'm just lazy and don't feel like specifying every module I need. I'd rather have a bigger image and have something if I need it then do the work up front to pare it down. This is what I use this in my NanoBSD config.
Code:
NANO_MODULES=default
 
OP
OP
Buzz Zaman

Buzz Zaman

New Member

Thanks: 2
Messages: 7

#3
When I check /usr/obj/nanobsd.nano/_.bk there is no mention of ralfw.

Also the directory /usr/obj/nanobsd.nano/i386.i386/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw does not seem to exist. Even when I compile with
Code:
NANO_MODULES=default
the directory does not appear.

Even more, there is not a trace of ralfw whatsoever:
Code:
# find /usr/obj/nanobsd.nano/ | grep ralfw
#
It does exist when I compile the FreeBSD kernel manually:
Code:
# find /usr/obj/usr/ | grep ralfw
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/@
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/machine
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/x86
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561.fw
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561fw.c
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/.depend
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561.fw.fwo
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561fw.ko.debug
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561fw.o
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/export_syms
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561fw.ko.symbols
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561/rt2561fw.ko
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/@
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/machine
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/x86
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561s.fw
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561sfw.c
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/.depend
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561sfw.ko.debug
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561s.fw.fwo
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561sfw.o
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/export_syms
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561sfw.ko.symbols
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2561s/rt2561sfw.ko
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/@
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/machine
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/x86
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/rt2661.fw
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/rt2661fw.c
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/.depend
/usr/obj/usr/src/sys/GENERIC/modules/usr/src/sys/modules/ralfw/rt2661/rt2661.fw.fwo
...
So for some reason the firmware part is skipped when building with NanoBSD. But I have no idea why or what switch or option is causing this...
 
OP
OP
Buzz Zaman

Buzz Zaman

New Member

Thanks: 2
Messages: 7

#4
All the source is there waiting for me to simply read it and so I found this interesting entry in
/usr/src/sys/modules/Makefile :
Code:
.if ${MK_SOURCELESS_UCODE} != "no"
_bce= bce
_fatm= fatm
_fxp= fxp
_ispfw= ispfw
_mwlfw= mwlfw
_ralfw= ralfw
_sf= sf
_sn= sn
_ti= ti
_txp= txp
.endif
Which seems to control whether the ral firmware (and a bunch of other firmwares) is included in the kernel. (read the rest of the file for the details).

So I figured that setting the following in the nanobsd.conf would solve all misery:
Code:
CONF_BUILD='
MK_SOURCELESS_UCODE=yes
'
Strangely now the build-world (not build-kernel!) fails with:
Code:
--- buildworld ---
make[1]: "/usr/src/share/mk/bsd.own.mk" line 457: MK_SOURCELESS_UCODE can't be set by a user.
*** [buildworld] Error code 1
which deserves a thread on its own.

Anyway, when trying:
Code:
CONF_BUILD='
_ralfw=ralfw
'
things do seem to work out the way I wanted.

I haven't been able to load the new image on the device in question, but the install log this time shows the ralfw module being installed.

The issue is fixed, but I'm still interested in an explanation of someone with a clear view on all this.
 

junovitch@

Daemon
Developer

Thanks: 610
Messages: 1,773

#5
You may want to consider doing a rm -r /usr/obj/nanobsd.nano so the NO_CLEAN=YES doesn't interfere with what is getting built. See what happens when you start a build from a completely clean slate.
 
OP
OP
Buzz Zaman

Buzz Zaman

New Member

Thanks: 2
Messages: 7

#6
I actually forgot about the NO_CLEAN=YES option in my config file. I doesn't work really... even when present I still have to wait almost 30min for the image to be build. I use the -n command line option to skip the clean and build in 5min

I removed the /usr/obj/nanobsd.nano by hand but the strange error during build world still occurs.
 
OP
OP
Buzz Zaman

Buzz Zaman

New Member

Thanks: 2
Messages: 7

#7
I've just loaded the NanoBSD image to the device and the ral(4) driver now works as expected.

I still think NanoBSD is great, but a bit more documentation wouldn't hurt :)
 
Last edited by a moderator:
Top