OpenWrt Build System

If anyone is aware of OpenWrt, you might know that it provides a build system for allowing users to build their own image. Apparently this build system could be installed on FreeBSD at one time, but is not currently available.... hopefully until now :)

Here is my effort to create it:-
Code:
#  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

I've only just managed to get this working, so would appreciate any feedback. The build system does get installed, but I haven't yet produced an image, just pleased to have got this far.
 
The good folks at OpenWrt have just changed the Build System so that it no longer needs GNU time, after all my hard work getting it working :). Now if they can just incorporate the patch into mkhash.c then it will just be a simple matter of using git clone to grab the system - after you have installed the required pkgs of course.
 
The good folks at OpenWrt have just changed the Build System so that it no longer needs GNU time, after all my hard work getting it working :). Now if they can just incorporate the patch into mkhash.c then it will just be a simple matter of using git clone to grab the system - after you have installed the required pkgs of course.

I use the script you provided, got the following error, how to fix it:
Code:
gmake[8]: Entering directory '/usr/home/xiangsiwei/openwrt-v18.06.2/build_dir/host/xz-5.2.4/src/xzdec'
/usr/bin/env bash ../../libtool  --tag=CC   --mode=link gcc -D_THREAD_SAFE -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -O2 -I/usr/home/xiangsiwei/openwrt-v18.06.2/staging_dir/host/include   -L/usr/home/xiangsiwei/openwrt-v18.06.2/staging_dir/host/lib  -o xzdec xzdec-xzdec.o xzdec-tuklib_progname.o xzdec-tuklib_exit.o  ../../src/liblzma/liblzma.la  -lintl
libtool: link: gcc -D_THREAD_SAFE -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -O2 -I/usr/home/xiangsiwei/openwrt-v18.06.2/staging_dir/host/include -o xzdec xzdec-xzdec.o xzdec-tuklib_progname.o xzdec-tuklib_exit.o  -L/usr/home/xiangsiwei/openwrt-v18.06.2/staging_dir/host/lib ../../src/liblzma/.libs/liblzma.a -lintl -pthread
/usr/local/bin/ld: ../../src/liblzma/.libs/liblzma.a(liblzma_la-sha256.o): in function `transform':
sha256.c:(.text+0x68): undefined reference to `bswap32'
/usr/local/bin/ld: sha256.c:(.text+0x106): undefined reference to `bswap32'
/usr/local/bin/ld: sha256.c:(.text+0x183): undefined reference to `bswap32'
/usr/local/bin/ld: sha256.c:(.text+0x205): undefined reference to `bswap32'
/usr/local/bin/ld: sha256.c:(.text+0x27b): undefined reference to `bswap32'
/usr/local/bin/ld: ../../src/liblzma/.libs/liblzma.a(liblzma_la-sha256.o):sha256.c:(.text+0x2f5): more undefined references to `bswap32' follow                                                                                                                                 
/usr/local/bin/ld: ../../src/liblzma/.libs/liblzma.a(liblzma_la-sha256.o): in function `lzma_sha256_finish':
sha256.c:(.text+0x151f): undefined reference to `bswap64'
/usr/local/bin/ld: sha256.c:(.text+0x154a): undefined reference to `bswap32'
collect2: error: ld returned 1 exit status
gmake[8]: *** [Makefile:501: xzdec] Error 1
 
can you create openwrt build in freebsd jail successfully?
Can you tell me what you are attempting to build?
I have set up to the point of being at the menu.
 

Attachments

  • Screenshot openwrt menuconfig.png
    Screenshot openwrt menuconfig.png
    69.5 KB · Views: 524
Can you tell me what you are attempting to build?
I have set up to the point of being at the menu.
6612


MIPS->MT7621->Firely FireWRT
Can you show me the procedures how to get the point of being at the menu ?
The error I had shown occured at the point of building host tools xz and cmake
 
I built it following the instructions as posted by balanga; no more, no less.

Ok, let's rewind.
I'm happy to help, BUT, you need to provide logs and more than just sparse information. I don't have a great deal of time to allocate to this, so let's capitalize on what I can.

