SliTaz SliTaz Forum

You are not logged in.

#1 2012-03-06 09:25:12

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

How to implement a new kernel parameter for live version to boot a pxe-server by default

I am the author of Omniboot (omniboot.at) and I have integrated Slitaz prominently on the first page of the main menu and beginning from the base-version as I offer a cd and dvd version too.

I consider Slitaz to be the most powerful distribution within OmniBoot, since it offers most functionality in the tiniest thinkable form.

Everything contained in the cd version of OmniBoot starts over PXE. Getting to know Slitaz I quickly realized that there was a great simplified server environment yet contained which would perfectly fit for my plan to allow OmniBoot via an integrated distro to be it's own PXE-Server.

My idea is to allow the OmniBoot-user to directly boot Slitaz with a specific kernel parameter so it starts the pxe-services by default, preferably without any x-desktop, just a "dumb" server.

I have unsquashed rootfs from RC1 and tried to understand all the logic. But I wasn't able to get near the solution. Usually I find some logic in the init-script which parses kernel-parameters, in Slitaz I wasn't able to find and understand how kernel-parameters were managed.

I am well aware of udhcpd.conf and inetd.conf to get the pxe-services going. I can slightly imagine how to cook a customized version but I would appreciate if it could be done with the same edition which also allows to boot the "normal" Slitaz desktop.

I think for those who develop this my idea shouldn't be too difficult to implement, but of course I am open to teachings about the contrary wink

edit: not unsquashed a cpio archive of course wink)

Offline

#2 2012-03-06 10:05:37

pankso
Administrator
Registered: 2026-06-27
Posts: 341
Website

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

Hi,

SliTaz boot with 4 scripts, most boot option are parsed via /etc/init.d/bootopts.sh but if you need earlier boot option just add them to the top of of rcS wich is the first exectuded scipt. Users can also add boot command into local.sh. If you want us to implement a pxe boot option, just send a patch :-)

http://hg.slitaz.org/slitaz-boot-scripts/file/tip/etc/init.d

Offline

#3 2012-03-06 10:11:30

bellard
Administrator
Registered: 2011-03-28
Posts: 657

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

SliTaz boot configuration looks like :

  kernel /path/to/bzImage

  initrd /path/to/rootfs some args

See http://mirror.slitaz.org/pxe/3.0/core-en.cfg

You can modify it to

  kernel /path/to/bzImage

  initrd /path/to/rootfs,/path/to/omniboot-rootfs some args omniboot extra args

