Remote boot/install of OpenWrt

How would I go about installing or booting OpenWrt from a remote (PXE) server?

Traget/device?

For uboot the commands depend on the available commands....
There is dhcp which does requests all info from a dhcp server, than tftpboot which requires at least a image name and serverip.
Finally you boot the image with the bootm command...

On x86 with a bios it depends on bootrom capability of ethernet hw and/or bios/(u)efi.

Please give us more info!

1 Like

I want to boot an x86 version, I have PXE server from which I can boot various Unix versions....

Basically I just need a kernel and an initrd line....

I have

kernel images/OpenWrt/openwrt-x86-generic-vmlinuz
append initrd=images/OpenWrt/openwrt-x86-generic-rootfs-squashfs.img console=ttys0,115200 root=/dev/ram0

This gets as far as:-

Decompressing Linux....
Booting the kernel.

And it stops at this point

@juppin Tftpbooting OpenWrt didn't had time to retest it on normal pxe, but I remember ipxe was working

This isn't a initramfs image...

Are you sure ttyS0 is the right console?
I think you want get output on your monitor.

All in all, i think you doesn't see anything because the kernel log will be printed on your serial line (if available) and then kernel does panic because you haven't provided a valid initrd image.

Enable the build of an initram image in menuconfig.
If you haven't build the images yourself you could also extract the squashfs image or use openwrt-x86-generic-generic-rootfs.tar.gz to build a initram image with the cpio tool...

I was only guessing with those parameters....it's what someone suggested so I gave it a try, but I was pleased to see the 'Decompressing Linux....' msg which meant I was going in the right direction.

I'm very new to OpenWrt so don't understand much of the last paragraph... Don't know what you mean by 'menuconfig'...

first, try to remove this

https://openwrt.org/docs/guide-developer/start

Removing console line makes a big difference - booting gets as far as

Kernel panic -not syncing: VFS: Unable to root fs on unknown-block(0,0)

ok, so as @juppin suggested, git clone the sources, read about it
usually after you install the dependencies, you run make menuconfig and select x86 target, select x86_64 subtarget if you need 64bit, from target images select ramdisk, maybe select a compression method for it and also you could uncheck GZip images
of course you can select other needed packages from the menu
save and then
make -j4

If you run this the first time you need to download the sources with make download before you build it multithreaded...

Or all in one (download and build with 4 threads):

make download world -j4

Can I run git clone on OpenWrt? And which sources do I use?

git clone https://github.com/openwrt/openwrt.git

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem

I got the problem reported here:-

Could work out from the answer what was required....

I ran the command mentioned on OpenWrt (18.06 RC1).

You want to build OpenWRT on OpenWRT?

I hope x86 machine with at least 2 GB ram?

Take a look here to ensure you have all packages installed...

I have 4GB. The linked to page has command line examples for installing the toolchain for 13 flavours of Linux, but excludes OpenWrt! Doing it manually is going to take some time...

I'm probably better of installing it on the Arch Linux partition I'm creating in my free disk space. How much space do I need?

For sure this will be much better...

My current source folder with also compiled stuff inside has 12 GB... So 20 GB should be sufficient.

I had partitioned the disk only leaving 5GB, so I'll have to shrink the OpenWrt partition... Not sure if OpenWrt will be usable afterwards. What's the best way to save and restore the partition if all goes titz up?

Moving on...

Following the instructions here https://openwrt.org/docs/guide-developer/quickstart-build-images

git clone https://git.openwrt.org/openwrt/openwrt.git/
cd openwrt

./scripts/feeds update -a
./scripts/feeds install -a

make menuconfig

both feeds created numerous 'Permission denied' msgs but successfully installed all the packages from packages, luci, routing, telephony.

make menuconfig also created numerous 'Permission denied' msgs but ended up with:-

make: *** [/root/openwrt/include/toplevel:mk:89: preprare-tmpinfo] Error 1

This is running as root on Arch Linux.

Any advice?

don't run it as root !
make a user and redo the steps

Looking at netbooting other systems such as Debian

https://www.linuxquestions.org/questions/blog/isaackuo-112178/diskless-pxe-netboot-how-to-for-debian-8-jessie-37169/

it looks as though I should be setting root=/dev/nfs rather than /dev/ram0...