Difference between revisions of "Bering-uClibc 5.x - Developer Guide - Building an Image"

From bering-uClibc
Jump to: navigation, search
(Copy of Bering-uClibc 4.x - Developer Guide - Building an Image)
 
m
 
(9 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
| width="20%" align="left"  | [[Bering-uClibc 5.x - Developer Guide - Building a Package|Prev]]
 
| width="20%" align="left"  | [[Bering-uClibc 5.x - Developer Guide - Building a Package|Prev]]
 
! width="60%" align="center" | [[Bering-uClibc 5.x - Developer Guide]]
 
! width="60%" align="center" | [[Bering-uClibc 5.x - Developer Guide]]
| width="20%" align="right"  | [[Bering-uClibc 5.x - Developer Guide - Building a Distribution|Next]]
+
| width="20%" align="right"  | [[Bering-uClibc 5.x - Developer Guide - Adding a Kernel Architecture Variant|Next]]
 
|}
 
|}
 
----
 
----
 
  
 
===Boot Disk Media===
 
===Boot Disk Media===
For [[Bering-uClibc 3.x]] the script <tt>tools/createimage.sh</tt> was used to build the image files. Two image variants were supported:
+
Most users of [[Bering-uClibc 5.x]] are expected to boot from some sort of flash drive, most likely:
* <tt>fd</tt> for Floppy Disk media
+
* <tt>iso</tt> for ISO 9660 CD-ROM media
+
For [[Bering-uClibc 4.x]] Floppy Disk is no longer a viable option because of the size of the distribution. Floppy disks drives are also typically not installed on modern systems (and not that many modern systems have built-in CD-ROM drives either).
+
 
+
Most users of [[Bering-uClibc 4.x]] are expected to boot from some sort of flash drive, most likely:
+
 
* A Compact Flash (CF) card which is installed:
 
* A Compact Flash (CF) card which is installed:
 
** Directly onto the main board (as with the the PC Engines ALIX boards)
 
** Directly onto the main board (as with the the PC Engines ALIX boards)
Line 22: Line 16:
 
* A USB flash drive
 
* A USB flash drive
 
For all of these a disk image which boots using SYSLINUX is required.
 
For all of these a disk image which boots using SYSLINUX is required.
A CD-ROM image which boots using ISOLINUX is also required as an alternative. (A <tt>.iso</tt> image is particularly useful for testing Bering-uClibc 4.x with a Virtual Machine.)
 
  
In theory, PXE boot using PXELINUX is an option for LEAF though this is not currently supported by [[Bering-uClibc 4.x]]. While PXE can easily deliver the kernel image and the initrd image, delivering the <tt>.lrp</tt> files is more problematic and saving changes is more complex still. Other Linux distributions solve this problem by delivering files using TFTP or using NFS - see for example http://minimyth.org/ - but adding the necessary support would require additional modules in <tt>initrd.lrp</tt> and would require modifications to <tt>/init</tt>.
+
A CD-ROM image which boots using ISOLINUX is also required as an alternative. (A <tt>.iso</tt> image is particularly useful for testing Bering-uClibc 5.x with a Virtual Machine.)
  
 +
In theory, PXE boot using PXELINUX is an option for LEAF though this is not currently supported by [[Bering-uClibc 5.x]]. While PXE can easily deliver the kernel image and the initrd image, delivering the <tt>.lrp</tt> files is more problematic and saving changes is more complex still. Other Linux distributions solve this problem by delivering files using TFTP or using NFS - see for example http://minimyth.org/ - but adding the necessary support would require additional modules in <tt>initrd.lrp</tt> and would require modifications to <tt>/init</tt>.
  
 
===<tt>buildimage.pl</tt>===
 
===<tt>buildimage.pl</tt>===
For [[Bering-uClibc 4.x]] there is a new script - <code class="filename">buildimage.pl</code> - which is heavily based on <code class="filename">buildpacket.pl</code> and which is controlled by a similar style of configuration file.
+
For [[Bering-uClibc 5.x]] there is a new script - <code class="filename">buildimage.pl</code> - which is heavily based on <code class="filename">buildpacket.pl</code> and which is controlled by a similar style of configuration file.
Each target image has its own configuration file (<code class="filename">buildimage.cfg</code>) stored in its own directory (under <code class=filename">buildtool/image</code>) which specifies how the results of the build process are combined with configuration file templates to construct the final disk image contents.
+
  
 
Different variants of disk image files are supported:
 
Different variants of disk image files are supported:
Line 35: Line 28:
 
* Different boot loader variants (e.g. isolinux, pxelinux, syslinux)
 
* Different boot loader variants (e.g. isolinux, pxelinux, syslinux)
 
* Different variants for other reasons (e.g. vga for standard VGA consoles, ser for RS-232 serial consoles)
 
* Different variants for other reasons (e.g. vga for standard VGA consoles, ser for RS-232 serial consoles)
The naming convention for the <code class=filename">buildtool/image</code> directories is:
 
* "<tt>Bering-uClibc</tt>" as a literal string
 
* The Kernel architecture, e.g. "<tt>i686</tt>"
 
* The boot loader name, e.g. "<tt>syslinux</tt>"
 
* The "other" variant, e.g. "<tt>vga</tt>"
 
The full directory name is therefore e.g. "<tt>Bering-uClibc_i686_syslinux_vga</tt>"
 
  
A <tt>buildimage.cfg</tt> file typically specifies that the image is constructed by copying files as shown below:
+
<code class="filename">buildimage.pl</code> use a single <tt>buildimage.cfg</tt> file (locate in conf/image/templates) which specifies how the results of the build process are combined with configuration file templates to construct the final disk image contents.
 +
 
 +
The <tt>buildimage.cfg</tt> file typically specifies that the image is constructed by copying files as shown below:
  
 
  buildtool
 
  buildtool
 
     package
 
     package
         *.lrp                            Copied to / on all images, controlled by configuration file
+
         *.lrp                            Copied to /
         initrd-$KARCH                   Copied to /initrd.lrp, controlled by configuration file
+
        *.lwp                            Copied to /
    staging
+
         initrd.lrp                      Copied to /initrd.lrp
 +
        initmod-$KARCH                   Copied to /initmod.lrp
 +
    staging
 
         boot
 
         boot
 
             linux-$KARCH                Copied to /isolinux/linux or /syslinux/linux on all images
 
             linux-$KARCH                Copied to /isolinux/linux or /syslinux/linux on all images
 
         lib
 
         lib
 
             modules
 
             modules
                 2.6.x.y
+
                 4.x.x-$KARCH
 
                     *                    Built into /modules.tgz, excluding the build and source sub-directories
 
                     *                    Built into /modules.tgz, excluding the build and source sub-directories
     tools
+
     conf
 
         image
 
         image
 
             common
 
             common
                 leaf.cfg                Copied to / on all images, edited to replace LRP and PKGPATH place holders
+
                 leaf.cfg                Copied to / edited to replace LRP,PKGPATH,LOG_SIZE and TMP_SIZE place holders
                 readme                  Copied to / on all images, edited to replace VERSION and DATE place holders
+
                 readme                  Copied to / edited to replace VERSION and DATE place holders
 +
                configdb.$variant        Copied to /configdb
 
             isolinux
 
             isolinux
                 isolinx.cfg              Copied to /isolinux on ISOLINUX images, edited to replace LRPCFG place holder
+
                 isolinx.cfg              Copied to /isolinux/ on ISOLINUX images, edited to replace LRPCFG and KERNEL place holders
                 isolinux.dpy            Copied to /isolinux on ISOLINUX images, edited to replace VERSION and DATE place holders
+
                 isolinux.dpy            Copied to /isolinux/ on ISOLINUX images, edited to replace VERSION and DATE place holders
 
             syslinux
 
             syslinux
                 syslinux.cfg            Copied to /syslinux on SYSLINUX images, edited to replace LRPCFG place holder
+
                 syslinux.cfg            Copied to /syslinux/ on SYSLINUX images, edited to replace LRPCFG and KERNEL place holders
                 sysliuux.dpy            Copied to /syslinux on SYSLINUX images, edited to replace VERSION and DATE place holders
+
                 syslinux.dpy            Copied to /syslinux/ on SYSLINUX images, edited to replace VERSION and DATE place holders
 +
 
 
        
 
        
 +
TODO Add more info about <tt>buildimage.pl</tt> once it is developed and tested.
  
TODO What about LWP files?
+
The result of running <tt>buildimage.pl</tt> is a single file located in <tt>image</tt> directory
 
+
TODO Add more info about <tt><buildimage.pl</tt> once it is developed and tested.
+
 
+
 
+
The result of running <tt><buildimage.pl</tt> is a single file located alongside the relevant <tt>buildimage.cfg</tt>
+
 
* For an ISOLINUX image this is a <tt>.iso</tt> file which is typically burned to CD-R/RW media
 
* For an ISOLINUX image this is a <tt>.iso</tt> file which is typically burned to CD-R/RW media
 
* For a SYSLINUX image this a <tt>.tar.gz</tt> file which must be copied to a suitably prepared flash drive
 
* For a SYSLINUX image this a <tt>.tar.gz</tt> file which must be copied to a suitably prepared flash drive
 
* For a PXELINUX image this a <tt>.tar.gz</tt> file which must be copied to a TFTP server
 
* For a PXELINUX image this a <tt>.tar.gz</tt> file which must be copied to a TFTP server
** '''QUESTION''' Offer <tt>.zip</tt> as an alternative, for Windows users?
 
 
  
 
===Flash Drive Preparation for SYSLINUX===
 
===Flash Drive Preparation for SYSLINUX===
Flash drive media used for booting Bering-uClibc 4.x should be configured to meet the following criteria:
+
Flash drive media used for booting Bering-uClibc 5.x should be configured to meet the following criteria:
 
* A single disk partition which is specified to be Bootable and with a file system type which matches the installed file system
 
* A single disk partition which is specified to be Bootable and with a file system type which matches the installed file system
 
** File system hex code "b" which <tt>fdisk</tt> lists as "W95 FAT32" is recommended
 
** File system hex code "b" which <tt>fdisk</tt> lists as "W95 FAT32" is recommended
Line 90: Line 77:
 
The contents of the generated <tt>.tar.gz</tt> file can then be copied onto the flash drive.
 
The contents of the generated <tt>.tar.gz</tt> file can then be copied onto the flash drive.
  
 +
===Flash Drive Preparation for GRUB===
 +
Flash drive media used for booting Bering-uClibc 5.x should be configured to meet the following criteria:
 +
* A first disk partition of 150 KB which is specified to be Bootable and with a file system type which matches the installed file system. This partition is used to hold the grub boot code only.
 +
** File system hex code "b" which <tt>fdisk</tt> lists as "W95 FAT32" is recommended
 +
* Multiple disk partitions of 30MB with a file system type which match the supported file systems. Each of these partitions can hold a dedicated copy of the LEAF software and the grub boot loader can be used select the system to load.
 +
** File system hex code "b" which <tt>fdisk</tt> lists as "W95 FAT32" is recommended
  
 
The procedure for all this will need to be detailed in the [[Bering-uClibc 5.x - User Guide]]
 
The procedure for all this will need to be detailed in the [[Bering-uClibc 5.x - User Guide]]
 
  
 
----
 
----
Line 98: Line 90:
 
| width="40%" align="left"  | [[Bering-uClibc 5.x - Developer Guide - Building a Package|Prev]]
 
| width="40%" align="left"  | [[Bering-uClibc 5.x - Developer Guide - Building a Package|Prev]]
 
| width="20%" align="center" | [[Bering-uClibc 5.x - Developer Guide|Up]]
 
| width="20%" align="center" | [[Bering-uClibc 5.x - Developer Guide|Up]]
| width="40%" align="right"  | [[Bering-uClibc 5.x - Developer Guide - Building a Distribution|Next]]  
+
| width="40%" align="right"  | [[Bering-uClibc 5.x - Developer Guide - Adding a Kernel Architecture Variant|Next]]
 
|}
 
|}
  
 
[[Category:Bering-uClibc 5.x]]
 
[[Category:Bering-uClibc 5.x]]
 
[[Category:Developer Guide]]
 
[[Category:Developer Guide]]

Latest revision as of 17:07, 31 January 2017

Building an Image
Prev Bering-uClibc 5.x - Developer Guide Next

Boot Disk Media

Most users of Bering-uClibc 5.x are expected to boot from some sort of flash drive, most likely:

  • A Compact Flash (CF) card which is installed:
    • Directly onto the main board (as with the the PC Engines ALIX boards)
    • Into an IDE-to-CF adaptor
    • Into a USB-to-CF adaptor
  • A USB flash drive

For all of these a disk image which boots using SYSLINUX is required.

A CD-ROM image which boots using ISOLINUX is also required as an alternative. (A .iso image is particularly useful for testing Bering-uClibc 5.x with a Virtual Machine.)

In theory, PXE boot using PXELINUX is an option for LEAF though this is not currently supported by Bering-uClibc 5.x. While PXE can easily deliver the kernel image and the initrd image, delivering the .lrp files is more problematic and saving changes is more complex still. Other Linux distributions solve this problem by delivering files using TFTP or using NFS - see for example http://minimyth.org/ - but adding the necessary support would require additional modules in initrd.lrp and would require modifications to /init.

