Guide: How to Build FreeNAS (Part 2: Install and Build FreeNAS)

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#61
To All:

This thread gives you the basics on how to build a generic version of FreeNAS, not how to hack away. Please post any hacking or altering of the FreeNAS code in an appropriate thread so someone can give you some advice.

@vaibhavyagnik:
The information is buried in the thread you pointed to. If it's not obvious to you then post your question there.
 
Joined
Aug 26, 2011
Messages
38
Thanks
1
#62
@joeschmuck, i am sorry if i have offended you in some way. I meant no disrespect to you or the developers of freenas.
So if i understand the process correctly,
1. We add the packages for creating iso, etc.
2. we create a directory named freenas on the volume.
3. Next we download source of freenas from souceforge.
4. Next we download supporting files for compiling (???? am i correct??) freenas from cvsup server.
5. we compile freenas
6. we create a iso of compiled freenas

From the process what i have learned is, correct me if i am wrong,
a. We can build err....sort of nightlies from source
b. if i need to inject some specific drivers or packages i can do that

P.S: i am not clear with terminology as applicable to freebsd, i.e what is a package, patch, trunk, not very clear what a cvsup is etc. any body throwing some light on these basics would be highly appreciated
 

ProtoSD

FreeNAS Guru
Joined
Jul 1, 2011
Messages
3,353
Thanks
15
#63
P.S: i am not clear with terminology as applicable to freebsd, i.e what is a package, patch, trunk, not very clear what a cvsup is etc. any body throwing some light on these basics would be highly appreciated
Package = usually a pre-compiled binary app with it's related files/libraries etc. that is added using pkg_add to an already functioning system, but in the context of building they are usually "ports" which is the source for a "package", like bit torrent etc.
Patch = a file containing one or more changes to be applied to the source code before compiling
Trunk = The main set of source code being developed (Like 8.1, 8.2)
Branch = A diversion from the Trunk with some differences or set of features (like 8.03, 8.04)
cvsup = A method to check for changes to the source that you are building from and download the latest changes

Since this is more of an advanced topic, I think @joeschmuck was hinting that considering the questions you're asking you probably need to do some research elsewhere before coming here with such basic questions.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#65
My comment was meant to have people ask questions about adding extra stuff in the other threads where they would be more applicable. I was being sincere about posting in the other thread you had pointed to if you needed additional help as that was the more appropriate place to do so and for you to get reasonable help and I was in no way offended.

I was hoping to keep this thread in particular pointed in simply compiling the source code but if it should start to include how to add patches, I can live with that but my personal thought is to create a new How-To thread on adding patches or drivers, etc...

I hope you're able to pull off what you want. One piece of advice, when you're trying to alter the product, make sure you build a clean version and it works. Don't change the version number you're using, stick with it to minimize pulling in something that causes a problem (happens all the time). This really matters if you're building the trunk code as one minute it looks line, the next 2 days it won't build at all for example.

Good Luck
 
Joined
Apr 24, 2012
Messages
9
Thanks
0
#66
Hello.
I have setup Home NAS and FreeNAS is my choise.
I install 8.2.0 beta3 on flash. Configure and everithing works. But...
I have intergated wifi module by Atheros. And i want setup bridge on my NAS.
I compile the new FreeNAS (thanks to joeschmuck) - current version is 8.2.1 Alpha.
I have tested new FreeNAS by load from CDROM - i see ath0 which was not.
And my question is - how to load new kernel?
How to replace kernel on USB Flash?
Or How to add new kernel to USB and load one kernel or other (for rescue)?

Thanks.
 
Joined
Apr 24, 2012
Messages
9
Thanks
0
#67
Ok.
I have install new kernel. Its load ok and work.
Now i want setup my wifi module.
I edit /etc/rc.conf. But when i reboot the machine rc.conf is overwritten and my lines removed from it.
How to add my lines to rc.conf?

