hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Diskless booting Zeroes from Windows

Mon Sep 24, 2018 10:17 pm

Can anyone tell me what the state of play is regarding diskless booting a Pi Zero from Windows ? And has anyone got a How To or a link to that. I searched but haven't found anything

Striding into the unknown I've tried rpiboot on Windows 7 and that mostly worked ...

Code: Select all

C:\Program Files (x86)\Raspberry Pi>rpiboot -v
Waiting for BCM2835/6/7
Device located successfully
Initialised device correctly
Found serial number 0
Sending bootcode.bin
libusb_bulk_transfer returned 0
Writing 50216 bytes
libusb_bulk_transfer returned 0
Successful read 4 bytes
Waiting for BCM2835/6/7
Device located successfully
Initialised device correctly
Found serial number 1
Second stage boot server
Received message GetFileSize: autoboot.txt
Cannot open file autoboot.txt
Received message GetFileSize: config.txt
Cannot open file config.txt
Received message GetFileSize: recovery.elf
Cannot open file recovery.elf
Received message GetFileSize: start.elf
File size = 433616 bytes
Received message ReadFile: start.elf
File read: start.elf
libusb_bulk_transfer returned 0
Received message GetFileSize: fixup.dat
Cannot open file fixup.dat
libusb: warning [winusbx_submit_control_transfer] ControlTransfer failed: [22] The device does not recognize the command.
Second stage boot server done

C:\Program Files (x86)\Raspberry Pi>
It seemed to have loaded bootcode.bin and has run that so, if I was into GPU Bare Metal, I would probably be okay, but not sure if it has transferred start.elf and I really want to get it to a point where it would at least read a kernel.img and execute that. Bare Metal Ultibo I could live with.

I'm guessing "ControlTransfer failed:" means something went wrong, that the Zero didn't understand the MSD start.elf which is delivered to a CM, or is requiring eMMC which it doesn't have.

Any help or hints appreciated.

ghans
Posts: 7807
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Diskless booting Zeroes from Windows

Tue Sep 25, 2018 4:42 pm

No, the Pi Zero can boot as "USB client" while an USB host runs the "rpiboot" tool. Both devices must be physically connected via USB and a special bootcode.bin and start.elf are sent over the wire with the "rpiboot" tool to boot the Pi.

@hippy
Why don't you add fixup.dat to the files in to be sent via rpiboot ? I suppose start.elf/bootcode.bin are located in the same folder as rpiboot anyway ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Tue Sep 25, 2018 5:23 pm

ghans wrote:
Tue Sep 25, 2018 4:42 pm
No, the Pi Zero can boot as "USB client" while an USB host runs the "rpiboot" tool. Both devices must be physically connected via USB and a special bootcode.bin and start.elf are sent over the wire with the "rpiboot" tool to boot the Pi.
I thought that's what I was doing, albeit trying to run code intended for a CM on a Zero.

I was expecting the Zero to be a gadget when turned on, "2708 Boot/2710 Boot", and still be an MSD gadget once rpiboot had done its thing. That seems to be the way it is when the same is done on Linux.

I was hoping that once I'd got that working I could then explore not creating an MSD gadget but booting something else. It seems to work as far as getting bootcode.bin in, and start.elf but then keels over.
ghans wrote:
Tue Sep 25, 2018 4:42 pm
Why don't you add fixup.dat to the files in to be sent via rpiboot ? I suppose start.elf/bootcode.bin are located in the same folder as rpiboot anyway ?
I was just using the bootcode.bin and start.elf provided in the msd sub-directory which doesn't include anything else.

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Tue Sep 25, 2018 8:00 pm

Some success at last, and a bit of a D'Oh! moment.

Turns out the blank 4GB SD Card in the Zero wasn't fully seated. Once pushed in hard enough, rpiboot does its stuff, still gives the ControlTransfer failed message, but the Zero does switch to becoming an MSD gadget, VID_0A5C/PID_0001, "RPi-MSD- 0001", "Compute Module", and appears as a removable disk drive under Windows 7 and XP.

So I guess that's "everything working as it should, as expected".

The next step is to get a bootcode.bin which just flashes a LED so I can see what happens with that and tick that off the list.

Then on to trying to find a start.elf and whatever else is needed to boot a kernel.img. I guess the route to that is through the gpio-expander project, seeing how they get their buildroot image uploaded.

Update: skipped the bootcode.bin test, straight into booting gpio-expander ...

Code: Select all


C:\Program Files (x86)\Raspberry Pi>rpiboot -v -d bootgpio
Waiting for BCM2835/6/7
Device located successfully
Initialised device correctly
Found serial number 0
Sending bootcode.bin
libusb_bulk_transfer returned 0
Writing 51992 bytes
libusb_bulk_transfer returned 0
Successful read 4 bytes
Waiting for BCM2835/6/7
Device located successfully
Initialised device correctly
Found serial number 1
Second stage boot server
Received message GetFileSize: autoboot.txt
Cannot open file autoboot.txt
Received message GetFileSize: config.txt
File size = 77 bytes
Received message ReadFile: config.txt
File read: config.txt
libusb_bulk_transfer returned 0
Received message GetFileSize: recovery.elf
Cannot open file recovery.elf
Received message GetFileSize: start.elf
File size = 2855972 bytes
Received message ReadFile: start.elf
File read: start.elf
libusb_bulk_transfer returned 0
Received message GetFileSize: fixup.dat
File size = 6669 bytes
Received message ReadFile: fixup.dat
File read: fixup.dat
libusb_bulk_transfer returned 0
Received message GetFileSize: recovery.elf
Cannot open file recovery.elf
Received message GetFileSize: config.txt
File size = 77 bytes
Received message ReadFile: config.txt
File read: config.txt
libusb_bulk_transfer returned 0
Received message GetFileSize: dt-blob.bin
Cannot open file dt-blob.bin
Received message GetFileSize: recovery.elf
Cannot open file recovery.elf
Received message GetFileSize: config.txt
File size = 77 bytes
Received message ReadFile: config.txt
File read: config.txt
libusb_bulk_transfer returned 0
Received message GetFileSize: bootcfg.txt
Cannot open file bootcfg.txt
Received message GetFileSize: cmdline.txt
File size = 0 bytes
Received message GetFileSize: kernel.img
File size = 2664616 bytes
Received message GetFileSize: armstub.bin
Cannot open file armstub.bin
Received message GetFileSize: kernel.img
File size = 2664616 bytes
Received message ReadFile: kernel.img
File read: kernel.img
libusb_bulk_transfer returned 0
Received message GetFileSize: gpioexpand.img
File size = 788136 bytes
Received message ReadFile: gpioexpand.img
File read: gpioexpand.img
libusb_bulk_transfer returned 0
Received message GetFileSize: bcm2708-rpi-0-w.dtb
File size = 14778 bytes
Received message ReadFile: bcm2708-rpi-0-w.dtb
File read: bcm2708-rpi-0-w.dtb
libusb_bulk_transfer returned 0
Received message GetFileSize: config.txt
File size = 77 bytes
Received message ReadFile: config.txt
File read: config.txt
libusb_bulk_transfer returned 0
Received message GetFileSize: overlays/dwc2.dtbo
File size = 908 bytes
Received message ReadFile: overlays/dwc2.dtbo
File read: overlays/dwc2.dtbo
libusb_bulk_transfer returned 0
Received message Done: overlays/dwc2.dtbo
Second stage boot server done

C:\Program Files (x86)\Raspberry Pi>
And that seems to have worked. Win 7 recognised a "USB composite Device" appearing and marked that "Ready to use", but failed to find drivers for "CDC Serial" and "CDC ECM".

Still, like eating a whole elephant; one bite at a time.

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Tue Sep 25, 2018 11:44 pm

Yay! After hacking around with Intel's Android USB Drivers, Virtual Serial Port access to gpio-expander booted entirely from Windows ...
bootgpio.JPG
bootgpio.JPG (28.59 KiB) Viewed 1549 times

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Wed Sep 26, 2018 5:58 pm

Slowly getting there. Everything works on Win 10, even identifies the CDC Serial device gpio-expander creates, assigns a driver and gives it a COM port, so one can login to the buildroot environment which is up and running. No luck with a CDC ECM driver, though I haven't really pursued that side of things.

