Remote boot/install of OpenWrt

If you provide your rootfs as nfs from a server than yes...
But your second post tells me that you want to use a initram files system that you also provide over tftp.

I'm simply exploring the possibility of booting OpenWrt via PXE and am not sure if it's possible using what is currently available. I know the kernel will load using vmlinuz, but am unsure about what to put in the initrd line particularly the "root=" parameter.

At the moment I'm using 15.05 because my test machine won't boot an x86/64 version of OpenWrt.
Not sure which of the files in https://archive.openwrt.org/chaos_calmer/15.05.1/x86/generic/ I should use for initrd and what parameters are available. I do have Clonezilla, Arch Linux and System Rescue CD booting over PXE but finding the correct parameters was not easy.

I think all of your current running things as clonezilla, arch linux and rescure cd did all use a temporary root filesystem in ram and do not store anything permanent, right?

For openwrt there is no initram image build by default, but you could build one with the build system as mentioned above...

If you use nfs as root filesystem, you have to setup nfs on a server, use the rootfs tar file from the openwrt downloads, extract this on your nfs server and provide some more options as ip address ad path in addition to root=/dev/nfs.

Clonezilla uses fetch=http://IP/.../../filesyste.squashfs
SystemRescueCD uses netboot=http://IP/../../sysrcd.dat
ArchLinux uses archiso_nfs_srv=IP:/../../arch

I have extracted Generic-rootfs.tar.gz to IP:/mnt/tftproot/pxe/images/OpenWrt/rootfs

Am I correct in thinking I should use something like root=IP:mnt/tftproot/pxe/images/OpenWrt/rootfs ?

fetch, netboot and archiso_nfs_srv are no features of the linux kernel...
This cmdline params are used and parsed by the used initram file system and are specific to this.

nfs is not tftp!
install/setup a nfs file server and to use nfs as rootfs you should set something like this in cmdline:
ip=dhcp root=/dev/nfs nfsroot=<nfs server IP>:/path/to/nfsroot

And your kernel should be build with CONFIG_ROOT_NFS=y, don´t know if this is enabled on openwrt x86 by default.

I get 'Cannot open root device "nfs" so I guess this option is not enabled,. I suppose I need to figure out how to build it...

Yep.

Depending on what you want to do with your net booted openwrt, it could be sufficent to use a build with appended initram image...

But if you need persistence without a local disk, you will have to go the nfs way...

I just want to be able to learn how to use it without having to have a dedicated system for OpenWrt.

I've assembled a build system on Debian and have run menu makeconfig and am confronted with a bewildering number of options :confused:

I want a very basic i386 x86 system which supports e1000e ssh and is capable of booting from a network with rootfs in ram or on nfs. The options are quite intimidating for a newbie....

For a image with appended initram fs:

  • make menuconfig
  • Select "Target System" -> x86
  • Select "Target Images" -> ramdisk
  • Save and build

For a kernel with nfs support:

  • Configure with make menuconfig for x86 and save...
  • Then with make kernel_menuconfig enable nfs root
    File systems -> Network File Systems -> Root file system on NFS

This will build a minimal openwrt kernel and root file system, if you need more, simply enable it in make menuconfig.
You will learn a lot if you play with openwrt´s build system...

Unsurprisingly (to me...) the build failed. Every time I start, do I get a new config? I don't want to accumulate mistakes.

After deleting .config and setting those two options, I ran make and got a make error.
After re-running with -j1 V=s it failed again.... it's probably because |'m running as root.

Trying again as non-root gets much further

You should do that as unprivileged user...

If you build with multiple threads "-j4" you need to download the source code once with make download before you build with make -j4

After several hours it appears to have finished withou any error msgs... I guess I'll use "-j4" next time :), but how do I tell what what it's made and where should I look?

Don´t understand the question sorry...
Do you mean where are the build images?

The images normally in bin/target/x86/generic.

Here you should have a images with initram in his name. This is the kernel with appended rootfs as initram fs. No need to define initrd in cmdline.

If you try the nfs way, then you will have here a kernel image and a rootfs tar... The kernel image and the rootfs should be the same as you have downloaded, but with nfs support.

I have it now. The images produced were:

combined-ext4
combined-squashfs
generic-rootfs
ramfs.bzimage
rootfs-ext4
rootfs-squashfs
vmlinuz

so my PXE entry should only consist of a kernel line?

Should it be ramfs.bzimage ?

It works!!!! Thanks for all the help.

One slight problem is that I have an x64 image which won't load on my ThinkPad T60. Can i rebuid for i386?

Also how to include support for e1000e?

Sorry, my fault... There is no combined kernel initram image build. They are separate images vmlinuz and ramfs.bzimage.

Are you sure? the generic should be the x86 version....
The x64 version is normally in bin/target/x86/64

In make menuconfig you have selected Target System (x86) and the option below Subtarget (Generic) and not Subtarget (x86_64)?

I only made the two selections you mentioned. Maybe the x86_64 was a default. In any case on boot (on my T60) it says I need a kernel appropriate for my CPU..

I will build it again, this time using '-j4'.

How do i confirm that I'm not building x86_64? Is there something in .config?

The generic is the default...
Your .config should include

CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_generic=y

and not

CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y

What is your cpu model? Core2Duo?
If yes it should support the x86_64 instruction set.

I have x_86_generic=y

The CPU is very old - has only 1 core and does not support x86_64 code, yet the built img appears to be for x86_64 since my PC complains that the kernel is inappropriate for the CPU.

When an img is built is it possible to tell using a hex viewer if it is for x86_64?

I think this would be possible, but i don´t know how... Search with google...

What is your cpu model?