And one more question:
When i configure wifi module i need wpa_supplicant that not included in freenas.
How to compile wpa_supplicant when build FreeNAS?
Thanks.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#68
Edit /conf/base/etc/rc.conf, it is what's restored after a reboot.
 
Joined
Apr 24, 2012
Messages
9
Thanks
0
#69
Thanks.

One more quiestion: "sh build/create_iso.sh" got error

--cut--
xz: /usr/local/freenas/trunk/os-base/amd64/FreeNAS-8.2.1-ALPHA-r11456M-x64.img.xz: Input file has more than one hard link, skipping
create_iso.sh: ERROR: Image file (/usr/local/freenas/trunk/os-base/amd64/FreeNAS-8.2.1-ALPHA-r11456M-x64.img.xz) is invalid/empty
--cut--
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#70
Thanks.

One more quiestion: "sh build/create_iso.sh" got error

--cut--
xz: /usr/local/freenas/trunk/os-base/amd64/FreeNAS-8.2.1-ALPHA-r11456M-x64.img.xz: Input file has more than one hard link, skipping
create_iso.sh: ERROR: Image file (/usr/local/freenas/trunk/os-base/amd64/FreeNAS-8.2.1-ALPHA-r11456M-x64.img.xz) is invalid/empty
--cut--
This is one of many typical error messages that you may see when trying to compile. It is almost 99% the fault of the FreeNAS build scripts as someone will make a change but it fails to compile after that.

I'd give it a few days and try to compile again. There were times I had to wait over a week. If you feel you are waiting too long or have spotted a definite problem in the code then I would suggest you post that into one of the threads specifically dealing with the version you are building and/or fill out a trouble ticket indicating the problem. The way to identify what caused the change is to look back at all the changes since the last time you built it or find a previous build that worked and start looking through the code for issues or the hard way which does work, start building until it works again and then isolate the problem. It can take a lot of time locating what caused the failure.

Good Luck,
 
