# how to create minimal root file system



## ashwin_karanth (Jul 16, 2010)

hi all..
    I am using below steps to create freebsd image, and i ported on s3c2410 board , but in this there is no root file system,how can i create minimal root file system now, using buildworld i can create root file system but it is of arround 200Mb, it's no use for me 
 currently i installed freebsd 9


```
make kernel-toolchain TARGET=arm
  make buildkernel TARGET=arm KERNCONF=LN2410SBC DESTDIR=/root/kernel installkernel
  mkimage -A arm -O freebsd -T kernel -C none -a 30008000 -e 300080e0 -n "FreeBSD" -d kernel kernel.boot
```

 the last step i am using linux


----------



## aragon (Jul 16, 2010)

Are you using src.conf(5)?

Are you selectively installing kernel modules?

You might want to look at NanoBSD.  It's i386 only, but the script should give you ideas on how to setup your build, or you could modify it for an Arm build.


----------



## ashwin_karanth (Jul 16, 2010)

ya i am created src.conf , but while building i am getting error buddy, i tried with nanobsd i am getting a root file size of around 300Mb, i got only 64Mb Dram in my board, can you help me out to create minimal root file system,


----------



## ashwin_karanth (Jul 16, 2010)

*creating root file system*

hi all..
I am using below steps to create freebsd image, and i ported on s3c2410 board , but in this there is no root file system,how can i create minimal root file system now, using buildworld i can create root file system but it is of arround 200Mb, it's no use for me
currently i installed freebsd 9


```
make kernel-toolchain TARGET=arm
  make buildkernel TARGET=arm KERNCONF=LN2410SBC DESTDIR=/root/kernel installkernel
  mkimage -A arm -O freebsd -T kernel -C none -a 30008000 -e 300080e0 -n "FreeBSD" -d kernel kernel.boot
```


----------



## ashwin_karanth (Jul 16, 2010)

i used src.conf, and i am using buildworld for make, i am getting error code as 2
what might be the reason.....?


----------



## DutchDaemon (Jul 16, 2010)

Do *not* double-post, please. Threads merged.


----------



## aragon (Jul 16, 2010)

A lot can be removed from the build via src.conf, and even more that can be removed before doing installworld.  Here's a src.conf that I use:


```
WITHOUT_ACCT=			true
WITHOUT_ACPI=			true
WITHOUT_AMD=			true
WITHOUT_APM=			true
WITHOUT_AT=			true
WITHOUT_ATM=			true
WITHOUT_AUDIT=			true
#WITHOUT_BIND=			true
WITHOUT_BIND_DNSSEC=		true
WITHOUT_BIND_ETC=		true
WITHOUT_BIND_MTREE=		true
WITHOUT_BIND_NAMED=		true
WITHOUT_BLUETOOTH=		true
WITHOUT_CALENDAR=		true
WITHOUT_CDDL=			true
WITHOUT_CPP=			true
WITHOUT_CTM=			true
WITHOUT_CVS=			true
WITHOUT_DICT=			true
WITHOUT_EXAMPLES=		true
WITHOUT_FREEBSD_UPDATE=		true
WITHOUT_GAMES=			true
WITHOUT_GCOV=			true
WITHOUT_GDB=			true
WITHOUT_GPIB=			true
WITHOUT_GSSAPI=		true
WITHOUT_HTML=			true
WITHOUT_I4B=			true
WITH_IDEA=			true
WITHOUT_IPFILTER=		true
WITHOUT_IPX=			true
WITHOUT_IPX_SUPPORT=		true
WITHOUT_JAIL=			true
WITHOUT_KERBEROS=		true
WITHOUT_KERBEROS_SUPPORT=	true
WITHOUT_LEGACY_CONSOLE=		true
WITHOUT_LPR=			true
WITHOUT_MAKE=			true
WITHOUT_NCP=			true
WITHOUT_NDIS=			true
WITHOUT_NIS=			true
WITHOUT_OBJC=			true
WITHOUT_PMC=			true
WITHOUT_PORTSNAP=		true
WITHOUT_PROFILE=		true
WITHOUT_QUOTAS=			true
WITHOUT_RCMDS=			true
WITHOUT_RCS=			true
WITHOUT_RESCUE=		true
WITHOUT_ROUTED=		true
WITHOUT_SENDMAIL=		true
WITHOUT_SHAREDOCS=		true
WITHOUT_SYSCONS=		true
WITHOUT_SYSINSTALL=		true
WITHOUT_ZFS=			true
```

For installworld you can add these to the above:


```
WITHOUT_INSTALLLIB=		true
WITHOUT_TOOLCHAIN=		true
```

That should make your image less than 100MB.  On my i386 build it comes to about 64 MB.