buildimage.pl

For Bering-uClibc 5.x there is a new script - buildimage.pl - which is heavily based on buildpacket.pl and which is controlled by a similar style of configuration file.

Different variants of disk image files are supported:

  • Different kernel architecture optimizations (e.g. i486, i686, geode)
  • Different boot loader variants (e.g. isolinux, pxelinux, syslinux)
  • Different variants for other reasons (e.g. vga for standard VGA consoles, ser for RS-232 serial consoles)

buildimage.pl use a single buildimage.cfg file (locate in conf/image/templates) which specifies how the results of the build process are combined with configuration file templates to construct the final disk image contents.

The buildimage.cfg file typically specifies that the image is constructed by copying files as shown below:

buildtool
    package
        *.lrp                            Copied to /
        *.lwp                            Copied to /
        initrd.lrp                       Copied to /initrd.lrp
        initmod-$KARCH                   Copied to /initmod.lrp
   staging
        boot
            linux-$KARCH                 Copied to /isolinux/linux or /syslinux/linux on all images
        lib
            modules
                4.x.x-$KARCH
                    *                    Built into /modules.tgz, excluding the build and source sub-directories
    conf
        image
            common
                leaf.cfg                 Copied to / edited to replace LRP,PKGPATH,LOG_SIZE and TMP_SIZE place holders
                readme                   Copied to / edited to replace VERSION and DATE place holders
                configdb.$variant        Copied to /configdb
            isolinux
                isolinx.cfg              Copied to /isolinux/ on ISOLINUX images, edited to replace LRPCFG and KERNEL place holders
                isolinux.dpy             Copied to /isolinux/ on ISOLINUX images, edited to replace VERSION and DATE place holders
            syslinux
                syslinux.cfg             Copied to /syslinux/ on SYSLINUX images, edited to replace LRPCFG and KERNEL place holders
                syslinux.dpy             Copied to /syslinux/ on SYSLINUX images, edited to replace VERSION and DATE place holders


TODO Add more info about buildimage.pl once it is developed and tested.

The result of running buildimage.pl is a single file located in image directory

  • For an ISOLINUX image this is a .iso file which is typically burned to CD-R/RW media
  • For a SYSLINUX image this a .tar.gz file which must be copied to a suitably prepared flash drive
  • For a PXELINUX image this a .tar.gz file which must be copied to a TFTP server

Flash Drive Preparation for SYSLINUX

Flash drive media used for booting Bering-uClibc 5.x should be configured to meet the following criteria:

  • A single disk partition which is specified to be Bootable and with a file system type which matches the installed file system
    • File system hex code "b" which fdisk lists as "W95 FAT32" is recommended
    • QUESTION When is "c" which fdisk lists as "W95 FAT32 LBA" required / desirable?
  • A file system on that disk partition which is compatible with the Linux vfat driver
    • FAT32 is recommended
  • A SYSLINUX install on that disk partition (which creates /ldlinux.sys and installs the MBR)

The contents of the generated .tar.gz file can then be copied onto the flash drive.

Flash Drive Preparation for GRUB

Flash drive media used for booting Bering-uClibc 5.x should be configured to meet the following criteria:

  • A first disk partition of 150 KB which is specified to be Bootable and with a file system type which matches the installed file system. This partition is used to hold the grub boot code only.
    • File system hex code "b" which fdisk lists as "W95 FAT32" is recommended
  • Multiple disk partitions of 30MB with a file system type which match the supported file systems. Each of these partitions can hold a dedicated copy of the LEAF software and the grub boot loader can be used select the system to load.
    • File system hex code "b" which fdisk lists as "W95 FAT32" is recommended

The procedure for all this will need to be detailed in the Bering-uClibc 5.x - User Guide


Prev Up Next