# Trying to perform a cross compile to upgrade in a Raspberry-4-b



## edulsa (Oct 22, 2020)

Dear

I could install FreeBSD 13 - current in a Raspberry Pi - 4 - model B (usando a iso image for Rapsberry-Pi-3, as well documented in this site) and I could to perform a first update downloading source files (using svnlite), make TARGET=arm64 TARGET_ARCH=aarch64 buildworld buildkernel   . This worked fine but, it took 27 hours processing. So, I tryed to generate the update files in a "faster" computer (amd64 amd-8350 processor). 

In this amd-8350 , so that avoid troubles mixing the native system (amd64 version - 12.1 Release) with arm64 binaries, I did:

```
mkdir /home/edulsa/arm64; mkdir /home/edulsa/arm64/src; mkdir /home/edulsa/arm64/obj
svnlite co svn://svn.freebsd.org/base/head /home/edulsa/arm64/src
setenv MAKEOBJDIRPREFIX /home/edulsa/arm64/obj
make -j 4 TARGET=arm64 TARGET_ARCH=aarch64 buildworld buildkernel KERNCONF=GENERIC-NODEBUG
```
It took two hours and ended without problems (I create logs to follow it).

After, I did a `tar -zLcfv arm64.new.tgz /home/edulsa/arm64`  and transfered the file to a Raspberry Pi

The, I did :

```
cd /
tar -zxvf /home/edulsa/arm64.new.tgz 
cd /home/edulsa/arm64/src
make installkernel "KERNCONF=GENERIC-NODEBUG" TARGET=arm64 TARGET_ARCH=aarch64
```
but this did not work. I tried to `setenv MAKEOBJDIRPREFIX /home/edulsa/arm64/obj` but did not solve:

```
--------------------------------------------------------------
>>> Install check kernel
--------------------------------------------------------------
--------------------------------------------------------------
>>> Installing kernel GENERIC-NODEBUG on Thu Oct 22 18:36:39 -03 2020
--------------------------------------------------------------
cd /home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/sys/GENERIC-NODEBUG;  MACHINE_ARCH=aarch64  MACHINE=arm64  CPUTYPE= CC="cc -target aarch64-unknown-freebsd13.0 --sysroot=/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp -B/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/usr/bin" CXX="c++  -target aarch64-unknown-freebsd13.0 --sysroot=/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp -B/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/usr/bin"  CPP="cpp -target aarch64-unknown-freebsd13.0 --sysroot=/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp -B/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/usr/bin"  AS="as" AR="ar" LD="ld" LLVM_LINK=""  NM=nm OBJCOPY="objcopy"  RANLIB=ranlib STRINGS=  SIZE="size" STRIPBIN="strip" PATH=/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/bin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/usr/sbin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/usr/bin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/legacy/usr/sbin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/legacy/usr/bin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/legacy/bin:/home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin  make  KERNEL=kernel install
cd: /home/edulsa/arm64/obj/home/edulsa/arm64/src/arm64.aarch64/sys/GENERIC-NODEBUG: No such file or directory
*** Error code 2

Stop.
make[1]: stopped in /home/edulsa/arm64/src
*** Error code 1
```
]

I concluded that the solution is point correctly where objects (*.) should be found. I saw the there is a lot of them (possibly, everything necessary) at: 
/home/edulsa/arm64/obj/usr/home/edulsa/arm64/src/arm64.aarch64/sys/GENERIC-NODEBUG

I saw in this list some tutorials to cross-compile but, until I could understand, they aim to generate a iso image for install in another machine, not for update proposes

Please, could you point some directions or hints?

Thank you in advance for your attention

Yours

Eduardo


----------



## acheron (Oct 23, 2020)

You can't do that. Just do that from your amd64 machine, mount your rpi sdcard in DESTDIR:

```
make TARGET_ARCH=aarch64 DESTDIR=/some/path KERNCONF=GENERIC-NODEBUG installworld installkernel
```


----------



## edulsa (Oct 27, 2020)

edulsa said:


> Dear
> 
> I could install FreeBSD 13 - current in a Raspberry Pi - 4 - model B (usando a iso image for Rapsberry-Pi-3, as well documented in this site) and I could to perform a first update downloading source files (using svnlite), make TARGET=arm64 TARGET_ARCH=aarch64 buildworld buildkernel   . This worked fine but, it took 27 hours processing. So, I tryed to generate the update files in a "faster" computer (amd64 amd-8350 processor).
> 
> ...







acheron said:


> You can't do that. Just do that from your amd64 machine, mount your rpi sdcard in DESTDIR:
> 
> ```
> make TARGET_ARCH=aarch64 DESTDIR=/some/path KERNCONF=GENERIC-NODEBUG installworld installkernel
> ```


Dear Acheron

Thank you for your answers. Please, after have installed (by setting a DESTDIR parameter), how can I transport (I think, tar -zcvf new.arm64.tgz DESTDIR etc) and, the most important, can I unpack it in a arm64 machine just doingg a tar -zxvf new.arm64.tgz under which directory? Sorry to ask it but I am not a computer guy (my first subject as scientist is in chemistry).

My best regards

Eduardo


----------



## acheron (Oct 28, 2020)

If your sdcard is mounted on DESTDIR you have nothing to do. You can try to use PkgBase if you want to perform the upgrade on your device.
Or, you can create an archive of DESTDIR and unpack it on your device, make sure you don't extract / overwrite /etc


----------