If you need it a lot smaller than that things get complicated.  Flash is cheap - get more.


----------



## ashwin_karanth (Jul 17, 2010)

K thanks a lot i will try it out


----------



## ashwin_karanth (Jul 17, 2010)

hi i included this things /etc/src.conf while building using

`make -j4 buildworld TARGET=arm TARGET_ARCH=arm TARGET_CPUTYPE=arm920t`
i am getting error like..


```
echo tblgen:/usr/lib/libstdc++.a>>.depend
make:don't know how to make /usr/obj/arm.arm/usr/home/user/project/head/tmp/legacy/usr/lib/libegacy.a.stop
***error code 2
1 error
***error code 2
1 error
***error code2
1 error
```

i am doing make from the checkout, can any one help me out to solve this problem.


```
WITHOUT_ACCT=true
WITHOUT_ACPI=true
WITHOUT_AMD=true
WITHOUT_APM=true
WITHOUT_AT=true
WITHOUT_ATM=true
WITHOUT_AUDIT=true
#WITHOUT_AUTHPF=true
#WITHOUT_BIND=true
WITHOUT_BIND_DNSSEC=true
WITHOUT_BIND_ETC=true
#WITHOUT_BIND_LIBS_LWRES=true
WITHOUT_BIND_NAMED=true
WITHOUT_BIND_UTILS=true
WITHOUT_BLUETOOTH=true
#WITHOUT_BOOT=true
#WITHOUT_BSD_CPIO=true
#WITHOUT_BSNMP=true
WITHOUT_BZIP2=true
WITHOUT_BZIP2_SUPPORT=true
WITHOUT_CALENDAR=true
WITHOUT_CDDL=true
WITHOUT_CRYPT=true
WITHOUT_CTM=true
WITHOUT_CVS=true
WITHOUT_CXX=true
WITHOUT_DICT=true
WITHOUT_EXAMPLES=true
WITHOUT_FLOPPY=true
WITHOUT_FORTH=true
WITHOUT_FREEBSD_UPDATE=true
WITHOUT_GAMES=true
WITHOUT_GCOV=true
WITHOUT_GDB=true
WITHOUT_GNU=true
WITHOUT_GNU_GREP=true
WITHOUT_GNU_SUPPORT=true
WITHOUT_GPIB=true
WITHOUT_GROFF=true
WITHOUT_GSSAPI=true
WITHOUT_HTML=true
WITHOUT_INET6=true
WITHOUT_INET6_SUPPORT=true
WITHOUT_INFO=true
WITHOUT_INSTALLLIB=true
WITHOUT_IPFW=true
WITHOUT_IPX=true
WITHOUT_IPX_SUPPORT=true
WITHOUT_JAIL=true
WITHOUT_KERBEROS=true
WITHOUT_KERBEROS_SUPPORT=true
WITHOUT_KVM_SUPPORT=true
#WITHOUT_LIB32=true
#WITHOUT_LIBTHREAD=true
WITHOUT_LOCALES=true
WITHOUT_LOCATE=true
WITHOUT_LPR=true
WITHOUT_MAIL=true
WITHOUT_MAILWRAPPER=true
#WITHOUT_MAKE=true
WITHOUT_MAN=true
WITHOUT_NCP=true
WITHOUT_NDIS=true
WITHOUT_NETGRAPH=true
WITHOUT_NIS=true
WITHOUT_NLS=true
WITHOUT_NLS_CATALOGS=true
WITHOUR_NS_CACHING=true
WITHOUT_NTP=true
WITHOUT_OBJC=true
WITHOUT_OPENSSH=true
WITHOUT_OPENSSL=true
WITHOUT_PAM=true
WITHOUT_PAM_SUPPORT=true
WITHOUT_PF=true
WITHOUT_PKGTOOLS=true
WITHOUT_PMC=true
WITHOUT_PORTSNAP=true
WITHOUT_PPP=true
WITHOUT_PROFILE=true
WITHOUT_QUOTAS=true
WITHOUT_RCMDS=true
WITHOUT_RCS=true
WITHOUT_RESCUE=true
WITHOUT_ROUTED=true
WITHOUT_SENDMAIL=true
WITHOUT_SETUID_LOGIN=true
WITHOUT_SHAREDOCS=true
WITHOUT_SSP=true
WITHOUT_SYMVER=true
WITHOUT_SYSCONS=true
WITHOUT_SYSINSTALL=true
WITHOUT_TCSH=true
WITHOUT_TELNET=true
WITHOUT_TEXTPROC=true
WITHOUT_WIRELESS=true
WITHOUT_WIRELESS_SUPPORT=true
WITHOUT_WPA_SUPPLICANT_EAPOL=true
WITHOUT_ZONEINFO=true
```