Got a Ultibo bare metal program running. Simply copied the gpio-expander files into another directory, dropped the Ultibo generated kernel.img into that, ran rpiboot -d on that directory and, voila!, my Pi attached HDMI Monitor is showing what it's meant to. I guess any other bare metal kernel.img will boot in the same way.

It's loading files which I don't believe are needed so things need tweaking but we're on the way.

Still some hurdles to overcome; finding CDC ECM drivers, getting an rpiboot compiled for Windows which can boot multiple Pi's on different USB ports, and maybe figuring out buildroot and how to get something other than msd or gpio-expander running on those.

ejolson
Posts: 2046
Joined: Tue Mar 18, 2014 11:47 am

Re: Diskless booting Zeroes from Windows

Fri Sep 28, 2018 4:54 am

hippy wrote:
Wed Sep 26, 2018 5:58 pm
Slowly getting there. Everything works on Win 10, even identifies the CDC Serial device gpio-expander creates, assigns a driver and gives it a COM port, so one can login to the buildroot environment which is up and running. No luck with a CDC ECM driver, though I haven't really pursued that side of things.

Got a Ultibo bare metal program running. Simply copied the gpio-expander files into another directory, dropped the Ultibo generated kernel.img into that, ran rpiboot -d on that directory and, voila!, my Pi attached HDMI Monitor is showing what it's meant to. I guess any other bare metal kernel.img will boot in the same way.

It's loading files which I don't believe are needed so things need tweaking but we're on the way.

Still some hurdles to overcome; finding CDC ECM drivers, getting an rpiboot compiled for Windows which can boot multiple Pi's on different USB ports, and maybe figuring out buildroot and how to get something other than msd or gpio-expander running on those.
When the host is another Pi it is possible to boot Raspbian diskless on a Pi Zero with the root filesystem mounted using NFS over the USB Ethernet gadget. An example of configuring such a system is described in this thread entitled a Super-cheap Computing Cluster for Learning. Note that you don't need to use buildroot. Instead copy the root filesystem from any current Raspbian SD Card.

Lack of a free and functional NFS server means that the same technique can't work when the host is Windows 10. For an alternative it should be possible to use iSCSI. From what I understand, StarWind provides a free iSCSI target hosted on Windows for student home use. Therefore, one suggestion is to boot Raspbian on a diskless Zero with the root filesystem mounted from an iSCSI target hosted on a Windows machine connected through the USB Ethernet gadget.

mic_s
Posts: 79
Joined: Sun Oct 26, 2014 4:15 pm

Re: Diskless booting Zeroes from Windows

Fri Sep 28, 2018 9:53 pm

Not exactly what this thread is about … but iff anyone is interested in running or booting raspbian on a pi zero WITHOUT an sd-card :

https://dev.webonomic.nl/how-to-run-or- ... an-sd-card

may be of interest (read the comments therein).
.

ejolson
Posts: 2046
Joined: Tue Mar 18, 2014 11:47 am

Re: Diskless booting Zeroes from Windows

Sat Sep 29, 2018 3:58 am

mic_s wrote:
Fri Sep 28, 2018 9:53 pm
iff anyone is interested in running or booting raspbian on a pi zero WITHOUT an sd-card
As that blog doesn't mention the thread about super-cheap clusters of Pi Zeros, he must have developed the same technique independently. While that technique doesn't work when Windows is the host due to lack of a suitable NFS server, mounting the root filesystem using iSCSI is an alternative.

It would be nice if someone created a Windows install wizard that automatically set things up so an SD-card-less Pi would automatically boot to Raspbian when plugged in using a USB cable.

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Sun Sep 30, 2018 4:41 pm

That was one of the useful links which I had found which helped me get as far as I have, but thanks for reminding me of it, because I'd forgotten which of those links held the information I am starting to become in need of!

The main difficulty of standing on other shoulders to help move things forward is everyone who has done it seems to have used Linux. That leaves Windows as the second class cousin, supported solely for flashing Compute Modules.

