Anyone using FreeBSD?

I've put together a OpenWrt build system for FreeBSD, but am not really familiar with how it works.

If anyone is using FreeBSD, would you be able to test my system?

I have a small script which installs it so there is no need to read any instructions.

I will post it here if anyone is interested.

Happy to test for you / us.

Here is my script - it could do with some refinement but it does create the build system (at least for me)

pkg bootstrap -y

#  Install required pkgs

cat <<EOF | xargs pkg install -y
git
bash
gmake
gtar
gcc
gawk
ncurses
findutils
patch
wget
getopt
coreutils
EOF

# Build and install GNU time
#
#wget https://ftp.gnu.org/gnu/time/time-1.9.tar.gz
#tar zxf time-1.9.tar.gz
#cd time-1.9
#./configure
#make
#make install
#mv /usr/local/bin/time /usr/local/bin/gtime

# Install OpenWrt Build System

mkdir ~/OpenWrt-BuildSystem
cd ~/OpenWrt-BuildSystem
git clone https://github.com/openwrt/openwrt.git
cd openwrt

# patch mkhash.c

wget 'https://bugs.openwrt.org/index.php?getfile=292' -O patchfile
patch scripts/mkhash.c -i patchfile -o scripts/mkhash.c

# Let's go!!!

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

make  menuconfig

Any feedback appreciated.

Iā€™d suggest doing it in a jail, as some of the GNU variants can break other operations in unexpected ways.

User will likely need to be running bash, not just in the path.

Some fancy linking will likely be needed to run binutils, dtc, and the like for development work. Same for mounting and manipulation of file systems, especially on FreeBSD 11 and prior.

Agreed, don't mess with /usr/* dirs at all.
As jeff points out you'll most likely have more fun down the road...

All FreeBSD pkgs get installed under /usr/local, so not really sure what the problem is.

Then do yourself a favor in advance and only try this on a throw-away VM or in a dedicated jail. Getting the wrong binary during a system critical operation cal lead you into a world of hurt. /rescue/ may soon become a familiar place for you.

Fails updating packages -- /bin/sh: mkhash: not found

[jeff@freebsd-12 ~/devel/openwrt]$ freebsd-version 
12.0-RELEASE-p3

Unmodified /etc/pkg/FreeBSD.conf

OpenWrt master branch

./scripts/feeds update packages
[jeff@freebsd-12 ~/devel/openwrt]$ ./scripts/feeds update packages
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git' ...
Already up to date.
Create index file './feeds/packages.index' 
Checking 'working-make'... ok.
Checking 'case-sensitive-fs'... ok.
Checking 'proper-umask'... ok.
Checking 'gcc'... ok.
Checking 'working-gcc'... ok.
Checking 'g++'... ok.
Checking 'working-g++'... ok.
Checking 'ncurses'... ok.
Checking 'perl-thread-queue'... ok.
Checking 'tar'... ok.
Checking 'find'... ok.
Checking 'bash'... ok.
Checking 'patch'... ok.
Checking 'diff'... ok.
Checking 'cp'... ok.
Checking 'seq'... ok.
Checking 'awk'... ok.
Checking 'grep'... ok.
Checking 'getopt'... ok.
Checking 'stat'... ok.
Checking 'unzip'... ok.
Checking 'bzip2'... ok.
Checking 'wget'... ok.
Checking 'perl'... ok.
Checking 'python'... ok.
Checking 'git'... ok.
Checking 'file'... ok.
Prerequisite check failed. Use FORCE=1 to override.
gmake: *** [/usr/home/jeff/devel/openwrt/include/toplevel.mk:168: staging_dir/host/.prereq-build] Error 1
/bin/sh: mkhash: not found
/bin/sh: mkhash: not found

Pretty nasty.... I think we can safely say 11 is out the window....

after mkhash....

xz is broken, xzdec ( websearch stdendian.h ) + is not happy with the automake version!

then some success;

flock <> m4macros ( 5ish )

glib iconv errors....

gconvert.c:61:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv
 #error GNU libiconv not in use but included iconv.h is from libiconv
  ^~~~~
gmake[11]: *** [Makefile:1373: libglib_2_0_la-gconvert.lo] Error 1

Your right though.... does get the build system partly going :slight_smile:

frisbee12 might fair better?

...or use bhyve with Debian or Alpine Linux instead :wink:
Alpine feels a lot snappier than Debian but might be placebo.

1 Like

From my script above....

patch mkhash.c

wget 'https://bugs.openwrt.org/index.php?getfile=292' -O patchfile
patch scripts/mkhash.c -i patchfile -o scripts/mkhash.c

Not sure what you are doing.. it builds fine on 11 here.

Did you run my script?

@balanga Please use "Preformatted text </>" for logs, scripts, configs and general console output.
grafik

After getting frustrated with my TP-LINK Archer MR200 v4 being unreliable I thought I'd try installing OpenWrt on it after seeing that an image was available:-

Unfortunately I didn't notice that this is only available for v1 of the device, so I'm looking for a v4 image, which I will have to build myself, so I'm checking if my FreeBSD OpenWrt build system still works. It's over 3 years since I last tried so I'm just seeing if it needs updating.

It looks like I no longer need GNU time, although I'm not sure if mkhash.c needs patching.

One error which crept in was the check for 'getopt' failed although it was OK three years ago.

Another error was the check for 'rsync' which passed earlier today but then failed. Not sure if that could have been due to the process running in a jail.

Any comments would be appreciated.

Looks like I omitted 'rsync' from my list of required apps. I was under the impression that it was part of the standard FreeBSD installation, but it looks as though I had already installed it previously when I put my script together.

So, as @jeff pointed out, I should have originally tested in a jail environment, which I am now doing.

Unfortunately I installed Midnight Commander before anything else which pulled in diffutils which is another pkg which ought to be added to the list of pkgs in a pristine environment.

why not use linux

I prefer using FreeBSD whenever I can. Linux is not an OS, it's a distribution of various apps into some flavour, all of which are different from each other without some consistancy as you can see from this list:-

After revisiting my script and updating FreeBSD to 13.0-RELEASE I am left with one outstanding error, namely

Checking 'getopt'... failed.

Can anyone suggest why this may be failing?

My updated script consists of:-

pkg bootstrap -y

#  Install required pkgs

cat <<EOF | xargs pkg install -y
git
rsync
bash
gmake
gtar
gcc
gawk
ncurses
findutils
diffutils
patch
wget
getopt
coreutils
EOF


# Install OpenWrt Build System

mkdir ~/OpenWrt-BuildSystem2
cd ~/OpenWrt-BuildSystem2
git clone https://github.com/openwrt/openwrt.git
cd openwrt


# Let's go!!!

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

make  menuconfig

If anyone has access to a FreeBSD system could you check this out?

1 Like

Check if your getopt meets those conditions, or if you have to teach the system about another one (different path ordering).

2 Likes