Start up a terminal session, invoke script and execute your build process. When it fails, exit script and post the log.

I know you mentioned running this in a jail. Is this jail some odd setup from just a standard install of FreeBSD?
 
I built it following the instructions as posted by balanga; no more, no less.

Ok, let's rewind.
I'm happy to help, BUT, you need to provide logs and more than just sparse information. I don't have a great deal of time to allocate to this, so let's capitalize on what I can.

Start up a terminal session, invoke script and execute your build process. When it fails, exit script and post the log.

I know you mentioned running this in a jail. Is this jail some odd setup from just a standard install of FreeBSD?
I built it following the instructions as posted by balanga; no more, no less.

Ok, let's rewind.
I'm happy to help, BUT, you need to provide logs and more than just sparse information. I don't have a great deal of time to allocate to this, so let's capitalize on what I can.

Start up a terminal session, invoke script and execute your build process. When it fails, exit script and post the log.

I know you mentioned running this in a jail. Is this jail some odd setup from just a standard install of FreeBSD?

I'm sorry. Thank you for taking the time to talk to me. I show the error as the following:
1. execute the script, on FreeBSD 12.0-RELEASE
2. make menuconfig, then choose Target System (MediaTek Ralink MIPS), Subtarget (MT7621 based boards), Target Profile (Firefly FireWRT), save it
3. execute make -j1 V=s
the error log is shown in the attached files
 

Attachments

  • error.txt
    484.1 KB · Views: 192
No apologies needed. It's just torturous doing 1 or 2 steps every few days.

Now, before I look at this, any other information on the jail or is it just a standard freebsd install?

What script are you referring to?
Do you mean both of these?
Code:
./scripts/feeds update -a
./scripts/feeds install -a
 
No apologies needed. It's just torturous doing 1 or 2 steps every few days.

Now, before I look at this, any other information on the jail or is it just a standard freebsd install?

What script are you referring to?
Do you mean both of these?
1. FreeBSD is standard install.
2. the script provided by balanga
Code:
#  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
3. the following code is executed:
Code:
./scripts/feeds update -a
./scripts/feeds install -a

execute make -j1 V=s, get the error. Did you get the same error?
 
After Step 3 I ran make menuconfig as per the instructions.
So I think I'm confused. I was under the impression you didn't get to that step:
You wrote: "Can you show me the procedures how to get the point of being at the menu ? "
But you are saying you've built the menu?

Ok, my confusion. So what did you select next after selecting the Target, sub Target and profile?
 
After Step 3 I ran make menuconfig as per the instructions.
So I think I'm confused. I was under the impression you didn't get to that step:
You wrote: "Can you show me the procedures how to get the point of being at the menu ? "
But you are saying you've built the menu?

Ok, my confusion. So what did you select next after selecting the Target, sub Target and profile?
Choose Target System (MediaTek Ralink MIPS), Subtarget (MT7621 based boards), Target Profile (Firefly FireWRT), save it, exit the config menu. Then just execute make -j1 V=s, get the error! There's no error compiling the xz source code in host system, but get the error I have shown in the OpenWRT build system.
 
Ok, I can confirm, their build system on FreeBSD is not in working order.
There are macro conflicts that need to be resolved by a patch.
There is nothing wrong on your end, it's them. Perhaps post a bug report with the bswapNN errors to their forums? It does seem, however, that *BSD is supported in name only, as in "it should work".
Better to try Linux, I'm afraid. I successfully built it on Devuan Linux.
 
Ok, I can confirm, their build system on FreeBSD is not in working order.
There are macro conflicts that need to be resolved by a patch.
There is nothing wrong on your end, it's them. Perhaps post a bug report with the bswapNN errors to their forums? It does seem, however, that *BSD is supported in name only, as in "it should work".
Better to try Linux, I'm afraid. I successfully built it on Devuan Linux.
Thank you for your help, have a nice day! I'm a newbie to FreeBSD, switch from Debian.
 
Back
Top