What works for Linux often doesn't work half as well on Windows. All diskless full-Raspbian boot solutions I have seen require NFS drivers and even the GPIO Expander seems to have gone out of its way to make its use with Windows extremely difficult, by way of using CDC ACM, CDC ECM and IPv6.

Still; what's done for Linux does give a good indication of what needs to be done for Windows so it is all useful stuff.
ejolson wrote:
Sat Sep 29, 2018 3:58 am
It would be nice if someone created a Windows install wizard that automatically set things up so an SD-card-less Pi would automatically boot to Raspbian when plugged in using a USB cable.
That should be possible, and perhaps not too hard to do. A Windows App, running in the system tray, can check the USB system for the presence of a "2708 Boot" device, and then invoke rpiboot.exe, and that's just about it.

It should be possibly to rewrite rpiboot in Python or a more Windows friendly language to help with that, but just calling the provided rpiboot would work for now.

The harder part is setting up what needs to be put out to actually boot the Pi, setting it up in such a way that the Pi and PC can communicate as necessary once the initial boot phase has completed.

We could already auto-boot Bare Metal bootcode.bin, Bare Metal Ultibo and other kernel.img, code, but full-Raspbian or other OS's requires refactoring what's done for Linux into something which will work with Windows and actually implementing it.

I was initially surprised so little appears to have been done or achieved in that direction. On reflection I suspect it's because Windows and Linux advocates are poles apart and it requires knowledge mostly held by those who have little interest in Windows, have little desire to see it working on Windows, are reluctant or adverse to helping achieve that.

That's understandable. To disklessly boot full-Raspbian over USB one currently has to use Linux and there's little reason Linux advocates would want to see that change. Some are quite happy there is that 'Linux lock-in' and don't want to lose or dilute that. It's the same resistance we see to booting a full Windows desktop on a Pi; they'd rather discourage that than encourage or help with that.

I think that even so, it's only a matter of time.

ejolson
Posts: 2046
Joined: Tue Mar 18, 2014 11:47 am

Re: Diskless booting Zeroes from Windows

Sun Sep 30, 2018 11:24 pm

hippy wrote:
Sun Sep 30, 2018 4:41 pm
That's understandable. To disklessly boot full-Raspbian over USB one currently has to use Linux and there's little reason Linux advocates would want to see that change. Some are quite happy there is that 'Linux lock-in' and don't want to lose or dilute that. It's the same resistance we see to booting a full Windows desktop on a Pi; they'd rather discourage that than encourage or help with that.
I think the difficulties in booting a full Windows desktop on the Pi and in using Windows 10 as a server both come from marketing decisions within Microsoft.

As far as I know there is no Windows NFS server that implements the semantics necessary to host a Raspbian root filesystem. However, I'm pretty sure that Raspbian could be put on an iSCSI target. Unfortunately, the only Windows computer I own runs Vista and is currently in a box. At the same time, there are a number of tutorials for placing the Raspbian root filesystem on iSCSI which should work when booting a diskless Zero over USB.

mikerr
Posts: 2730
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Diskless booting Zeroes from Windows

Mon Oct 01, 2018 9:42 am

OK, documenting steps as I play:

1. Download & install the rpiboot-setup:

https://github.com/raspberrypi/usbboot/ ... _setup.exe

This installs:
- a USB driver for the Pi
- rpiboot.exe
- an MSD folder containing boot files bootcode.bin, start.elf

2. Run rpiboot

Code: Select all

c:\Program Files (x86)\Raspberry Pi>rpiboot.exe
Waiting for BCM2835/6/7
Now plug in pi (needs blank SD installed for default MSD image) , and you will see the files sent over and a drive letter appear:

Code: Select all

Waiting for BCM2835/6/7
Sending bootcode.bin
Successful read 4 bytes
Waiting for BCM2835/6/7
Second stage boot server
File read: start.elf
Second stage boot server done
3. Lets look deeper into rpiboot:

Code: Select all

c:\Program Files (x86)\Raspberry Pi>rpiboot ?
Usage: rpiboot
   or: rpiboot -d [directory]
Boot a Raspberry Pi in device mode either directly into a mass storage device
or provide a set of boot files in a directory from which to boot.  This can
then contain a initramfs to boot through to linux kernel

