Difference between revisions of "Talk:Build an Official ISO"

From SME Server
Jump to navigationJump to search
Line 92: Line 92:
 
* how to customize centos 7
 
* how to customize centos 7
  
http://serverfault.com/questions/517908/how-to-create-a-custom-iso-image-in-centos
+
** http://serverfault.com/questions/517908/how-to-create-a-custom-iso-image-in-centos
 
+
** https://github.com/joyent/mi-centos-7
https://github.com/joyent/mi-centos-7
+
**
  
 
* fedora doc
 
* fedora doc
**https://fedoraproject.org/wiki/Anaconda/Changes
+
** https://fedoraproject.org/wiki/Anaconda/Changes
**
+
** https://fedoraproject.org/wiki/LiveOS_image
  
 
*using squashfs
 
*using squashfs
 
** http://www.tldp.org/HOWTO/html_single/SquashFS-HOWTO/#mksqusing
 
** http://www.tldp.org/HOWTO/html_single/SquashFS-HOWTO/#mksqusing
**
+
** https://blog.sleeplessbeastie.eu/2012/05/27/how-to-modify-squashfs-image/
 +
** http://voidmain.is-a-geek.net/redhat/fedora_10_live_cd_hacking.html <= really helpfull
 +
 
 +
 
 +
*kickstart
 +
**http://serverfault.com/questions/517908/how-to-create-a-custom-iso-image-in-centos
 +
 
 +
*rootfs
 +
**http://www.wiki.xilinx.com/Build+and+Modify+a+Rootfs
  
 
===Foreword===
 
===Foreword===

Revision as of 08:26, 27 July 2016

  • Note: Maybe obvious, generate checksums for final ISO's : --Stephdl (talk) 13:29, 3 January 2015 (CET)

it seems that anaconda does the job and create the checksum and the sha1 automatically

==> in fact this is handled by the build_iso script Unnilennium (talk) 16:23, 17 July 2016 (CEST)

  • Each installer and ISO needs to built on the corresponding version (cos5 for sme8 and cos6 for sme9).
This can be misleading. The build box can be the same, eg COS6 x64 for all ISOs, it is only the mock image that needs to match the ISO, and this is magically handled by the mock configs

For clarification read http://bugs.contribs.org/show_bug.cgi?id=7675#c37

'The corresponding version' refers to either a cos5 install or a cos5 mock env. Building packages does require the same 'corresponding version' You can't easily build sme8 packages on a cos6 box. But with mock you can because you can create a small chroot of cos5 to build the packages. We use the same trick to build the ISO. The ISO mock creates a minimal cos5 with the correct packages to build the ISO.


  • Note I needed to edit mock cfg file to include /build in the chroot due to my local setup.
These are the changes that I made as I do not have the nfs mounts on my local machine. I replaced
config_opts['plugin_conf']['mount_opts']['dirs'].append(('storage:/export/build', '/build', 'nfs', 'defaults,noatime,nodiratime,nosuid'))
config_opts['plugin_conf']['mount_opts']['dirs'].append(('storage:/mirrors', '/mirrors', 'nfs', 'defaults,noatime,nodiratime,nosuid'))
with
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/build', '/build' ))


Also note http://bugs.contribs.org/show_bug.cgi?id=7675#c61

  • There is also an update to /usr/lib/python2.6/site-packages/mockbuild/mounts.py that needs to happen so loop devices get mounted correctly. Check /var/lib/mock/smeserver-VERSION-ARCH/result/root.log after mock -r smeserver-VERSION-ARCH-iso --init (eg mock -r smeserver-8-i386-iso --init). The mounting of the /dev/loopX should pass (return code 0). If it fails (return code 32) then the patch below is needed on your build host.


@@ -83,6 +83,9 @@
    decorate(traceLog())
    def mount(self):
+        if not os.path.isdir(self.srcpath) and not os.path.isfile(self.srcpath):
+            mockbuild.util.touch(self.bindpath)
+
        if not self.mounted:
            cmd = ['/bin/mount', '-n',
                   '--bind', self.srcpath, self.bindpath ]


  • For SME Server 8 check that anaconda-runtime was installed in the mock instance. For SME 8 the anaconda-runtime needs to be installed, check /usr/lib/anaconda-runtime/mk-images* exists in the mock instance after the mock --init. (check /var/lib/mock/smeserver-8-i386/root/usr/lib/anaconda-runtime)

If it does not then run the following, assuming i386 ARCH.

mock -r smeserver-8-i386-iso --cwd /build/smeserver/stage/8 --chroot /usr/bin/yum install anaconda-runtime

