Solved release image build tool , question

Hi, I been using

release

more than happy with the results, a custom image from my src.conf and my kernel conf
with installer included

but I want to go any deeper, is any way to custom more the image?
like make a chroot to the build directory and install some basic packages..like nano
make a custom loader.conf and rc.conf file ,or add a user and put some content in their home directory
for "post-install" steps

for example:
(taken from the release man page with a littles changes..)
Code:
cd    /usr/src
make -j[cpus] buildworld buildkernel
cd release
make obj
make release
make install DESTDIR=/var/freebsd-snapshot

in some point of the process, maybe make a chroot,make the changes and go on?
 
is any way to custom more the image?
like make a chroot to the build directory and install some basic packages..like nano
make a custom loader.conf and rc.conf file ,or add a user and put some content in their home directory
for "post-install" steps
If you mean customize the installer image itself, that's easy.

Not sure if there is an scripted method, but manually works nicely. I've created a installation image, with packages, a user, and *.conf files added. Eventually, you could ask on mailing lists, if there is a better, or a scripted method.

After a /usr/src/release make target ( see release(7) MAKEFILE TARGETS ), look in /usr/obj/usr/src/amd64.amd64/release/, there are different target directories, corresponding to the target , like bootonly/ , disc1/ , dist/ , dvd/, etc.