rpiboot                  : Boot the device into mass storage device
rpiboot -d [directory]   : Boot the device using the boot files in 'directory'
Further options:
        -l               : Loop forever
        -v               : Verbose
        -s               : Signed using bootsig.bin
        -h               : This help
By default it's equivalent to running rpiboot.exe -d MSD.
The MSD folder contains boot files to read the attached microSD or MMC and show up as a drive letter in windows
(MSD = Mass Storage Device)

As a quick display test, point it at a NOOBS folder:

Code: Select all

c:\Program Files (x86)\Raspberry Pi>rpiboot -d d:\pi\NOOBS_lite_v2_8
Waiting for BCM2835/6/7
Sending bootcode.bin
Failed : 0x0Waiting for BCM2835/6/7
Second stage boot server
File read: recovery.elf
File read: recovery.cmdline
File read: recovery.img
File read: recovery.rfs
File read: bcm2708-rpi-0-w.dtb
Second stage boot server done
and up pops the rainbow screen on the pi HDMI screen
after a few seconds pause at recovery.rfs it moves to the NOOBS start screen and partitions the SD card if inserted
but then unsurprisingly complains it cant find the drive with the rest of the NOOBS files

Success for a quick test anyway!
Android app - Raspi Card Imager - download and image SD cards - No PC required !

ejolson
Posts: 2046
Joined: Tue Mar 18, 2014 11:47 am

Re: Diskless booting Zeroes from Windows

Mon Oct 01, 2018 4:55 pm

mikerr wrote:
Mon Oct 01, 2018 9:42 am
Success for a quick test anyway!
That's an interesting report.

With a custom initial RAM filesystem you should be able to mount root from an iSCSI target hosted on a Windows machine. Alternatively, it looks like a NBD network block device may also work. NBD is a simpler protocol than iSCSI and there seem to be open source C and Java based servers that can run on Windows.

mikerr
Posts: 2730
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Diskless booting Zeroes from Windows

Tue Oct 02, 2018 10:36 am

Continuing in a "document as I go" fashion:

Using GPIO-expander

Download & extract the zip file:
https://github.com/raspberrypi/usbbootg ... master.zip

Point rpiboot at the extracted folder:

Code: Select all

rpiboot.exe -d d:\pi\usbbootgui-master\gpioexpander\output
Waiting for BCM2835/6/7
Sending bootcode.bin
The pi attached HDMI screen usefully shows address info:
Image

and windows 10 loads a COM port
I can connect to it via a terminal ( login: root / raspberry) using e.g. putty

The lack of CDC ECM drivers are still a problem...
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
thagrol
Posts: 881
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Diskless booting Zeroes from Windows

Tue Oct 02, 2018 12:12 pm

I don't know if this is relevant, and I don't have any documenmtation of this, but when I've been working with using the zero as a USB gadget with windows, windows has most trouble when the zero preesent as a composite device rather than as a single device.

It would appear that the gpio expander is doing this.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Tue Oct 02, 2018 3:26 pm

mikerr wrote:
Tue Oct 02, 2018 10:36 am
Continuing in a "document as I go" fashion:
Many thanks for your participation and detailing the steps rather better than I did. And thanks for the screenshot. I didn't have a spare monitor to hand when I was experimenting.
mikerr wrote:
Tue Oct 02, 2018 10:36 am
The lack of CDC ECM drivers are still a problem...
That seems to be the main one.
thagrol wrote:
Tue Oct 02, 2018 12:12 pm
when I've been working with using the zero as a USB gadget with windows, windows has most trouble when the zero preesent as a composite device rather than as a single device.

It would appear that the gpio expander is doing this.
That is correct gpio-expander presents itself as a composite device with CDC ACM and CDC ECM. However, Windows 7 and 10 are perfectly fine handling the composite part for me. Win 10 finds a driver for CDC ACM and automatically creates a COM port, but one has to be manually installed for Win 7; Intel's Android USB Drivers is what I used.

If we had CDC ECM drivers I would expect it all just to work. However those appear to be non-existent. Looking for them has been fruitless and it's dangerous territory as many sites claiming to offer drivers seem solely intended to deliver malware. Take care.

