ISO image: where is the CLANG compiler?

O. Hartmann o.hartmann at walstatt.org
Wed Jan 18 09:19:40 UTC 2017


On Wed, 18 Jan 2017 10:43:58 +0200
Daniel Kalchev <daniel at digsys.bg> wrote:

> I never use the pre-built ISO images for tasks like this. Here is a script I
> use to build my own USB boot drive. The drive contains the full OS to boot
> and also a copy used to create a new system. I make these boot drives from
> time to time, to stay current. Please note the script is few years old (for
> 9-stable) and you might want to twiddle with boot partition size if they
> grew. You need to have done bouildworld/buildkernel on the host before using
> this script.
> 
> $ cat createuboot
> #!/bin/sh
> # target USB drive to write to
> disk=da1
> # use the current date for labels
> today=`date "+%Y%m%d"`
> # wipe out partition data form drive
> # do it twice to wipe more stuff (might not be needed anymore)
> gpart destroy -F $disk   
> gpart create -s GPT $disk
> gpart destroy -F $disk        
> # GPT label the drive
> gpart create -s GPT $disk      
> # bootstrap partition 
> gpart add -b 34 -s 128 -t freebsd-boot $disk   
> # partition for the OS
> gpart add -a 4k -t freebsd-ufs -l boot$today $disk 
> # write bootstrap code
> gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 $disk
> 
> # format file system
> newfs  /dev/gpt/boot$today
> 
> # mount file system
> mount -o async /dev/gpt/boot$today /mnt
> 
> # install FreeBSD
> cd /usr/src
> make installworld DESTDIR=/mnt
> make distribution DESTDIR=/mnt
> make installkernel DESTDIR=/mnt
> # Create new “clean” copy of FreeBSD for later use
> mkdir -p /mnt/root/FreeBSD
> make installworld DESTDIR=/mnt/root/FreeBSD
> make distribution DESTDIR=/mnt/root/FreeBSD
> make installkernel DESTDIR=/mnt/root/FreeBSD
> 
> # copy scripts
> cp -r ~/scripts /mnt/root
> 
> echo /dev/gpt/boot$today / ufs rw,noatime 0 1 > /mnt/etc/fstab
> umount /mnt
> 
> 
> You might add more customizations, such as dhclient and starting sshd
> in /etc/rc.conf of the boot drive.
> 
> Hope this helps…
> 
> Daniel
> 
> 
> > On 18.01.2017 г., at 9:45, O. Hartmann <ohartmann at walstatt.org> wrote:
> > 
> > I ran into a very nasty situation where I need to save/restore/reinstall a
> > in-installworld-crashed recent current.
> > 
> > While the /usr/obj and /usr/src as well as /etc folders are intact
> > (residing on a Samsung 850 pro SSD with UFS and journaling), /boot/kernel
> > vanished and most binaries in /bin and /sbin are of Null size.
> > 
> > I treid to rescue the system by intending to use the most recent CURRENT ISO
> > image found on the snapshot server for USB drives, booted this successfully
> > and then mounted the failes filesystems into the proper place (/usr/obj
> > and /usr/src onto USB devices /usr/obj and /usr/src respectively, the rest
> > goes into /mnt).
> > 
> > I tried then to perform a make installworld with DESTDIR=/mnt set. But I
> > fail: the minimalistic USB image does not have any CLANG/LLVM stuff
> > required for the rescue!
> > 
> > Where the hell did this stuff go? Has it been ripped off due to the 1 GB
> > ancient flash size? 
> > 
> > Help is needed. I've already posted to CURRENT a message, but I guess I
> > always hit the wrong subject line. It seems that the key to my saviour is
> > to have a flash drive with a recent CURRENT containing a cc compiler -
> > otherwise /usr/obj is useless.
> > 
> > Kind reards,
> > 
> > Oliver
> > _______________________________________________
> > freebsd-current at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"  
> 
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"


Hello Daniel,

thank you very much for responding!

I just looked into "makeing release". I have a lot of NanoBSD images and build
environments for our purpose at work, but I always strip off the compiler,
too :-(

I was realy badly surprised that on the ISOs the compiler is not present - for
the sake of space? If so, then best practice would be to melt everything down
to 1,66 MB size - as an ancient floppy would contain. Or better, Null.
Sorry ... It is hard these days to purchase 1GB USB flash drives, most of them
do have 2 GB at least.

As your own approach indicates, the ISOs are useless in such cases and I
consider them as a toying thingi, nothing more. it is probably the best to have
a complete emergency ISO at hand - as your script provides.

Again, thanks for the script. I need to adjust the kernel and will create then
my own USB drive.

Kind regards,

Oliver


More information about the freebsd-questions mailing list