# FreeBSD on Raspberry Pi - Getting the source



## rpi-user (Jan 7, 2015)

Hello,

I recently downloaded the FreeBSD 10.0-RELEASE snapshot for Raspberry Pi pointed to by the wiki.

It booted and the couple of ports I installed worked well so that is good and I am grateful to FreeBSD.

Now, I was wondering, what is the proper way to download the sources corresponding to the installed version? /usr/src/ is presently empty, you see, and there is something I'm wanting to peek at.

Here's my `uname -a` in case it helps:

```
FreeBSD raspberry-pi 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Fri Jan 31 18:40:22 UTC 2014  root@grind.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B  arm
```
Bonus question: How do I update both system and sources to latest release? I didn't realize when following the link in the wiki that it was the previous version. It's not super important to me to have the latest version, but it'd be nice still.


----------



## rpi-user (Jan 7, 2015)

I looked for src.txz at ftp://ftp.freebsd.org/pub/FreeBSD/releases/arm/armv6/ but there was only the ISO-IMAGES/ present there.

For updating (see bonus question above), I attempted `freebsd-update -r 10.1-RELEASE upgrade` but this results in:

```
Looking up update.FreeBSD.org mirrors... 5 mirrors found.
Fetching public key from update4.freebsd.org... failed.
Fetching public key from update6.freebsd.org... failed.
Fetching public key from update5.freebsd.org... failed.
Fetching public key from update2.freebsd.org... failed.
Fetching public key from update3.freebsd.org... failed.
No mirrors remaining, giving up.
```
And I don't think that it's because of a network error, look at `ping update2.freebsd.org`:

```
PING update2.freebsd.org (149.20.53.26): 56 data bytes
64 bytes from 149.20.53.26: icmp_seq=0 ttl=53 time=228.602 ms
64 bytes from 149.20.53.26: icmp_seq=1 ttl=53 time=230.121 ms
64 bytes from 149.20.53.26: icmp_seq=2 ttl=53 time=250.150 ms
^C
--- update2.freebsd.org ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 228.602/236.291/250.150/9.819 ms
```


----------



## rpi-user (Jan 7, 2015)

I am installing /usr/ports/devel/subversion/ now and going to try `svn checkout https://svn0.eu.FreeBSD.org/base/releng/10.0/ /usr/src` later.

In the meantime, I'd be very happy if someone can tell me, can I do a binary update to 10.1 or do I need to check out the 10.1 sources and build the system on the pi?


----------



## rpi-user (Jan 8, 2015)

I got some help from someone on reddit when I posted link to this there: http://www.reddit.com/r/freebsd/comments/2roecj/freebsd_on_raspberry_pi_getting_the_source_forum/

Conclusion is I don't have many files yet so I'll download the image of 10.1-RELEASE from ftp. In order to not have to recompile my ports, I'll try to install and use /usr/ports/ports-mgmt/bpkg/. After I have the new image and transfer back my backuped ports, I will download source with subversion.

_edit_ bpkg-2.1.7 gave a notice:


> This port is deprecated; you may wish to reconsider installing it:
> 
> Does not support pkgng.
> 
> It is scheduled to be removed on or after 2015-01-06.


So I guess I'll be recompiling the ports after all. It's not so many anyways, so that's ok. Just editing in case someone else stumbles over my posts via Google.


----------



## SirDice (Jan 8, 2015)

As you've already found out checking out sources works in exactly the same way as for i386/AMD64. Building ports on a Raspberry Pi is a royal PITA, you'll quickly realize the CPU doesn't pack a lot of punch. It will take forever to build anything. I'm currently testing with ports-mgmt/poudriere-devel as it's also able to build packages for ARM on my AMD64. It still takes a while to build but it's a lot faster than building on the Pi directly.


----------



## rpi-user (Jan 8, 2015)

Having downloaded the latest image and put it on my SD, i have installed the ports I had and restored my files from backup.

