Solved Building mfslinux on FreeBSD

I'm trying to build mfslinux on FreeBSD, which apparently should be possible but in the Makefile it says
Code:
ifeq ($(BUILD_OS),FreeBSD)

How do I get the Makefile to recognise the build environment?
 
Maybe read the documentation?



Oh, look, line 29 in the Makefile:
Code:
BUILD_OS?=    $(shell uname)
So, the Makefile as it stands should be able to handle being built on FreeBSD with any changes/additions?

Nothing seems to get built - can't think why...I get all these errors:-

Code:
/bin/ash: Can't create 'bin/ash'
./bin/cat: Can't create 'bin/cat'
./bin/chgrp: Can't create 'bin/chgrp'
./bin/chmod: Can't create 'bin/chmod'
./bin/chown: Can't create 'bin/chown'
./bin/cp: Can't create 'bin/cp'
./bin/date: Can't create 'bin/date'
./bin/dd: Can't create 'bin/dd'
./bin/df: Can't create 'bin/df'
 
Code:
FreeBSD

    git (devel/git), mkisofs (sysutils/cdrtools), opkg-cl (archivers/opkg)
    linux64 module loaded for opkg chroot
 
Yes, I see https://github.com/mmatuska/mfslinux/blob/master/BUILD.md mentions

FreeBSD​

  • git (devel/git), mkisofs (sysutils/cdrtools), opkg-cl (archivers/opkg)
  • linux64 module loaded for opkg chroot

Creating an image​

Simply run make on Linux or gmake on FreeBSD

... but I'm not sure what this means....

Am I supposed to pkg install-y git mkiisofs opkg-cl linux64 ?

I guess not because I've tried.

Looking at the Makefile, I don't see any of the targets such as bin/ash, bin/cat etc.

How do I find out why the system can't create 'bin/ash'? What is it looking for? I ran gmake VERBOSE=1 but don't see any hints. I see a lot of Can't restore time' but don't know what that refers to.
 
What is the linux64 module and how do I load it for opkg root?

BTW I noticed that I needed to install opkg-openwrt to get hold of opkg-cl...
 
errors are probably output of tar or cpio archive extraction
why it fails i don't know, probably permissions or readonly fs
 
errors are probably output of tar or cpio archive extraction
why it fails i don't know, probably permissions or readonly fs
If I run tar tf tar-archive I can see the files listed, but can't managed to extract them. Even tried gtar but that made no difference.
 
Using archivers/star I get:
Code:
star: Operation not supported. Cannot create symbolic link './usr/sbin/ntpd' to '../../bin/busybox'.
star: Operation not supported. Cannot create symbolic link './var' to 'tmp'.
star: Operation not supported. Cannot create symbolic link './www/cgi-bin/cgi-backup' to '../../usr/libexec/cgi-io'.
star: Operation not supported. Cannot create symbolic link './www/cgi-bin/cgi-download' to '../../usr/libexec/cgi-io'.
star: Operation not supported. Cannot create symbolic link './www/cgi-bin/cgi-exec' to '../../usr/libexec/cgi-io'.
star: Operation not supported. Cannot create symbolic link './www/cgi-bin/cgi-upload' to '../../usr/libexec/cgi-io'.
star: Operation not supported. Cannot create symbolic link './www/luci-static/bootstrap-dark' to 'bootstrap'.
star: Operation not supported. Cannot create symbolic link './www/luci-static/bootstrap-light' to 'bootstrap'.
star: 1047 blocks + 0 bytes (total of 10721280 bytes = 10470.00k).
star: The following problems occurred during archive processing:
star: Cannot: stat 0, open 192, read/write 0, chdir 0, iconv 0.
star: Size changed 0.
star: Missing links 0, Name too long 0, File too big 0, Not dumped 0.
star: Skipped for security reason: path name 0, link name 14.
star: See option -secure-links on why some links have been skipped.
star: Processed all possible files, despite earlier errors.
Any ideas on how to overcome this?
 
it extracts without any problem on a 13.1-R box
i just downloaded the Makefile and
gmake download_rootfs_tar extract_rootfs_tar
and it works
it creates the tree under $cwd/work
 
it extracts without any problem on a 13.1-R box
i just downloaded the Makefile and
gmake download_rootfs_tar extract_rootfs_tar
and it works
it creates the tree under $cwd/work
It's good to know that someone has it working.
 
it extracts without any problem on a 13.1-R box
i just downloaded the Makefile and
gmake download_rootfs_tar extract_rootfs_tar
and it works
it creates the tree under $cwd/work
Since you said you have it working, could you tell me if you needed to do anything special to achieve that.

I have now overcome the earlier problem by installing a pristine 13.1-R system and have created a jail in which to build mfslinux in an isolated environment. The only pkgs I've installed are devel/git and devel/gmake and have achieved favourable results, but the build fails with this error:-