If you have error for lack of privileges, noticed for sme9 --Stephdl (talk) 15:29, 31 December 2014 (CET)

 mock -r smeserver-8-i386-iso --cwd /build/smeserver/stage/8 --chroot '/usr/bin/sudo /usr/bin/yum install anaconda-runtime'

You can find logs of the related scripts build_ISO and build_installer

/build/smeserver/stage/8/build_ISO.i386

&

/build/smeserver/stage/8/build_installer.i386
  • for sme9 modify /build/smeserver/stage/bin/build_installer --Stephdl (talk) 13:53, 31 December 2014 (CET)

L100

       /build/smeserver/repo/testing/$distrel/smeextras/$distarch/ \

in

       /build/smeserver/repo/$distrel/smeextras/$distarch/ \
  • The beta Tag in the installer --Stephdl (talk) 15:24, 31 December 2014 (CET)

I noticed that the Iso gets a 'beta' tag with warnings during the install process. How remove the the beta tag, add --final in the build_installer

# add --final when we have final product
   PYTHONPATH=/usr/lib/anaconda/ sudo /usr/lib/anaconda-runtime/buildinstall \
       --product "$distname" \
       --version "${distvers/[^0-9.]*/}" \
       --release "$distname" \
       --brand "centos" \
       --final \
       --bugurl http://bugs.contribs.org/ \
       --output $(pwd)/$distarch/ \
       /build/smeserver/repo/$distrel/smeextras/$distarch/ \
       $(pwd)/$distarch/
   /bin/sed -i -e "s|packagedir =.*|packagedir = Packages|" $(pwd)/$distarch/.treeinfo


I forget the solution to the beta-nag. Either I modified the build script on the buildsys. Or I modified anaconda on the buildsys.

SME10 preparation and build_installer

first for reference

  • how to customize centos 7


Foreword

Red Hat suggest to create a product.img (https://access.redhat.com/documentation/en/red-hat-enterprise-linux/7/anaconda-customization-guide/2-working-with-iso-images#sect-product-img) and to put it in the folder images at the root of the CD, however, Centos did not use this way, but rather edited directly the anaconda image inside the live image.

Also, we might want to patch Anaconda at least to handle the degraded raid 1

Hence I feel we will have to do the same to hide all Centos branding.Unnilennium (talk) 17:20, 17 July 2016 (CEST)

THE KEY

- the holly Grail is the .buildstamp file

$ cat product/.buildstamp
[Main]
Product=Koozali SME Server
Version=10alpha2
BugURL=https://bugs.koozali.org
IsFinal=False
UUID=alpha2.x86_64
[Compose]
Lorax=19.6.66-1


how to create a good product.img for SME 10 alpha 2 (WIP)

alternative how to edit content of squashfs for SME 10 alpha 2 (WIP)

as the product.img is unable to change the centos 7 branding in the installer even if the files are replaced Anaconda seems to ignore them or just launch before the modification take place):

  • first extract the content of Live image, and the image of Anaconda inside
cd /build/smeserver/stage/10.0.alpha1/x86_64/LiveOS/
mkdir /mnt/squashfs
sudo mount -o loop squashfs.img /mnt/squashfs
mkdir -p  /tmp/rootfs/LiveOS
cp -a /mnt/squashfs/LiveOS/rootfs.img /tmp/rootfs/LiveOS/
mkdir /mnt/rootfs
sudo umount /mnt/squashfs
sudo mount -o loop /tmp/rootfs/LiveOS/rootfs.img /mnt/rootfs


  • then we have to modify what we want like usual

WORK IN PROGRESS: NB: cp and rm inside the fs will need to be done with sudo :(

  1. usr/share/anaconda/pixmaps/ content (logo, side bar, top bar, etc.)
  2. usr/share/anaconda/pixmaps/rnotes/en/ content (Banners for the installation progress screen)
  3. usr/share/anaconda/anaconda-gtk.css (gui stylesheet)
  4. run/install/product/pyanaconda/installclasses/custom.py (for changing the product name as told by red hat)
  5. usr/lib64/python2.7/site-packages/pyanaconda/installclasses/centos.py ( to effectively change the product name!! )

we can also remove centos pictures in rnotes this way.


  • finally rebuild images
sudo umount /mnt/rootfs
rm /build/smeserver/stage/10.0.alpha1/x86_64/LiveOS/squashfs.img
cd /build/smeserver/stage/10.0.alpha1/x86_64/LiveOS/
mksquashfs /tmp/rootfs  squashfs.img


patch anaconda and rebuild the whole installer for SME 10 alpha 3 or next (WIP)

TO DO