Page 1 of 1

[Solved] load porteus 3.1 from tftp

Posted: 12 Dec 2015, 10:50
by Valerii
Hi,
I have tftpd on NAS D-Link 327 with configured settings for a few other distros and can be loaded w/o issues on a diskless workstation (I'm playing with virtualbox machine now).

Could you please share with me the pxelinux setup (similar to what I have already for ex. for Ubuntu) what I should add to tftp/pxelinux.cfg/default config.

Here are the lines what I use to load ubuntu:
LABEL ubuntu 14.04_x86_64
MENU LABEL Ubuntu 14.04 (64-bit)
KERNEL images/ubuntu/14.04/x86_64/casper/vmlinuz.efi
APPEND vga=normal boot=casper netboot=nfs nfsroot=192.168.2.120:/mnt/HD/HD_a2/mounted_iso/ubuntu-14.04.1-desktop-amd64.iso initrd=tftp://192.168.2.120/images/ubuntu/14
.04/x86_64/casper/initrd.lz ip=dhcp --

P.S.
I'm able to load porteus kernel on a diskless station with such lines:

LABEL porteus
MENU LABEL Porteus 3.1 (64-bit)
KERNEL images/porteus/3.1/x86_64/boot/syslinux/vmlinuz
APPEND initrd=images/porteus/3.1/x86_64/boot/syslinux/initrd.xz timezone=Europe/Kiev login=root copy2ram

Re: load porteus 3.1 from tftp

Posted: 12 Dec 2015, 16:38
by francois
Here you can adapt to pxe settings that you have already as this is for regular porteus.

Change your 40_custom settings, here is mine:

Code: Select all

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

# path to the partition holding ISO images (using UUID)
probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"

menuentry "Porteus XFCE x86-64 ISO" {
insmod part_msdos
insmod ext2
set root=(hd0,1)
set isofile="/ISO/Porteus-XFCE-v3.1-x86_64.iso"
search --no-floppy --file --set=root $isofile
loopback loop $isofile
linux (loop)/boot/syslinux/vmlinuz from=$isofile changes=1_porteus login=root
initrd (loop)/boot/syslinux/initrd.xz
}

Re: load porteus 3.1 from tftp

Posted: 13 Dec 2015, 18:05
by Valerii
Hi francois,
Thank you for prompt reply.

Unfortunately I could not recognize how your answer can be used with PXE. See below a few notes how I overcame my problem.

Here is my pxe record for porteus linux v3.1 x86_64 based on default initrd with modules folder from 000-kernel and updated init:

Code: Select all

LABEL porteus
MENU LABEL Porteus 3.1 (64-bit)
KERNEL images/porteus/3.1/x86_64/boot/syslinux/vmlinuz
ipappend 1
APPEND initrd=images/porteus/3.1/x86_64/boot/syslinux/initrd.xz timezone=Europe/Kiev login=root
#put debug to get more info and stop on each step during booting
#APPEND initrd=images/porteus/3.1/x86_64/boot/syslinux/initrd.xz timezone=Europe/Kiev login=root debug

My steps how I overcame the problem:
1. I've added "ipappend 1" and realized (or found on some page about porteus) that the initrd doesn't contain full set of network drivers.
2. That enforced me to unpack initrd and 000-kernel module, put modules folder to initrd and pack that all back.

to unpack:

Code: Select all

xz -d < ../initrd.xz | cpio -i
to unpack xzm module:

Code: Select all

mkdir -p /tmp/000-kernel && mount -o loop ./porteus/base/000-kernel.xzm /tmp/000-kernel
to pack:

Code: Select all

find | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > ../initrd.xz
3. Then I faced with another issue - empty /mnt/nfs
4. Not long investigation and linuxrc -> init showed me the only place where the script mounts the nfs folder:

Code: Select all

mkdir -p /mnt/nfs/porteus /mnt/nfs/storage; udhcpc; modprobe nfsv4; mount -t nfs4 $IP:/srv/pxe/porteus /mnt/nfs/porteus -o ro,nolock 2>/dev/null
As you can see here we have static nfs path. My NAS doesn't allow me to use such folder as /srv for sharing. So I updated it so my folder what points to /porteus folder from iso. After mounting /mnt/nfs/porteus contains iso /porteus folder's content like base/modules/optional etc.

Then I updated a few things like added some new modules to modules, optional. Also I added a few scripts in rootcopy/root/bin.

Now I have only two questions:
1. Is it possible to use some other nfs path instead of updating linuxrc like I did?
2. How to decrease modules (see above) size to copy network drivers only? Yes, I know about the modules/3.17.4-porteus/kernel/drivers/net subfolder. And I could use it only instead of copying whole modules folder. But I'm not sure it will work without all other folders. Is it possible to generate initrd with all network drivers and without all other drivers? It might reduce result initrd size dramatically.

Re: load porteus 3.1 from tftp

Posted: 13 Dec 2015, 19:40
by fanthom
1. Is it possible to use some other nfs path instead of updating linuxrc like I did?
This is not possible

2. How to decrease modules (see above) size to copy network drivers only?
You could boot Porteus 3.1 with 'Enable PXE server' option and copy 'ready to go' initrd from, /svr/boot folder (cant remember exac path).
You could also inspect /opt/porteus-scripts/pxe (cant remember exac name) script and check how initrd is generated on the fly with correct drivers inside.

Thanks

Re: load porteus 3.1 from tftp

Posted: 13 Dec 2015, 20:16
by Valerii
Thank you.