# I'm trying to install FreeBSD on a Linksys NSLU2



## rusma (Jul 31, 2009)

Hi, 

I'm trying to install FreeBSD on a Linksys NSLU2, and hopefully in the end being able to boot it from a usbstick. I am not very skilled in FreeBSD. At least it seems this man have gotten things to work to some extent. I've briefly read his article on slimming down the kernelconfig-file. This is how far I've come

I downloaded his slimmed down kernelconfig file named 'NSLU2'. I placed it in some directory on another amd64 machine I own and symlinked it to /usr/src, then from /usr/src I ran 'make buildkernel KERNCONF=NSLU2', as it says in the handbook. But I got an error saying it cannot find the configfil named 'NSLU2'. What to do now?


----------



## aragon (Aug 1, 2009)

The config needs to go in /usr/src/sys/arm/conf.


----------



## rusma (Aug 1, 2009)

aragon said:
			
		

> The config needs to go in /usr/src/sys/arm/conf.



I still got these error messages (the same ones as before): 


```
[root@one /usr/src/sys/arm/conf]# make buildkernel KERNCONF=NSLU2
make: don't know how to make buildkernel. Stop
[root@stack /usr/src/sys/arm/conf]# cd /usr/src
[root@stack /usr/src]# make buildkernel KERNCONF=NSLU2
ERROR: Missing kernel configuration file(s) (NSLU2).
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
[root@one /usr/src]#
```


----------



## DutchDaemon (Aug 1, 2009)

If you need to build a kernel for a different platform (i.e. cross-compile), you'll have to specify that platform. Try adding TARGET=arm to that make command. I have no idea whether 'arm' is the correct platform, but I'm sure aragon does.


----------



## aragon (Aug 1, 2009)

I haven't played with any arm stuff personally, but the page rusma linked to does mention the cross-compiling bits:


```
setenv TARGET arm
setenv MAKEOBJDIRPREFIX /tmp/$USER/obj
setenv TARGET_BIG_ENDIAN t
setenv TARGET_CPU_TYPE xscale
```

rusma, those environment variables are important.  They tell FreeBSD's build system to compile everything for the arm architecture.  Without them the build system will compile for your native architecture.


----------



## rusma (Aug 2, 2009)

aragon said:
			
		

> I haven't played with any arm stuff personally, but the page rusma linked to does mention the cross-compiling bits:
> 
> 
> ```
> ...



My native architecture is amd64. Is it not enough how do I add these are they not specified already in the configfile?


----------



## rusma (Aug 29, 2009)

Ok, 
Now I've tried out those enviroment variables under bash shell: 


```
[root@freebsdvbox ~]# cd /usr/src/
[root@freebsdvbox /usr/src]# export TARGET=arm
[root@freebsdvbox /usr/src]# export MAKEOBJDIRPREFIX=/tmp/$USER/obj
[root@freebsdvbox /usr/src]# export TARGET_BIG_ENDIAN=t
[root@freebsdvbox /usr/src]# export TARGET_CPU_TYPE=xscale
[root@freebsdvbox /usr/src]# make KERNCONF=NSLU buildkernel

--------------------------------------------------------------
>>> Kernel build for NSLU started on Sat Aug 29 13:15:35 CEST 2009
--------------------------------------------------------------
===> NSLU
mkdir -p /tmp/root/obj/arm/usr/src/sys

--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/arm/conf;  PATH=/tmp/root/obj/arm/usr/src/tmp/legacy/usr/sbin:/tmp/root/obj/arm/usr/src/tmp/legacy/usr/bin:/tmp/root/obj/arm
/usr/src/tmp/legacy/usr/games:/tmp/root/obj/arm/usr/src/tmp/usr/sbin:/tmp/root/obj/arm/usr/src/tmp/usr/bin:/tmp/root/obj/arm/usr/src/tmp
/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  config  -d /tmp/root/obj/arm/usr/src/sys/NSLU  /usr/src/sys/arm/conf/NSLU
WARNING: duplicate option `PHYSADDR' encountered.
WARNING: duplicate option `KERNPHYSADDR' encountered.
WARNING: duplicate option `KERNVIRTADDR' encountered.
WARNING: duplicate option `FLASHADDR' encountered.
WARNING: duplicate option `LOADERRAMADDR' encountered.
WARNING: duplicate option `STARTUP_PAGETABLE_ADDR' encountered.
WARNING: duplicate option `DEV_MEM' encountered.
WARNING: duplicate device `mem' encountered.
cpu type must be specified
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
[root@freebsdvbox /usr/src]#
```
The source is the latest FREEBSD-CURRENT, updated today. What more enviroment variables have to be specified?


----------



## aragon (Aug 29, 2009)

Not sure, but the errors you've pasted looked like they're caused by errors in the kernel config.  Try fix those first.


----------



## rusma (Dec 1, 2009)

I use bash, not tcsh, so setenv becomes export, and = is used instead of space. 

So I "exported" each: 

```
export TARGET=arm
export MAKEOBJDIRPREFIX=/tmp/$USER/obj
export TARGET_BIG_ENDIAN=t
export TARGET_CPU_TYPE=xscale
```

But, still got error before the kernel started building itself. Should I post them too?


----------



## LateNiteTV (Dec 1, 2009)

post your errors and kernel config too.


----------



## rusma (Dec 3, 2009)

LateNiteTV said:
			
		

> post your errors and kernel config too.



NSLU2.txt: standard NSLU2-config from /usr/src/sys/arm/conf/ (aka. the kernel config) 
nslu2error.txt: output from build (both standrad error and standard output)


----------