The logical next step would be to fork gpio-expander, adjust that so it doesn't use CDC ECM but something Windows does have drivers for, see how that goes -

https://github.com/raspberrypi/gpioexpander/wiki

The problem is that's all buildroot, initramfs and Linux driver stuff which is currently beyond my experience level. We really need Linux expert help to get it to work with Windows.

./gpioexpand/package/rpi-firmware-custom seems to be the directory where the magic happens. It's so far not clear if the custom firmware is open source or closed source, whether the use of CDC ECM is set within that or elsewhere.

Anyway, I've cloned the gpio-expander to my Pi 3B and set about building it. We'll see what happens.

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Tue Oct 02, 2018 3:54 pm

hippy wrote:
Tue Oct 02, 2018 3:26 pm
Anyway, I've cloned the gpio-expander to my Pi 3B and set about building it. We'll see what happens.
And, as if to confirm that nothing is ever easy, that 'nothing ever works as expected or described when related to Linux', that everything is merely an exercise in frustration and futility, which ultimately has people complaining it's a steaming pile, a waste of time and money ...

Code: Select all

tmp-divrem_1.s: Assembler messages:
tmp-divrem_1.s:129: Error: selected processor does not support `mls r1,r4,r8,r11' in ARM mode
tmp-divrem_1.s:145: Error: selected processor does not support `mls r1,r4,r8,r11' in ARM mode
tmp-divrem_1.s:158: Error: selected processor does not support `mls r1,r4,r8,r11' in ARM mode
tmp-divrem_1.s:175: Error: selected processor does not support `mls r1,r4,r3,r8' in ARM mode
tmp-divrem_1.s:209: Error: selected processor does not support `mls r11,r4,r12,r3' in ARM mode
Makefile:768: recipe for target 'divrem_1.lo' failed
make[3]: *** [divrem_1.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_fib2_ui -I/home/pi/gpioexpander/buildroot-2017.02/output/host/usr/include -O2 -I/home/pi/gpioexpander/buildroot-2017.02/output/host/usr/include -c fib2_ui.c  -fPIC -DPIC -o .libs/fib2_ui.o
make[3]: Leaving directory '/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gmp-6.1.2/mpn'
Makefile:956: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gmp-6.1.2'
Makefile:775: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gmp-6.1.2'
package/pkg-generic.mk:216: recipe for target '/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gmp-6.1.2/.stamp_built' failed
make: *** [/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gmp-6.1.2/.stamp_built] Error 2
make: Leaving directory '/home/pi/gpioexpander/buildroot-2017.02'
cp: cannot stat 'buildroot-2017.02/output/images/rootfs.cpio.gz': No such file or directory
cp: cannot stat 'buildroot-2017.02/output/images/zImage': No such file or directory
cp: cannot stat 'buildroot-2017.02/output/images/rpi-firmware/*.elf': No such file or directory
cp: cannot stat 'buildroot-2017.02/output/images/rpi-firmware/*.dat': No such file or directory
cp: cannot stat 'buildroot-2017.02/output/images/rpi-firmware/bootcode.bin': No such file or directory
cp: cannot stat 'buildroot-2017.02/output/images/*.dtb': No such file or directory
mv: cannot stat 'output/dwc2-overlay.dtb': No such file or directory

Build complete. Files are in output folder.

[email protected]:~/gpioexpander $
Not for the first time I've had to ask; any ideas ?

ejolson
Posts: 2046
Joined: Tue Mar 18, 2014 11:47 am

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 4:55 am

thagrol wrote:
Tue Oct 02, 2018 12:12 pm
It would appear that the gpio expander is doing this.
I thought the GPIO expander simply communicated over the Ethernet gadget.

fruitoftheloom
Posts: 17676
Joined: Tue Mar 25, 2014 12:40 pm

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 7:53 am

ejolson wrote:
Thu Oct 04, 2018 4:55 am
thagrol wrote:
Tue Oct 02, 2018 12:12 pm
It would appear that the gpio expander is doing this.
I thought the GPIO expander simply communicated over the Ethernet gadget.

Yes Ethernet IPv6:

https://bennuttall.com/raspberry-pi-zero-gpio-expander/
Adieu

mikerr
Posts: 2730
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 9:06 am

There are a few different ways of exposing the ethernet gadget to the client OS:

RNDIS, CDC ECM or CDC EEM

The problem is one of linux / MAC / PC support.

RNDIS = Windows only, driver auto loads.
CDC ECM = Linux and MAC, but no windows driver (though 3rd party devices seem to use it)
CDD EEM = Linux only ?

if you setup g_ether/multi on a SD booted pi, it uses RNDIS and so works fine on windows,
gpio extender uses CDC ECM, the fix would be modifying it to use RNDIS in addition
Android app - Raspi Card Imager - download and image SD cards - No PC required !

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 9:47 am

ejolson wrote:
Thu Oct 04, 2018 4:55 am
thagrol wrote:
Tue Oct 02, 2018 12:12 pm
It would appear that the gpio expander is doing this.
I thought the GPIO expander simply communicated over the Ethernet gadget.
It also exposes a login / command shell through a virtual serial port primarily for debugging purposes.
mikerr wrote:
Thu Oct 04, 2018 9:06 am
There are a few different ways of exposing the ethernet gadget to the client OS:

RNDIS, CDC ECM or CDC EEM

The problem is one of linux / MAC / PC support.
The solution could be to provide a composite driver which provides all three. Let the PC use those it has drivers for and ignore the ones for which it doesn't. That will create multiple network interfaces on the PC and Pi but that shouldn't be a major problem.

Digging further, and reading more detail, rather than rushing forward; it seems that it should actually be reasonably easy to alter what is in the composite device, therefore reasonably easy to alter that according to what it's being booted from.

A reworked rpiboot could adjust config.txt or cmdline.txt on the fly to specify the OS being used and a modified gpioexpander or anything else could make use of that to create the appropriate composite device.

Unfortunately, without being able to build gpioexander, it's not going to be possible for me to modify that, which has brought moving forward to a standstill :(

mikerr
Posts: 2730
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 2:50 pm

hippy wrote:
Thu Oct 04, 2018 9:47 am
Unfortunately, without being able to build gpioexander, it's not going to be possible for me to modify that, which has brought moving forward to a standstill :(
I got a bit further, but I think this is an out of memory problem (on pi3):

Code: Select all

../../gcc/defaults.h:126:24: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
       fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",  \
                        ^
Makefile:2154: recipe for target 's-attrtab' failed
make[3]: *** [s-attrtab] Killed
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/pi/gpioexpander/buildroot-2017.02/output/build/host-gcc-final-5.4.0/build/gcc'
Makefile:4097: recipe for target 'all-gcc' failed
make[2]: *** [all-gcc] Error 2
Android app - Raspi Card Imager - download and image SD cards - No PC required !

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 4:10 pm

mikerr wrote:
Thu Oct 04, 2018 2:50 pm
I think this is an out of memory problem (on pi3):
Could be. The error reporting is about as useful as Windows' "Something went wrong".

I guess this is one of those cases where the Pi isn't a replacement for a 'real computer' [sic].

Luckily 64-bit Windows 10 supports Windows Subsystem for Linux (WSL) which runs a native Ubuntu installation under Windows. I have set it building using that and it seems to be progressing. No idea how far along it is so I guess I'll have to wait and see.

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 7:47 pm

Well,four hours in and it all looked like it was going swimmingly, the finishing line might even have been in sight, and then it imploded -

Code: Select all

>>>   Copying overlay /home/me/gpioexpander/gpioexpand/board/overlay/
>>>   Generating root filesystem image rootfs.cpio
if [ ! -e /home/me/gpioexpander/buildroot-2017.02/output/target/init ]; then /usr/bin/install -m 0755 fs/cpio/init /home/me/gpioexpander/buildroot-2017.02/output/target/init; fi
rm -f /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
rm -f /home/me/gpioexpander/buildroot-2017.02/output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
rm -f /home/me/gpioexpander/buildroot-2017.02/output/build/_users_table.txt
echo '#!/bin/sh' > /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
echo "set -e" >> /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
echo "chown -h -R 0:0 /home/me/gpioexpander/buildroot-2017.02/output/target" >> /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
printf '   \n' >> /home/me/gpioexpander/buildroot-2017.02/output/build/_users_table.txt
PATH="/home/me/gpioexpander/buildroot-2017.02/output/host/bin:/home/me/gpioexpander/buildroot-2017.02/output/host/sbin:/home/me/gpioexpander/buildroot-2017.02/output/host/usr/bin:/home/me/gpioexpander/buildroot-2017.02/output/host/usr/sbin:/home/me/bin:/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin" /home/me/gpioexpander/buildroot-2017.02/support/scripts/mkusers /home/me/gpioexpander/buildroot-2017.02/output/build/_users_table.txt /home/me/gpioexpander/buildroot-2017.02/output/target >> /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
cat system/device_table.txt > /home/me/gpioexpander/buildroot-2017.02/output/build/_device_table.txt
printf '        /bin/busybox                     f 4755 0  0 - - - - -\n /dev/console c 622 0 0 5 1 - - -\n\n' >> /home/me/gpioexpander/buildroot-2017.02/output/build/_device_table.txt
echo "/home/me/gpioexpander/buildroot-2017.02/output/host/usr/bin/makedevs -d /home/me/gpioexpander/buildroot-2017.02/output/build/_device_table.txt /home/me/gpioexpander/buildroot-2017.02/output/target" >> /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
printf '        cd /home/me/gpioexpander/buildroot-2017.02/output/target && find . | cpio --quiet -o -H newc > /home/me/gpioexpander/buildroot-2017.02/output/images/rootfs.cpio\n' >> /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
chmod a+x /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
PATH="/home/me/gpioexpander/buildroot-2017.02/output/host/bin:/home/me/gpioexpander/buildroot-2017.02/output/host/sbin:/home/me/gpioexpander/buildroot-2017.02/output/host/usr/bin:/home/me/gpioexpander/buildroot-2017.02/output/host/usr/sbin:/home/me/bin:/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin" /home/me/gpioexpander/buildroot-2017.02/output/host/usr/bin/fakeroot -- /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
fakeroot, while creating message channels: Function not implemented
This may be due to a lack of SYSV IPC support.
fakeroot: error while starting the `faked' daemon.
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
fs/cpio/cpio.mk:42: recipe for target '/home/me/gpioexpander/buildroot-2017.02/output/images/rootfs.cpio' failed
make[1]: *** [/home/me/gpioexpander/buildroot-2017.02/output/images/rootfs.cpio] Error 1
Makefile:79: recipe for target '_all' failed
make: *** [_all] Error 2
make: Leaving directory '/home/me/gpioexpander/buildroot-2017.02'
cp: cannot stat 'buildroot-2017.02/output/images/rootfs.cpio.gz': No such file or directory