When attempting to `svn checkout https://svn0.eu.FreeBSD.org/base/releng/10.1/ /usr/src`, I was told that /tmp/ ran out of space. /tmp/ turned out to be configured as a 30 MB memory disk by default. Since RAM is so limited on the rpi, rather than try and increase the size of the memory disk, I edited /etc/fstab to comment out the entry for /tmp/ and rebooted, then retried the `svn checkout`. It told me to do something because it had been interupted and was locked, which I did and now the sources are downloading so it seems that soon both my questions will have been resolved.


----------



## rpi-user (Jan 8, 2015)

Now, 
	
	



```
svn: E120108: Error retrieving REPORT: The server unexpectedly closed the connection.
```
 I then had to run `svn cleanup` again but was then able to continue the checkout.

_edit_ It happened again. That's unfortunate because I was planning on going for a walk while the computer finished checking out. I fear that I may find, when I return from my walk, that it has been interrupted once again. Either way, I'm going for that walk now.


----------



## rpi-user (Jan 8, 2015)

Just before leaving for a walk, I came up with something simple that should help my checkout while I'm away (I'm using shells/bash for this, running as root, but note that I have not changed the shell of root to bash):

`false ; while [ $? -ne 0 ] ; do svn cleanup /usr/src ; svn checkout https://svn0.eu.FreeBSD.org/base/releng/10.1/ /usr/src ; done`


----------



## SirDice (Jan 8, 2015)

You may want to try without SSL. It's possible the encryption/decryption is what keeps filling /tmp.


----------



## rpi-user (Jan 8, 2015)

I meant to say that what keeps happening is that the server closes the connection. As noted, I came up with a fix for that before going for my walk and now that I am back it's working still even though connection is closed now and then.


----------



## rpi-user (Jan 8, 2015)

```
Checked out revision 276852.
```


----------



## rpi-user (Apr 11, 2015)

I went to do the same thing again after having put FreeBSD-10.1-RELEASE-arm-armv6-RPI-B.img.bz2 on a new SD card and thought I might update this thread to add that one might want to check out the stable branch. This is known to most, myself included, but I forgot that when I copy-pasted the checkout from my own post. Wasted several hours on a `make buildworld` for the wrong branch.

`svn checkout http://svn0.eu.FreeBSD.org/base/stable/10/ /usr/src`

(Above, in addition to having changed which branch I check out, I do non-SSL as suggested by SirDice but it should be noted that /tmp will still be filled if one has the default 30 MB memory file system mounted there. As before, I have therefore first commented out the /etc/fstab entry for /tmp and unmounted it.)


----------



## rpi-user (Apr 12, 2015)

The FreeBSD-10.1-RELEASE-arm-armv6-RPI-B.img.bz2 keeps crashing on me. I put the old FreeBSD-10.1-STABLE-arm-armv6-RPI-B-20141222-r276051.img.bz2 I used last time on the SD card and will update from that to svn stable.


----------



## acheron (Apr 12, 2015)

ARM people are encouraged to use CURRENT and to put `options ARM_NEW_PMAP` in their kernel config file. There are so many fixes in CURRENT that are not MFCed to STABLE that it's just a waste of time to try to run anything else than CURRENT on ARM.


----------



## rpi-user (Apr 13, 2015)

I downloaded FreeBSD-11.0-CURRENT-arm-armv6-RPI-B-20150407-r281236.img.xz and will `svn checkout http://svn0.eu.FreeBSD.org/base/head/ /usr/src` next after I've installed sysutils/screen and devel/subversion. The first thing that happened with the 20150407-r281236 was it crashed while I was working on it over ssh, so I did as someone recently suggested on the mailing list and set 
	
	



```
vm.pmap.sp_enabled=0
```
 in /boot/loader.conf and rebooted.

acheron, when I recompile the kernel with the suggested option, should I then switch vm.pmap.sp_enabled back on? Or is that a separate issue?


----------



## acheron (Apr 13, 2015)

The panic doesn't occur if you put `options ARM_NEW_PMAP` in your config file, no need for your loader.conf tweak (cf. https://lists.freebsd.org/pipermail/freebsd-arm/2015-April/010916.html)


----------

