[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Towards a customized netinst



Hi,

Richard Owlett wrote:
> I had been attempting to follow the pattern of "Debian-Installer: How to
> modify an existing CD image - Create copy of the image"
> <https://wiki.debian.org/DebianInstaller/Modify/CD#Create_copy_of_the_image>

That's about what you did with xorriso. I'd call "unpacking".
An alternative would simply be to mount the ISO and use normal file
copy program. Like:

  sudo mkdir /mnt/iso
  sudo mount -o loop debian-9.1.0-i386-netinst.iso /mnt/iso
  cd $HOME
  cp -a /mnt/iso unpacked_iso

To see the resulting file tree:

  find unpacked_iso | less


> That was the reason for attempting to use xorriso
> with the assumption it would give a perfect copy of image

Unpacking an ISO copies onto your disk the directory tree and the files.
It cannot be perfect with ctime but other file attributes from the ISO
can be copied.
Insofar your assumption about xorriso was right. It's just not what i
would call a "byte for byte copy" and also not the hard part of reaching
your goal.

I could agree on "unpacking nearly perfect file copies from ISO to ext2"
to describe this step.


> I needed an appropriate set of initrd/vmlinuz.

Yes.
I expect it is mostly about the programs, scripts, and configuration
files in the initrd that gets normally booted from the ISO.

Possibly a few programs need adaptions later in the course of starting
the installer and finding a first package repository. But since the system
is prepared to find itself on an USB stick, it should not be too hard to
adapt it to a disk partition.
The way to finding the cause of such a stumblestone can be exhausting,
though.


>   1. *NOT* have any internal assumption of being ISO9660 compliant.
>   2. intrinsically assume it will be resident on an ext2 device.

The only plausible addiction to ISO 9660 would be that other filesystem
drivers might be missing in vmlinuz or initrd. So make sure there
is a driver for ext2.


>   3. be recognizable and boot-able by Grub2.

GRUB does not recognize systems by themselves. It can search devices and
partitions with certain properties, up to the existence of a particular
file in that partition. But that is all defined in grub.cfg and the files
which it includes directly or indirectly by statement "source".

The thing which normally recognizes the ISO as bootable and starts the
boot loader is the firmware of the computer: BIOS or EFI.
But if the ISO is in a partition rather than on a whole storage device,
then the boot loader of the machine's hard disk will be started, because
BIOS and EFI only look at whole devices for bootability.

So an USB stick, which shall boot on uprepared machines, needs to carry
its own boot loader and you will have to teach this boot loader how to
boot the stuff in the ext2 which once was stored in an ISO.
You will have to study 
  /boot/grub/x86_64-efi/grub.cfg
and
  /boot/grub/grub.cfg
in the mounted ISO or in the copied directory tree.
You will have to install GRUB with a suitable configuration onto the USB
stick like you would do with a system hard disk. I.e. the installed GRUB
of the USB stick may not depend on a /boot directory on any other device.

If you copy your ext2 on a partition of a non-removable disk, then you
need to adapt the system's GRUB to boot that partition. The learned
knowledge about grub.cfg should be re-usable in that situation.
But you'd need to find the scripts which write the grub.cfg files of
that system. (Direct editing is heavily discouraged.)


Have a nice day :)

Thomas


Reply to: