# ${OBJDIR}



## balanga (Nov 29, 2017)

http://wiki.freebsd.org/FreeBSDMarvell mentions ${OBJDIR}...

*Move kernel to TFTP area*

```
$ cp ${OBJDIR}/sys/DB-885XXX/kernel.bin /tftpboot/mv5281/
```

Apologies for my ignorance, but how am I supposed to know which directory this ${OBJDIR} refers to?


----------



## Phishfry (Nov 29, 2017)

It is an environmental variable make(1)
See the .OBJDIR section.

Also study this: build(7)
Look at MAKEOBJDIRPREFIX

So the TLDR;
You are copying the kernel from the build directory to the tftp directory.


----------



## balanga (Nov 30, 2017)

This the location of the file on my system:-
/usr/obj/arm.arm/usr/src/sys/DB-88F6XXX/kernel.bin
which would mean that ${OBJDIR} was equivalent to
/usr/obj/arm.arm/usr/src

Looking at the references you listed I could not work out how this ${OBJDIR} would be resolved to what I have so wondered if the build directory structure would have been different when guide was written. Anyhow I'll try again from scratch using the source from 11.1.
One thing which continues to confuse me is some people say U-Boot should run kernel.bin and others say it should be ubldr.bin.


----------



## Phishfry (Nov 30, 2017)

balanga said:


> U-Boot should run kernel.bin and others say it should be ubldr.bin


I am not real knowledgeable about the topic but generally uboot(like BIOS for ARM) first then ubldr loads the kernel. This is called bootstrap loading.
The kernel can not boot itself. It must be bootstrapped. This assists the kernel in loading.
See the manual for details on x86 for backround. boot(8)



balanga said:


> which would mean that ${OBJDIR} was equivalent to
> /usr/obj/arm.arm/usr/src


Yes this is the default location for native builds. (Actually ${OBJDIR}=/usr/obj/)

The setenv directive allows you to put it where ever you want. Like so:
`setenv MAKEOBJDIRPREFIX /home/${USER}/obj/`
Here ${USER} is another variable just as an example.

There is an ARM boot Wiki but it is incomplete:
https://wiki.freebsd.org/FreeBSD/arm/BootProcess


----------



## balanga (Dec 1, 2017)

Phishfry said:


> I am not real knowledgeable about the topic but generally uboot(like BIOS for ARM) first then ubldr loads the kernel. This is called bootstrap loading.
> The kernel can not boot itself. It must be bootstrapped. This assists the kernel in loading.


Interestingly, when I tried loading ubldr.bin nothing happened but when loading kernel.bin I got:-

```
GoFlexHome> setenv ipaddr 192.168.1.23
GoFlexHome> setenv serverip 192.168.1.55
GoFlexHome> ping 192.168.1.55          
Using egiga0 device
host 192.168.1.55 is alive
GoFlexHome> tftp 0x900000 kernel.bin
Using egiga0 device
TFTP from server 192.168.1.55; our IP address is 192.168.1.23
Filename 'kernel.bin'.
Load address: 0x900000
Loading: #################################################################
    #################################################################
    #################################################################
    #################################################################
    #############################################
    1.8 MiB/s
done
Bytes transferred = 4468580 (442f64 hex)
GoFlexHome> go 0x900000
## Starting application at 0x00900000 ...
Copyright (c) 1992-2017 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
   The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.1-RELEASE #0: Thu Nov 30 14:22:01 GMT 2017
   root@Test:/usr/obj/arm.arm/usr/src/sys/DB-88F6XXX arm
FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)
```

and then nothing.

Makes me wonder how Cooltrainer managed it....



> See the manual for details on x86 for backround. boot(8)
> 
> 
> Yes this is the default location for native builds. (Actually ${OBJDIR}=/usr/obj/)
> ...





> There is an ARM boot Wiki but it is incomplete:
> https://wiki.freebsd.org/FreeBSD/arm/BootProcess



Incomplete is a bit of an understatement  

*ubldr *merits a header but nothing else... Seems to be some black magic that only a few people understand and no one wants to share.


----------



## Phishfry (Dec 1, 2017)

You do remember what Crest mentioned about these devices having uboot embedded in ROM...
He sounded like he knew what he was talking about.

My guru answered some basic questions about my earlier comment: (uboot is like arm BIOS)
_Yes, to some extent U-Boot is a BIOS
for embedded devices. For ubldr it provides basic I/O operations like
storage access, networking, non-volatile environment.
_
This is helpful too_:_
http://blog.khubla.com/freebsd/how-does-the-crochet-freebsd-arm-boot-work


----------



## Phishfry (Dec 1, 2017)

I am amazed at how far you have gotten.

At this point the mailing list post should have what you need for settings:
https://lists.freebsd.org/pipermail/freebsd-arm/2017-April/015993.html


----------



## balanga (Dec 1, 2017)

Phishfry said:


> I am amazed at how far you have gotten.


At times I feel I'm banging my head against a brick wall 

When I finally get it work it will probably turn out that I made a simple mistake along the way.


> At this point the mailing list post should have what you need for settings:
> https://lists.freebsd.org/pipermail/freebsd-arm/2017-April/015993.html



From that link it looks as though I should load kernel.bin at location 0x01100000...

I'm not sure what 'dockstarwoipsecnatt' is... is it a kernel or ubldr file?

I've tried to subscribe to this freebsd-arm list a few times but never managed it


----------



## Phishfry (Dec 1, 2017)

balanga said:


> I'm not sure what 'dockstarwoipsecnatt' is... is it a kernel or ubldr file?


https://forums.freebsd.org/threads/61424/#post-355506


----------