Joined
Apr 15, 2012
Messages
5
Thanks
0
#71
I'm attempting to build a vanilla FreeNAS 8.2 build and ran into the following error:
Code:
VirtualBSD# svn co https://freenas.svn.sourceforge.net/svnroot/freenas/trunk
Checked out revision 12073.
VirtualBSD# cd trunk/
VirtualBSD# setenv FREEBSD_CVSUP_HOST cvsup10.freebsd.org
VirtualBSD# sh build/do_build.sh 
[: amd64: unexpected operator
Possible values for FREENAS_ARCH are amd64 or i386


I've tried this to resolve, but with no change in error message:
Code:
setenv FREENAS_ARCH amd64


Any ideas?
 
Joined
Apr 15, 2012
Messages
5
Thanks
0
#73
Thanks for the reply, but still no joy. It looks like one of the scripts is reading a bracket instead of or appended to the actual architecture, but so far I've been unable to grep its location.
Code:
VirtualBSD# env FREENAS_ARCH=amd64 sh build/do_build.sh
[: amd64: unexpected operator
Possible values for FREENAS_ARCH are amd64 or i386
 

ProtoSD

FreeNAS Guru
Joined
Jul 1, 2011
Messages
3,353
Thanks
15
#74
Sometimes there are bugs in the scripts, I couldn't build trunk the last time I tried either (recently). There was a different error for me. Try grabbing the source again.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#75
I'm attempting to build a vanilla FreeNAS 8.2 build and ran into the following error:
Code:
VirtualBSD# svn co https://freenas.svn.sourceforge.net/svnroot/freenas/trunk
Checked out revision 12073.
VirtualBSD# cd trunk/
VirtualBSD# setenv FREEBSD_CVSUP_HOST cvsup10.freebsd.org
VirtualBSD# sh build/do_build.sh 
[: amd64: unexpected operator
Possible values for FREENAS_ARCH are amd64 or i386


I've tried this to resolve, but with no change in error message:
Code:
setenv FREENAS_ARCH amd64


Any ideas?
Based on your posting there is something wrong with the script just as Protosd said. Unless the default build has change, the default is always the amd64 bit version so no parameters should be required.

You have two actions you can take: 1) Keep trying newer versions each day until the script finally works (painfully slow if a fix was introduced that you want to try). 2) Submit a trouble ticket specifying your error and it might be fixed quickly.

This type of problem that you had occurs each and every day wit this active ever changing project.

-Mark
 
Joined
Apr 15, 2012
Messages
5
Thanks
0
#76
Thank you for the help, I just checked out the latest version and it still has the new undocumented feature. My goal is to start building FreeNAS with additional packages I want included, so for now I'm really only interested in the latest official release. It looks like 8.2.0-RELEASE corresponds to revision 11944, so I downloaded using the following command:
Code:
svn co https://freenas.svn.sourceforge.net/svnroot/freenas/trunk@11944

It seems to be building just fine now.
 
Joined
Aug 26, 2011
Messages
38
Thanks
1
#77
hello joe,
I have been reading your Guide part 1 and part 2 over and over again and trying to figure out what each step does. I now a basic understanding of the process. However i would like to have some pointers regarding the following:
1. The source code is fetched from https://freenas.svn.sourceforge.net/svnroot/freenas/trunk/, however i see that LCDproc is present under https://freenas.svn.sourceforge.net/svnroot/freenas/experimental/lcdproc/. How do i add it to compilation?
2. I am on a limited broadband connection. (2.5GB for 1 month). Any rough idea how much source code gets downloaded?
3. I think i will build a localcvsup server on the same freeBSD virtual machine. How is this procedure for reference? http://adminhowtos.com/index.php?topic=16.0
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
8,091
Thanks
1,587
#78
To answer your questions:
1) I haven't built FreeNAS in a while so I don't know how to add the lcdproc and it generally takes a great understanding of the source code. Please keep in mind that I am a novice when it comes to FreeBSD/NanoBSD and anything Lunix like.
2) I can't tell you how much but it's a lot if you have to download the entire set of data again. A local CVSUP is the right idea although it does download all the FreeBSD source code for all FreeBSD projects so that is a lot of data as well. Once it has downloaded the data then it will continually download any updates periodically. The other code which gets downloaded is the source code for the FreeNAS project itself. This is not very big at all, a few MB maybe (I haven't measured it).
3) That looks like a good reference. I know I had a How-To to make a CVSUP here on the forum. Since I created mine as a separate VM machine, it had it's own IP address. If you create it on the same VM machine you are compiling on I don't know how you point to the local CVSUP during the build process, maybe point to your own IP address? It's just something that I haven't tried, having the CVSUP on the same machine as I like to keep things separate. The reason for that is I can revert my VM to a previous time and I did frequently revert my building VM but didn't want to revert my CVSUP VM and have to download all the updates again.

When I started in FreeNAS it was so very basic and just started. Nightly builds didn't exist so if you wanted to test out the latest changes or even make your own (needed for troubleshooting problems) you had to do it yourself so I created a build platform myself and donated many comments and hopefully useful inputs to the programmers. I was very interested in the project back then and things were moving slow. Now that FreeNAS has matured to something that I can now consider stable, I have stopped building it as the changes I see are just enhancements of a currently working system. Version 8.0.4-Multimedia was my stopping point. Now I'm off on to MiniDLNA support because I use it allot and I don't see anyone working the issues with that software.

I hope you are able to get everything to work properly and if you see anything that needs to change in the guide, please let me know and I will make them. Like I said, I haven't compiled anything in a long time.
 

cyberjock

Moderator
Moderator
Joined
Mar 25, 2012
Messages
19,156
Thanks
1,835
#80
Can someone tell me what I'm doing wrong? Followed the guide and did the trunk download. It says "Checked out revision 12714" but the latest 8.3.1 Alpha is 12910. How do I check out the absolutel latest stuff?
 
Top