Script started on Thu Nov 10 01:36:21 2022
Command: gmake
Removing packages
env: --chroot: No such file or directory
gmake: *** [Makefile:152: /mnt/projects/mfslinux/workdir/mfslinux/work/.remove_packages_done] Error 127

Command exit status: 2
Script done on Thu Nov 10 01:36:21 2022
Any idea about what is missing from the environment? I notice that linux64 is not loaded. Is it required?
 
Since you said you have it working, could you tell me if you needed to do anything special to achieve that.

I have now overcome the earlier problem by installing a pristine 13.1-R system and have created a jail in which to build mfslinux in an isolated environment. The only pkgs I've installed are devel/git and devel/gmake and have achieved favourable results, but the build fails with this error:-


Any idea about what is missing from the environment? I notice that linux64 is not loaded. Is it required?
i did not test it properly, just the fetch / extract part of it
in fact i only downloaded the Makefile from github, had a look at the targets and made
gmake download_rootfs_tar extract_rootfs_tar
it displayed some errors that the working directory is not a git repository but it still fetched / extracted the tar.gs file
 
i did not test it properly, just the fetch / extract part of it
in fact i only downloaded the Makefile from github, had a look at the targets and made
gmake download_rootfs_tar extract_rootfs_tar
it displayed some errors that the working directory is not a git repository but it still fetched / extracted the tar.gs file
Yes I got that bit to work. No idea why the extract didn't work before but it does now under 13.1-R.

Did you run gmake with the provided Makefile? Did it run to the end without errors?
 
It looks like I can't kldload linux64 in a jail. Does that sound right?
Yes, that's right. Load it on the host system.

Furthermore
have created a jail in which to build mfslinux in an isolated environment. The only pkgs I've installed are devel/git and devel/gmake
The mfslinux BUILD.md clearly states:

Requirements​

FreeBSD​

  • git (devel/git), mkisofs (sysutils/cdrtools), opkg-cl (archivers/opkg)
  • linux64 module loaded for opkg chroot

Also, it's not necessary to build in a isolated environment (jail), a temporary directory will do.
 
Yes, that's right. Load it on the host system.

Furthermore

The mfslinux BUILD.md clearly states:


Also, it's not necessary to build in a isolated environment (jail), a temporary directory will do.

I only installed devel/git and devel/gmake to see how far things went.
I have now added sysutils/cdrtools and archivers/opkg-openwrt.
Note - error in docs.

This time things proceed much further and only stops with this:-

Downloading: base/libreadline8_8.1-1_x86_64.ipk
Downloading: base/zlib_1.2.11-4_x86_64.ipk
fetch: http://downloads.openwrt.org/releases/21.02.2/packages/x86_64//base/zlib_1.2.11-4_x86_64.ipk: Not Found
gmake: *** [Makefile:162: download_packages] Error 1

Command exit status: 2
Script done on Thu Nov 10 10:27:33 2022

This looks like an extra '/' has been substituted somewhere in the Makefile... Not sure exactly where yet..
 
This looks like an extra '/' has been substituted somewhere in the Makefile...
The extra " / " can be ignored.

The real cause is zlib_1.2.11-4_x86_64.ipk does not exist in https://downloads.openwrt.org/releases/21.02.2/packages/x86_64/base/

Try copy config/default/openwrt_packages_add to config/ and edit openwrt_packages_add base/zlib_1.2.11-4_x86_64.ipk to zlib_1.2.11-6_x86_64.ipk (or edit directly the config/default/openwrt_packages_add file).

mfslinux build instructions​

Configuration​


Read hints in the default configuration files in the config/default directory. You may copy these files to the config directory and make modifications to suit your needs.
 
Thanks to your suggestion I added the missing file and continued to build, but there were over a dozen such changes to be made. I was wondering if there was some way to generate a list of the packages from the generic name rather than the specific version.

After all this effort, I now have my own version which will PXE boot, but what I'm specifically lacking is a driver for my NIC.

How would I add that?
 
I added the missing file and continued to build, but there were over a dozen such changes to be made. I was wondering if there was some way to generate a list of the packages from the generic name rather than the specific version.
Apparently not, otherwise the mfslinux project author would have taken it into count.

what I'm specifically lacking is a driver for my NIC.

How would I add that?
Investigate the NICs controller chip and which driver it needs, check OpenWrt kmod packages if there is a package available . I recognize for example kmod-igb_5.4.179-1_x86_64.ipk for Intel gigabit ethernet adapters (igb(4)).

If there is a package which could be appropriate for the NIC, add it to file config/default/openwrt_target_packages_add, rebuild mfslinux. If you are unsure ask in OpenWrt forums.
 
Apparently not, otherwise the mfslinux project author would have taken it into count.

After looking around the openwrt site it looks like I should be able to come up with something based on the following instructions:-


It will probably take me a while to extract the correct filenames, but I'll just make a note here for myself for some task to do in the future...
 
Back
Top