• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    FOG Project Image Capture on Raspberry Pi 4 (ARM64) via U-Boot

    Scheduled Pinned Locked Moved Unsolved FOG Problems
    24 Posts 2 Posters 359 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Tom ElliottT
      Tom Elliott @Jeremy
      last edited by

      @Jeremy Last time I told you FOG’s server had no U-Boot support and your two
      options were to keep hand-rolling it or put UEFI firmware on the Pi. That’s no
      longer true - I built the server side. It’s merged into working-1.6 as of
      1.6.0-beta.4318, so update and you’ll have it.

      There’s a new endpoint:

      http://<fogserver>/fog/service/uboot/boot.php?mac=<the Pi's MAC>
      

      It answers with an extlinux.conf-style document, computed live from the
      database. If the host has a task queued you get kernel/initrd/append for FOS;
      if it doesn’t, you get localboot and U-Boot falls through to the disk. Fetch it
      with curl first - the whole thing is plain text and readable, which is the
      point.

      On the Pi:

      dhcp
      setenv pxefile_addr_r 0x02000000
      wget ${pxefile_addr_r} http://<fogserver>/fog/service/uboot/boot.php?mac=${ethaddr}
      pxe boot ${pxefile_addr_r}
      

      Use pxe boot, not sysboot. Every extlinux example you’ll find online shows
      sysboot, and it’s wrong here - sysboot reads a config off a filesystem on a
      block device, so it can’t see what wget just put in memory and does nothing
      visible. That’s the one I’d expect to catch people out.

      This should also fix your truncation. “Unknown request type :: Null” was $type
      arriving empty because your bootargs were being cut short, and I pointed at
      U-Boot’s command buffer rather than the kernel. pxe boot doesn’t go through
      that buffer - it parses the append line out of the loaded file straight into
      bootargs, so the ceiling you were hitting isn’t in the path any more. Worth
      confirming, since I’m reasoning about your build rather than looking at it.

      Two deliberate omissions, both because they’re properties of your board and not
      of FOG:

      FOG serves no device tree. No fdt or fdtdir directive, so you keep the tree at
      ${fdtcontroladdr} - the one VideoCore just built for the exact board revision
      it’s running on, which is better than anything I could serve you. Load
      addresses stay yours for the same reason.

      And FOG writes no pxelinux.cfg files. The endpoint is stateless: the board asks
      by MAC and gets an answer out of the database, so there’s nothing on disk to
      drift from what’s actually queued and nothing to clean up when a task finishes.

      One thing to check before you start: if your FOG install has netboot set to
      HTTPS, none of this will work. U-Boot’s wget is HTTP-only with no TLS at all,
      so it can’t even fail a certificate check - the redirect just ends the boot with
      nothing on screen. The installer now exempts service/uboot/ from the HTTP-to-
      HTTPS redirect the same way it does service/ipxe/, but only when netboot is
      configured for HTTP in the first place.

      Full write-up is in docs/UBOOT_ARM_BOOT.md in the repo.

      Being straight about what this is: the emitted config is pinned byte-for-byte
      by tests and the decisions behind it are the same code the iPXE path runs, so I
      know FOG emits what I intended. What I can’t tell you is that a real U-Boot
      consumes it, because nobody here has a Pi. You’re the only person who can prove
      that, and if it’s wrong I’d rather hear it than not.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      J 1 Reply Last reply Reply Quote 0
      • J
        Jeremy @Tom Elliott
        last edited by

        This post is deleted!
        Tom ElliottT 1 Reply Last reply Reply Quote 0
        • Tom ElliottT
          Tom Elliott @Jeremy
          last edited by

          @Jeremy you seem to be trying to use fogs boot system to do your own thing. What you’re asking is perfectly possible just not via debug.

          Debug has a very specific purpose so to be trying to say: “hey can you stop doing what your program is intended to do so I can do things I want using your program?” Isn’t a good use of anyone’s time, particularly the developers.

          What you want to do is already possible, but you’ll have to make your own post init script.

          Seeing as what you want to do is not have a fog server, but to do something else, I cannot tell you what needs to happen.

          You will need to read the documentation, lax as it may be, create a custom task (not debug) to do your work autonomously, and learn how the post init scripts work.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          J 1 Reply Last reply Reply Quote 0
          • J
            Jeremy @Tom Elliott
            last edited by

            @Tom-Elliott

            1. Context and Objective

              Hardware: Raspberry Pi (ARM architecture) running U-Boot.

              FOG Server: Updated to the working-1.6 branch (tested version: 1.6.0-beta.4707).

              Objective: Enable fully automated and dynamic deployment/boot (without human intervention or blocking debug mode) using the new U-Boot endpoint created by the developer (/fog/service/uboot/boot.php).

            2. Testing Process and Results

              Step A: Initial Manual Validation (Success)

               By executing the deployment commands manually on the Raspberry Pi terminal, the image cloning completed successfully, and the image was properly copied to the new Raspberry Pi. This confirmed that the hardware and image transfer parts are functional.
              

              Step B: FOG Server Update

               Updated the server to the working-1.6 branch and executed ./bin/installfog.sh to integrate the new U-Boot endpoint.
              

              Step 😄 Testing the U-Boot Endpoint (boot.php)

               The curl request executed on the FOG server for a specific MAC address:
               Bash
              
               curl "http://127.0.0.1/fog/service/uboot/boot.php?mac=88:a2:9e:53:34:c0"
              
               Server Response: The endpoint correctly generates and returns a script in PXE/Syslinux format structured as follows:
               Plaintext
              
               # Generated by FOG Project. Do not edit -- it is not stored.
               default fog
               timeout 1
               label fog menu label FOG Project tasking kernel http://192.168.203.113/fog/service/ipxe/arm_Image initrd http://192.168.203.113/fog/service/ipxe/arm_init.cpio.gz append ...
              

              Step 😧 Testing Automatic Boot on the Raspberry Pi

               Used the U-Boot sequence with wget and the pxe boot command to attempt dynamic file retrieval at startup.
              
               Technical observation noted: The wget tool embedded in the BusyBox/FOS environment on ARM encounters parsing issues with URLs containing GET parameters (?mac=...), throwing a wget: bad port error.
              
            3. Attention Point

              The script generated by boot.php returns a Syslinux/PXE-style configuration format (label fog …), which is natively supported by U-Boot’s pxe boot command. However, full automation via a clean U-Boot command line (bootcmd) requires ensuring that the embedded wget on ARM environments can handle URLs with dynamic parameters without syntax errors.

            1 Reply Last reply Reply Quote 0
            • J
              Jeremy @Tom Elliott
              last edited by

              @Tom-Elliott

              Thanks for your clarification, and apologies for the confusion. I think there was a misunderstanding about what I am trying to achieve.

              I am not trying to bypass FOG or do something outside of FOG — quite the contrary. I am actively using FOG to deploy images to a fleet of Raspberry Pi devices.

              My previous confusion came from the fact that my test units kept landing in the interactive FOG debug mode (requiring pressing Enter to get a prompt), which led me down the wrong path thinking I needed a manual workaround. My ultimate goal is simply to have a standard, fully automated deployment task (non-debug) run seamlessly on the Raspberry Pis without requiring manual intervention at each boot.

              I will look into standard deployment tasks and post-init scripts as you suggested. Thanks for pointing me in the right direction!

              Tom ElliottT 1 Reply Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott @Jeremy
                last edited by

                @Jeremy Two separate things here, and I think they have different answers.

                On landing in debug mode: worth being precise about what isdebug actually does, because it’s not what it might look like. The code that runs your postinit script (bin/fog) doesn’t check isdebug at all — it runs whenever fog executes, whether that’s automatic or you typed fog yourself at a shell. What isdebug=yes actually does is two things: it stops FOS from launching fog automatically at boot (you land at the debug info screen and then a bare shell instead), and it turns on every debugPause() — “Press [Enter] to continue” — checkpoint throughout the entire imaging engine, not just one place. There are dozens of them. So even if you manually ran your postinit script from the debug shell and it worked cleanly, anything FOG itself does afterward (a real deploy task) is going to stop and wait for Enter repeatedly, because isdebug=yes turns all of that on at once.

                That’s still coming from wherever you’ve got isdebug=yes set — either baked into your boot.cmd/append line, or as a Host Kernel Argument in the FOG web UI for this host, from when you added it to work around the multi-partition issue a few days ago. Clear it in both places. With it gone: fog runs automatically, your postinit script runs (same as before, that part was never conditional), the actual deploy runs with zero pauses, and the box reboots itself when the task completes — no interaction anywhere in the chain. That’s the automation you’re after.

                On the wget “bad port” error: worth being precise about where this is happening too — it’s U-Boot itself, at the wget … | pxe boot step, before FOS is even loaded. It isn’t BusyBox and it isn’t anything in FOS or the FOG server; the config I quoted came back correctly from curl, so the server side is fine.

                My best read — I don’t have your board to test this, so treat it as a hypothesis to check, not a diagnosis: U-Boot’s wget has two different implementations depending on how it was built. The newer one parses a real URL and splits host from path at the first /, so a query string with colons in it (like your MAC) shouldn’t confuse it. Older builds only understand wget <loadaddr> [<host-ip>:]<path> — no http://, no query-string awareness — and that parser looks for the first colon anywhere in the string, which lands inside mac=dc:a6:… and gets misread as a bogus port.

                Can you run wget with no arguments (or help wget) at the U-Boot prompt and paste the usage line it prints? That tells us which of the two you’ve got, and whether this is fixable on your end (newer U-Boot build) or needs the TFTP-staged fallback the docs mention.

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                J 1 Reply Last reply Reply Quote 0
                • J
                  Jeremy @Tom Elliott
                  last edited by

                  @Tom-Elliott

                  I checked both database entries for hostKernelArgs, and isdebug=yes was indeed not present there.

                  Regarding the U-Boot wget error, I followed your suggestion and went to the U-Boot prompt (=>) on the Raspberry Pi. When I type wget, it responds with:
                  Unknown command wget try help

                  So it seems the U-Boot build on these Raspberry Pis does not have the wget command compiled into it at all. What would be the recommended fallback or alternative method to fetch the script from FOG in this case (e.g., using TFTP or an alternative command if available)?"

                  Tom ElliottT 1 Reply Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott @Jeremy
                    last edited by

                    @Jeremy Good, that narrows it down — no wget at all in this build, not just the older syntax. Two ways to close that:

                    Rebuild U-Boot with wget compiled in (keeps you on the dynamic per-host endpoint). CONFIG_CMD_WGET is a plain menuconfig option — you don’t need the HTTPS variant, which pulls in the whole lwIP/mbedTLS stack, just plain HTTP:

                    make rpi_4_defconfig
                    make menuconfig # Command line interface -> Network commands -> wget
                    make

                    Reflash the resulting u-boot.bin. Since dhcp already works for you, the network stack is there — this just turns on the one command. Once it’s in, the sequence from before should work as documented.

                    Or skip the dynamic endpoint and hand-roll a static boot.cmd — which is exactly what already worked for your capture: plain tftp for kernel/initrd/dtb, fixed bootargs with the task’s mac=, osid=, type=, img=, etc. baked in. The real tradeoff: tftp doesn’t ask FOG anything, so that config is identical for every board that boots it. Fine if every Pi runs the same task; not fine if you need FOG to decide per-host. boot.php exists specifically to answer “what does this MAC need right now” dynamically, and there’s currently no TFTP equivalent of it for boards that can’t do HTTP — that’s a real gap on FOG’s side, not something you’re doing wrong.

                    For 100+ boards I’d lean toward rebuilding U-Boot rather than going static, since you keep per-host tasking either way — but that’s your call based on how uniform the fleet’s deployment actually needs to be.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      Jeremy @Tom Elliott
                      last edited by

                      @Tom-Elliott "Hi again,

                      Following your instructions, I checked the U-Boot prompt. When typing wget, it responds with:
                      Unknown command wget try help
                      So the U-Boot build on these boards does not include the wget command.

                      Also, for context on how the board behaves at boot, here is what happens visually during the startup sequence (attached photo): it tries to boot locally, times out on storage (mmc / usb), and then falls back to a standard network BOOTP broadcast loop (Retry time exceeded).

                      Given that U-Boot lacks wget and relies on standard BOOTP/PXE broadcast rather than direct HTTP fetching, what is the recommended way or fallback mechanism to have these boards pull their configuration from FOG?"

                      b1a36046-9e12-4cca-bb7a-8eeda752b04a-image.png

                      Tom ElliottT 1 Reply Last reply Reply Quote 0
                      • Tom ElliottT
                        Tom Elliott @Jeremy
                        last edited by

                        @Jeremy Good news on the wget front — I closed that gap I mentioned. FOG can
                        now serve boards with no wget at all, over plain TFTP instead of HTTP.

                        U-Boot’s pxe get command doesn’t need wget — every U-Boot build has it,
                        and unlike wget it isn’t configurable: it always fetches
                        pxelinux.cfg/01-<mac, dash-separated, lowercase> by TFTP from whatever
                        server your board’s serverip points at. FOG now keeps a real file at that
                        path for every host, kept in sync automatically whenever a task is queued,
                        completed, or canceled — so your boot sequence becomes just:

                        dhcp
                        pxe get
                        pxe boot
                        

                        No URL, no query string, nothing for the “bad port”/no-wget class of problem
                        to trip over — the filename is fixed by the MAC, so there’s nothing to
                        substitute.

                        This just merged into working-1.6 — same branch you’re already tracking
                        (you quoted 1.6.0-beta.4707 a few hours ago; this landed after that), so
                        running your update again should pick it up. Two things to check once you
                        have:

                        • Settings → FTP/TFTP needs a TFTP host/username/password configured — same
                          connection FOG already uses to upload your ARM kernel, so if that’s
                          already working for you, you’re set.
                        • I still don’t have a Pi to test this against, same as everything else in
                          this thread — if pxe get doesn’t find the file, or finds one FOG didn’t
                          mean to serve, that’s exactly the kind of thing I need you to report back.

                        One thing from your last post I want to flag separately, because it looks
                        like a different problem from the wget one: the boot sequence you
                        described — times out on local storage, then falls into a BOOTP broadcast
                        loop that gives up with “Retry time exceeded” — reads like U-Boot’s own
                        default bootcmd running, not a custom one. That’s the standard
                        Raspberry Pi fallback behavior when nothing else answers, and it wouldn’t
                        run dhcp / pxe get / pxe boot at all, custom or not.

                        Everything you’ve described testing so far — the wget/pxe boot sequence,
                        the curl check, now pxe get — sounds like it’s been typed by hand at the
                        => prompt each time. That proves the commands work, but it can’t be “fully
                        automated,” which was the goal from your very first post: nothing runs
                        automatically unless it’s persisted as bootcmd, either with
                        setenv bootcmd '...'; saveenv on the board itself, or as a boot.scr /
                        extlinux.conf your SD card or TFTP server hands U-Boot on its own at power-on.

                        Can you confirm which of those two you actually have in place right now? If
                        the answer is “neither yet — I’ve only been testing at the prompt,” that’s
                        probably the real blocker to automation, independent of wget vs. TFTP, and
                        worth sorting out before we look any further at the fetch mechanism itself.

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post

                        56

                        Online

                        12.8k

                        Users

                        17.6k

                        Topics

                        157.0k

                        Posts
                        Copyright © 2012-2026 FOG Project