----------



## aragon (Jul 17, 2010)

Try remove WITHOUT_INSTALLLIB.


----------



## ashwin_karanth (Jul 17, 2010)

hi that error went out.. getting new error :-(


```
/usr/obj/arm.arm/usr/home/user/project/head/tmp/usr/bin/ld: libc.so.7:undefined version symbol name fts_open@FBSD_1.0

/usr/obj/arm.arm/usr/home/user/project/head/tmp/usr/bin/ld:failed to set dynamic section sizes:bad value

***Error code 1
ranlib libc.a
1 error
***Error code2
1 error
***Error code 2
1 error
***Error code 2
1 error
***Error code 2
1 error
```


----------



## aragon (Jul 17, 2010)

Remove WITHOUT_SYMVER


----------



## ashwin_karanth (Jul 17, 2010)

sorry for disturbing you again..

i am getting some other error i tried to enabel some options but that is not working, i am writing few lines of the errors, the error is


```
/gnu/usr.bin/sort/../../../contrib/gnu-sort/lib -std=gnu99 -o sort sort.o __fpending.o argmatch.o closeout.o dup-safer.o error.o exitfail.o 
fopen-safer.o hard-locale.o human.o long-options.o memcoll.o physmem.o posixver.o quote.o quotearg.o strnlen.o version-etc.o xalloc-die.o 
xmalloc.o xmemcoll.o xstrtoul.o strnlen.o umaxtostr.o version-etc.o xalloc-die.o xmalloc.o xmemcoll.o xstrtoul.o xstrtoumax.o
1 error
***Error code 2
1 error
***Error code2
1 error
```


----------



## DutchDaemon (Jul 17, 2010)

ashwin_karanth, your posts are a mess, please use the proper posting tags for system output and commands:
Posting and Editing in the FreeBSD Forums


----------



## ashwin_karanth (Jul 17, 2010)

this is the output which i got, so i posted it, i thought some one can understand properly the error....


----------



## DutchDaemon (Jul 17, 2010)

Just post output in [code] .. output .. [/code] and it'll be much more readable.


----------



## aragon (Jul 18, 2010)

Try remove one or all of:


```
WITHOUT_GNU
WITHOUT_GNU_GREP
WITHOUT_GNU_SUPPORT
```


----------



## ashwin_karanth (Jul 18, 2010)

hi all errors went out..but while doing below step i am getting error message like MFS Image too large, i set MD_ROOT_SIZE 59392 #59Mb 


```
make buildkernel TARGET=arm KERNCONF=LN2410SBC DESTDIR=/root/kernel
installkernel -DNO_MODULES MFS_IMAGE=/usr/home/user/path/to/root.ufs
```


----------



## aragon (Jul 18, 2010)

It would be helpful to create a larger MFS image to see how much over your limit you are.

You need to create another src.conf for installworld as I suggested in post #7.  You can remove more components from installworld, especially TOOLCHAIN and INSTALLLIB.


----------



## ashwin_karanth (Jul 19, 2010)

hi root file system size may  less than the size specified in the LN2410SBC rite..? will it affect while mounting file system on the board...?


----------



## ashwin_karanth (Jul 19, 2010)

hi..
  In LN2410SBC i have given the size of MD_ROOTSIZE = 15MB, i am getting this error after mounting into board..i created root file system and kernel in one image, i have pasted only error part of the output


```
Root mount waiting for: usbus0
uhub0: 2 ports with 2 removable, self powered
Trying to mount root from ufs:/dev/md0
ROOT MOUNT ERROR: 
If you have invalid mount options, reboot, and first try the following from
the loader prompt:

     set vfs.root.mountfrom.options=rw

and then remove invalid mount options from /etc/fstab.

Trying to mount root from ufs:da0s1
ROOT MOUNT ERROR: 
If you have invalid mount options, reboot, and first try the following from
the loader prompt:

     set vfs.root.mountfrom.options=rw

and then remove invalid mount options from /etc/fstab.
```
Loader variables:

```
vfs.root.mountfrom=
vfs.root.mountfrom.options=
```


```
Manual root filesystem specification:
  <fstype>:<device>  Mount <device> using filesystem <fstype>
                       eg. zfs:tank
                       eg. ufs:/dev/da0s1a
                       eg. cd9660:/dev/acd0
                       This is equivalent to: mount -t cd9660 /dev/acd0 /

  ?                  List valid disk boot devices
  <empty line>       Abort manual input

mountroot>
```


----------



## aragon (Jul 19, 2010)

I'm not familiar with an LN2410SBC or any Arm hardware for that matter...


----------