Where mniboot-rootfs is a (lzma'd, gziped or notziped) cpio archive of :

  /etc/rcS.conf

  /etc/init.d/omniboot.sh

With omniboot.sh included in /etc/rcS.conf RUN_SCRIPTS variable. See http://hg.slitaz.org/slitaz-boot-scripts/file/tip/etc/rcS.conf#l45

For more information on pxe see:

http://boot.slitaz.org/ (start http://mirror.slitaz.org/pxe/pxelinux.cfg/vesadefault )

http://doc.slitaz.org/en:guides:pxe

Offline

#4 2012-03-06 10:13:21

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

Thanks folks! That's great input to work on. I will digg into it the next days and come back either with stupid questions or share my solution smile

Offline

#5 2012-03-06 16:51:33

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

It would have been too easy to be true, if I had found the solution by myself so far wink

As for now I decided to edit /etc/init.d/local.sh by adding

[c]

mkdir -p /tftpd/images

mkdir -p /tftpd/boot

mount /dev/disk/by-label/OMNIBOOT/boot/make/gpxe_root /tftpd

mount /dev/disk/by-label/OMNIBOOT/images /tftpd/images

mount /dev/disk/by-label/OMNIBOOT/boot /tftpd/boot

mount /dev/disk/by-label/OMNIBOOT/docu /var/www

inetd restart

udhcpd restart

[/c]

I also edited /etc/network.conf and /etc/udhcpd.conf but before I can find out if these latter edits work I need to get the mounting done and I fail. I tried with /media/OMNIBOOT but that also doesn't work during startup, but only after clicking on that drive in PCMan File Manager in the GUI. So I tried with the above version, but that never works at all.

Offline

#6 2012-03-07 07:50:19

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

I am still stuck finding out how to mount the device from which Slitaz/OmniBoot were booting. Sorry for bothering again, but maybe someone has at least a hint...

Offline

#7 2012-03-08 09:45:00

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

Now I found the binary /sbin/findfs. But if I try

findfs LABEL=OMNIBOOT

I get

findfs: Unable to resolve 'LABEL=OMNIBOOT'

I must add, that I need a solution which works both, for CD/DVD and for a USB boot.

Offline

#8 2012-03-08 16:16:54

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

OK, I found a solution now and like to share it here. I am sure that it could be done more elegant, but this his how I manage to get the pxe server automatically active, serving the boot-media (USB, HDD or CD) as pxe-root.

Within a workingfolder called omnibootfs I created directories /etc and /etc/init.d. I copied local.sh from rootfs4.gz to /etc/init.d and added this primitive code

[c]

mkdir /media/OMNIBOOT

mountob(){

mkdir /tftpd

mount /media/OMNIBOOT/boot/make/gpxe_root /tftpd

mkdir /tftpd/images

mkdir /tftpd/boot

mount /media/OMNIBOOT/images /tftpd/images

mount /media/OMNIBOOT/boot /tftpd/boot

mount /media/OMNIBOOT/docu /var/www

}

mount /dev/cdrom /media/OMNIBOOT

if [ -e /media/OMNIBOOT/autorun.inf ]; then

  mountob

  else

  mount /dev/disk/by-label/OMNIBOOT /media/OMNIBOOT

  if [ -e /media/OMNIBOOT/autorun.inf ]; then

    mountob

    else exit

  fi

fi

/etc/init.d/inetd start

/etc/init.d/udhcpd start

[/c]

I also copied inetd.conf, network.conf and udhcpd.conf to /etc and did the following edits:

in network.conf

[c]

DHCP="no"

STATIC="yes"

[/c]

in inetd.conf:

[c]

tftp    dgram    udp    wait    root    /usr/bin/tftpd    /usr/bin/tftpd -r /tftpd

[/c]

in udhcpd.conf

[c]

option rootpath /tftpd

boot_file gpxelinux.0

siaddr 192.168.0.2

siname slitaz

127.0.0.1

[/c]

With

find . | cpio --quiet --dereference -o -H newc | gzip -9 > ../omnibootfs.gz

I created the file which I was able to load as explained above by Bellard by just adding as in my used RC1 version all 4 different rootfs1-4 are mounted.

Basically it works now, I only encounter a very unexpected problem. My configuration files of syslinux and isolinux which work well on w2k-server pxe services don't here. Strangely gpxelinux.0 sees the Slitaz root and a path /boot in my config files will be searched from slitaz root and not from within /tftpd which should be the pxe-root. As a workaround I can create duplicate versions of those configs that are only active when called from pxe, because boot/somedir/someconfig works as a relative path towards where gpxelinux.0 seems to be aware to be at home. I hope my English is sufficiently clear as to make my problem understandable.

So my question would be, where is gpxelinux.0 now really told which folder should be treated as new root? Actually a booting client gets the bootfile and then subsequently needed configs (or syslinux-elements) need the full path from slitaz root or a relative path. Sadly this relative path fails again in isolinux/syslinux when booted from CD/DVD/USB...

Offline

#9 2012-03-08 20:45:46

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

In order to stop soliloquizing I now mark the thread as solved. Indeed as far as my question went it is anyway. Thanks a lot again for the deciding hints.

Offline

#10 2012-03-12 14:03:42

Don Manuel
Member
Registered: 2012-03-06
Posts: 13

Re: How to implement a new kernel parameter for live version to boot a pxe-server by default

See a working solution here, where I also pointed towards the busybox-bug causing the trouble in the end:

http://forum.slitaz.org/topic/tftpd-chroot-to-dir-not-merely-chdir

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 1.56 MiB (Peak: 1.77 MiB) ]