Build complete. Files are in output folder.
Can't say I'm really surprised. How do Linux advocates live with the endless frustrations of Linux ?

hippy
Posts: 3924
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Diskless booting Zeroes from Windows

Thu Oct 04, 2018 11:27 pm

Seems this is a known issue -

https://github.com/Microsoft/WSL/issues/2465

There are a number of suggested solutions in there, the one I could comprehend, and is also claimed as solution elsewhere -

sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp

'ls -l /usr/bin/fakeroot*' and 'ls -l /etc/alternatives/fakeroot*' suggests it is all now pointing to the -tcp version but it hasn't had any effect; I'm still getting the "Function not implemented" error.

Looking at the error report, shortened for readibility -

Code: Select all

PATH="/ .... :/snap/bin" /home/me/gpioexpander/buildroot-2017.02/output/host/usr
/bin/fakeroot -- /home/me/gpioexpander/buildroot-2017.02/output/build/_fakeroot.fs
I'm guessing that's running the fakeroot in /home/me/... directory rather than the system provided fakeroot. Not sure how to fix that.

cd'd into that directory, renamed fakeroot as something else, copied in /usr/bin/fakeroot and the build now seems to complete without error.

I guess the next thing is to see if it's created something which rpiboot can transfer and the Pi can run. That's for tomorrow or, more correctly, later today.

Return to “Advanced users”