For example the memstick target creates the disc1/ and dist/ directories, where disc1/ is the directory from which the memstick images root file system is created from, and dist/ is the directory from which /usr/freebsd-dist/*.txz files are created (those are the files which are extracted during installation on the target machine).

The mentioned target directories can be used as a root directory to install packages from the host, see pkg(8) -r --rootdir option.

To add *.conf files simply insert them in the target directory.

To add users, chroot(8) into target directory, add user content in their home directory from outside chrooted environment.

Depending which image you want, proceed in that specific target directory, or if you want all release images, proceed in all of the target directories.

Remove created images first, then re-make the target to created images with the modifications. If you are working WITH_META_MODE, remove the <image>.meta files as well.

I've tried to modify dist/base to have a installation image from which a pre-configured system can be installed on a target machine, but it failed during end of base.txz extraction to be unable to create /dev/null.
 
If you mean customize the installer image itself, that's easy.

Not sure if there is an scripted method, but manually works nicely. I've created a installation image, with packages, a user, and *.conf files added. Eventually, you could ask on mailing lists, if there is a better, or a scripted method.

After a /usr/src/release make target ( see release(7) MAKEFILE TARGETS ), look in /usr/obj/usr/src/amd64.amd64/release/, there are different target directories, corresponding to the target , like bootonly/ , disc1/ , dist/ , dvd/, etc.

For example the memstick target creates the disc1/ and dist/ directories, where disc1/ is the directory from which the memstick images root file system is created from, and dist/ is the directory from which /usr/freebsd-dist/*.txz files are created (those are the files which are extracted during installation on the target machine).

The mentioned target directories can be used as a root directory to install packages from the host, see pkg(8) -r --rootdir option.

To add *.conf files simply insert them in the target directory.

To add users, chroot(8) into target directory, add user content in their home directory from outside chrooted environment.

Depending which image you want, proceed in that specific target directory, or if you want all release images, proceed in all of the target directories.

Remove created images first, then re-make the target to created images with the modifications. If you are working WITH_META_MODE, remove the <image>.meta files as well.

I've tried to modify dist/base to have a installation image from which a pre-configured system can be installed on a target machine, but it failed during end of base.txz extraction to be unable to create /dev/null.
thanks and thanks again
I'am almost there...I modify the image for the memstick image, but the installer complains about the checksum(it has right)
I'am try to make the same with the disc1 iso but I dont get the directory...is a pain in the a## to make a img instalation file and test it on bare metal everytime
the procedure is simple :

Code:
mount -t devfs /dev/ /usr/obj/usr/src/amd64.amd64/release/disc1/dev/
mkdir /usr/obj/usr/src/amd64.amd64/release/disc1/tmp/bsdinstall_etc
echo "nameserver 8.8.8.8" >> /usr/obj/usr/src/amd64.amd64/release/disc1/tmp/bsdinstall_etc/resolv.conf
chroot /usr/obj/usr/src/amd64.amd64/release/disc1/

Install all(nano,xorg) and exit
 
I modify the image for the memstick image, but the installer complains about the checksum(it has right)
To which checksum are you referring to?

I'am try to make the same with the disc1 iso but I dont get the directory.
I'm not sure what you mean.

is a pain in the a## to make a img instalation file and test it on bare metal everytime
Use VMs instead of metal. I do all my testings in VMs first before applying on metal machines.

An iso can be moved, copied as is to the optical disk pool of the virtual machine manager.

A memstick, if VirtualBox, e.g.:
VBoxManage convertfromraw memstick.img FreeBSD-14.1-RELEASE-amd64-memstick.vdi
,

If sysutils/vm-bhyve move, copy memstick.img to $vm_dir/.img, or place of your convenience.

vm configure <vm name>
Code:
disk0_type="virtio-blk"
disk0_name="/vm/.img/memstick.img"
disk0_dev="custom"

# disk to install to
disk1_type="virtio-blk"
disk1_name="disk0.img"
After installation finished, vm configure again, remove disk0_*, rename disk1_* to disk0_*.

If installed for testing purposes, just destroy vm.
 
To which checksum are you referring to?


I'm not sure what you mean.


Use VMs instead of metal. I do all my testings in VMs first before applying on metal machines.

An iso can be moved, copied as is to the optical disk pool of the virtual machine manager.

A memstick, if VirtualBox, e.g.: "VBoxManage convertfromraw memstick.img FreeBSD-14.1-RELEASE-amd64-memstick.vdi",

If sysutils/vm-bhyve move, copy memstick.img to $vm_dir/.img, or place of your convenience.

vm configure <vm name>
Code:
disk0_type="virtio-blk"
disk0_name="/vm/.img/memstick.img"
disk0_dev="custom"

# disk to install to
disk1_type="virtio-blk"
disk1_name="disk0.img"
After installation finished, vm configure again, remove disk0_*, rename disk1_* to disk0_*.

If installed for testing purposes, just destroy vm.

I test it with virtualbox, and cannot boot .img files

Code:
I'm not sure what you mean.

for the memstick image, is the directory "/usr/obj/usr/src/amd64.amd64/release/disc1"

the directory for the cdrom is  "/usr/obj/usr/src/amd64.amd64/release/disc1-disc1"

if I made changes to the memstick directory(chroot) the changes are reflecting
in the final installer image,but in the cdrom (.iso) not


sysutils/vm-bhyve

this is more easy way..I go there
thanks!!!

Code:
To which checksum are you referring to?

in the installer just after creating the zpool the installer
complains about the size of the checksums

but ever I discompress the base.txz file , chroot in it, installl everything
and build the reelease images again..nothing
 
I test it with virtualbox, and cannot boot .img files
For VirtualBox the .img must be converted:
A memstick, if VirtualBox, e.g.:
VBoxManage convertfromraw memstick.img FreeBSD-14.1-RELEASE-amd64-memstick.vdi

the directory for the cdrom is "/usr/obj/usr/src/amd64.amd64/release/disc1-disc1" if I made changes to the memstick directory(chroot) the changes are reflecting in the final installer image,but in the cdrom (.iso) not
Let me check it out.

sysutils/vm-bhyve

this is more easy way..I go there
thanks!!!

See "VBoxManage converfromraw", it's much easier.

To which checksum are you referring to? in the installer just after creating the zpool the installer complains about the size of the checksums but ever I discompress the base.txz file , chroot in it, installl everything and build the reelease images again..nothing

If dist/base, base.txz was modified by e.g. adding files to it, the MANIFEST file must be re-made.

After all modifications are done
Code:
 # pwd
/usr/obj/usr/src/amd64.amd64/release

(For dist/base)
 # rm base.txz
 # make base.txz -C /usr/src/release

# /usr/src/release/scripts/make-manifest.sh  *.txz  >  MANIFEST

# make memstick -C /usr/src/release
 
Poudiere Image is my preferred image builder at this time from ports tree.

I knew about it, even though I have Poudriere installed, I never tried. Time to do it.

Looking at poudriere-image(8), image creation looks quite simple.

Although
Rich (BB code):
DESCRIPTION
     Builds a filesystem image per the specified options.

     WARNING: This feature is still considered ALPHA.

Let's see if there are limitations.
 
Update:
finally got it!

with release , steps:

after building release

Code:
mv /usr/obj/usr/src/amd64.amd64/release/base.txz /usr/obj/usr/src/amd64.amd64/release/base.txz.back
mount -t devfs /dev/ /usr/obj/usr/src/amd64.amd64/release/dist/base/dev/
echo "nameserver 8.8.8.8" > /usr/obj/usr/src/amd64.amd64/release/dist/base/etc/resolv.conf
chroot /usr/obj/usr/src/amd64.amd64/release/dist/base/

install everything and exit

mv /usr/obj/usr/src/amd64.amd64/release/memstick.img /usr/obj/usr/src/amd64.amd64/release/memstick.img.back
(if memstick.img is not removed then make release stops with:
touch disc1
mkdir disc1-memstick
mkdir: disc1-memstick: File exists)


make memstick
(build base.txz again based on the dist/base directory)

and the final image is done



T-Daemon
I've tried to modify dist/base to have a installation image from which a pre-configured system can be installed on a target machine, but it failed during end of base.txz extraction to be unable to create /dev/null.

almost the same happen to me, the error whas that the /dev/ directory was mounted in
/usr/obj/usr/src/amd64.amd64/release/dist/base/dev/
at the moment where build release, my error was:
Code:
error while extracting base.txz
Can't create 'dev/efi'

So,everything when fine, only the instalation wont recognize the installed user in chroot,but there is no problem
at least have nano :)

and thanks for the CBSD advise
 
Back
Top