Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2019 08:27:15 -0700
From:      Russell Haley <russ.haley@gmail.com>
To:        Stefan Parvu <sparvu@kronometrix.org>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>, Udit agarwal <dev.madaari@gmail.com>
Subject:   Re: recreate FreeBSD 12 ARM image
Message-ID:  <CABx9NuSPQ3d2=VQmqMrt7PsXU3d3tSLHA-_fXc3tAkFR55TwBw@mail.gmail.com>
In-Reply-To: <148817FA-22C2-4393-836C-474ABCA92C41@kronometrix.org>
References:  <23ABC4DD-840D-4C63-ACCF-4DF6BC801CF0@kronometrix.org> <201907150915.x6F9FqES061430@donotpassgo.dyslexicfish.net> <201907150922.x6F9MIAA063646@donotpassgo.dyslexicfish.net> <148817FA-22C2-4393-836C-474ABCA92C41@kronometrix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 15, 2019 at 6:57 AM Stefan Parvu <sparvu@kronometrix.org> wrote=
:

> Thanks for message.
>
> What I meant was this:
>
>  * original ARMv8 FreeBSD 12.0 RELEASE is 2 684 354 560 bytes (2.69 GB on
> disk) not
> compressed
>
>  * if I install the image on a 32GB MicroSD card I would love to make bac=
k
> the FreeBSD
> image to something as close as possible to the original size (of course
> except what I install
> additional)
>
>  * yes, idea is to offer the FreeBSD 12 to our customers pre-packaged and
> ready to be used for
> analytics and data recording
>
>  * I want our customers would install the img on their own MicroSD cards =
=E2=80=A6
>
>
> See what I mean ?
>
Hi Stefan,

(Waringing: I'm in and out of this community all the time so the
suggestions below should be taken with some skepticism that I have all the
details correct).

Perhaps what you're actually looking for is to simply shrink down the
partition and copy the results into an img file using memdisk?
man.freebsd.org should be able to provide instructions on gpart and md,
though there may be a better tool to shrink partitions than gpart. Udit
agarwal has intructions linked below that has an example of using md. NOTE:
You will need to copy ALL the partitions and the boot code into that new
memdisk. It seems to me that what you are asking for is fraught with
problems. You won't have autoexpanding filesystems anymore, the uboot code
is platform specific, etc,etc.

Something you may want to be concerned about is repeat-ability. It's fine
to grab the FreeBSD image and expand it on an arm device and customize it.
But that process is going to eat up time when people start asking for
updates, or you want to move to the latest image. Other things that will
likely come up for you are custom build options, especially in your
applications. For a one off, that may be okay. But if this is an offering
to customers, you may want to look a little deeper.

When building/cross compiling FreeBSD, the make scripts copy all the files
into a directory (OBJDIR?) and that directory is what eventually becomes
your root directory on the sdcard. What you may want to do is re-use the
cross compiler and rebuild your software yourself, then copy it into the
output directory and create an image file from that. You could installworld
the FreeBSD files into the memdisk and then copy in your own software
afterwards. This would give you complete control over the process and you
wouldn't have to "shrink" the SD card image. I don't know how FreeBSD gets
the partition to autoexpand on first boot, but that's something you could
ask about on this list. So I see two options in this vein:

1) Learn how to cross compile your own build, add your software to the
output directory and then create your own img file. Udit has a pretty
decent blog about how to do that for BBB:
http://uditagarwal.in/index.php/2018/04/17/building-freebsds-sdio-driver-fo=
r-beaglebone-black/.
Some of the steps concerning the SDIO driver aren't applicable to you, but
you would be able to put together your own instruction set pretty easily
from what he has.
2) I've never used Crochet but I've read through the code a little bit.
Since it's a shell script, it would be pretty easy to insert your own
commands into the overall process and that would give you a truly automated
way of creating these custom images.

So my suggestion is the following:
1) Build your concept/prototype as you are doing and shrink the root
partition. Then you could figure out how big your ARM image is, create a
memdisk the size you want and DD everything the files back into the
memdisk. Buyer beware: I think this is going to give you more problems than
you realize.
2) After you have a prototype working, learn the build process from Udits
blog and internalize it, that way you understand what's actually happening.
The running of the build process is actually quite simple once you've done
it a few times. You could manually cross compile your code (again, ask here
for that) and manually add it to the memdisk img file.
3) Once you know what needs to be done, review Crochet and customize it to
suite your needs. That way when your non-technical boss says "Could you
just add this one thing to the image" you're ready.

Good Luck!
Russ


>
> Thanks,
> Stefan
> _______________________________________________
> freebsd-arm@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABx9NuSPQ3d2=VQmqMrt7PsXU3d3tSLHA-_fXc3tAkFR55TwBw>