g4u Wiki
Brought to you by:
hubertf
g4u is a bootfloppy/CD-ROM that allows easy cloning of a PC harddisks or partition to deploy a common setup on a number of PCs via FTP or local disk. As the harddisk/partition is processed as a image, any filesystem and operating system can be deployed.
Hi,
I used g4u since 2008 and always wanted to rebuild it from source just to learn things and, eventually, include a script to automate tasks, to limiting user typos.
I am an Ubuntu user, so the first try was on it, but after many errors, I gave it up. So decided to virtualize NetBSD7 on vmware player because, in my case, it is easier than on actual hardware, and, as one could derive it, with a virtual machine, one could clone it and compile various tests at the same time.
Well, after dealing with the specifics on Hubert´s g4u website, and after many uninitialized variables on NetBSD source, missing drivers, tuning config files etc, I think I have now a working g4u build environment.
To an Ubuntu user perspective I created these steps for the beginner with NetBSD (please experts apologize me).
So, if you got the time to spend on this, this is what I have done so far:
Downloaded a NetBSD-7.0-i386.iso copy (7.1 / 7.1.1 / 7.1.2 will do either but not amd64, I don’t know why, but got i386-netbsdelf could not compile message, even though I could compile a simple HelloWorld.c)
Boot up your machine with CD/DVD/iso on drive
=> Utility Menu => Configure network
=> Install NetBSD to hard disk
Do as you wish until "Select your distribution" message appears:
=> Custom installation => Compiler tools Yes
Wait until "Configure the additional items as needed" message appears:
Tip: If you want to use ftp and rsync after installation, add a user and create passwords for him/her and for root
For rsync:
=> Enable sshd Yes
If virtual machine:
=> Enable raidframe No
When satisfied:
=> Finished configuring
=> Reboot the computer
Log in as your user, I created install
Last login: Thu Apr 5 14:02:19 2018 from 10.192.109.118
NetBSD 7.1.2 (GENERIC.201803151611Z)
Welcome to NetBSD!
g4u-build-environment$ pwd
/home/install
g4u-build-environment$ su -
Password:
Terminal type is kterm.
The steps below are a little different from Hubert´s because I had trouble with normal user, so did everything as root (don’t need to bother about security anyway, for this test machine is virtual and just me will access it).
g4u-build-environment# mkdir /usr/cvs
g4u-build-environment# cd /usr/cvs
This is the very critical step, do this exactly, or things will not be the way you (we) intended it to be (sounds like Star Wars, I could not help)!
g4u-build-environment# env CVS_RSH=ssh cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot co -D 20170418 src
Wait. Wait.. Wait... Wait some more time.... If you got any errors, ARROWUP and ENTER again!
Download http://www.feyrer.de/g4u/g4u-2.6.tgz and put it into your /home/USER_NAME
Tip: You could create/burn it to an iso with http://www.trustfm.net/software/utilities/Folder2Iso.php?page=Download and access it via Removable Devices menu, mount /dev/cd0a /mnt and “cp” it.
Or, you could use ftp, but dont forget to start the service first:
g4u-build-environment# /etc/rc.d/ftpd onestart
Or you could edit /etc/inetd.conf (thanks Hubert)
Let´s continue:
g4u-build-environment# ln -s /usr/cvs/src /usr
g4u-build-environment# cd /usr/src
g4u-build-environment# tar plzvxf /home/install/g4u-2.6.tgz
g4u-build-environment# touch /etc/mk.conf
g4u-build-environment# echo OBJMACHINE=1 >>/etc/mk.conf
Edit some files (or you can apply Hubert´s smime.p7s diff-out.txt text/plain on https://sourceforge.net/p/g4u/mailman/g4u-help/):
g4u-build-environment# cd /usr/cvs/src
g4u-build-environment# diff g4u-build.original g4u-build
14,15c14,15
< #BUILD_FLAGS="${FROMSCRACH_FLAGS} ${ALL_FLAGS}" # Full build
< BUILD_FLAGS="${UPDATE_FLAGS} ${ALL_FLAGS}" # Update bild
g4u-build-environment# cd /usr/cvs/src/sys/dev/acpi
g4u-build-environment# diff pckbc_acpi.c.original pckbc_acpi.c
237c237
< struct pckbc_acpi_softc *psc;
g4u-build-environment# cd /usr/cvs/src/sys/dev/acpi
g4u-build-environment# diff fujhk_acpi.c.original fujhk_acpi.c
246c246
< uint32_t irb;
g4u-build-environment# cd /usr/cvs/src/sys/dev/ic
g4u-build-environment# diff rtsx.c.original rtsx.c
202c202
< uint32_t sdio_cfg;
Cross fingers and type:
g4u-build-environment# cd /usr/src
g4u-build-environment# sh g4u-build
It will took ~ 4 and a half hours on a Core2Duo 3GHz
If you´re lucky:
g4u-build-environment# cd /usr/src/distrib/i386/g4u
g4u-build-environment# ls -l g4u*
And you got your most wanted files!
Now, again, to the point of view of a newbie in NetBSD, if you wish to transfer things with rsync, download rsync-3.1.3.tgz to your user home directory and copy bin/rsync to /usr/bin
g4u-build-environment# pwd
/home/install
g4u-build-environment# su -
g4u-build-environment# cd /home/install
g4u-build-environment# tar plzvxf rsync-3.1.3.tgz
g4u-build-environment# cp -p bin/rsync /usr/bin
It works, but as pointed out by Hubert, use pkg_add instead (lol, I did not know that).
Happy compiling g4u!
Marco
P.s.: I hope it is allowed to put links. And sorry, for I did not find a better way to edit this text.