Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpud: add an option to sleep before serving #248

Merged
merged 2 commits into from
Sep 23, 2023

Conversation

rminnich
Copy link
Member

When cpud runs as init, and serves mDNS, it can start serving before mDNS will work. It is still not clear why this fails, but adding a 5 second sleep before serve() resolves it for now. Such a sleep is obviously undesirable, but the default is 0.

To set the timeout when cpud runs as init, add -- --sleepBeforeServing=5s to the kernel command line.

When cpud runs as init, and serves mDNS, it can start serving before
mDNS will work. It is still not clear why this fails, but adding a
5 second sleep before serve() resolves it for now. Such a sleep
is obviously undesirable, but the default is 0.

To set the timeout when cpud runs as init, add -- --sleepBeforeServing=5s
to the kernel command line.

This sleep is required to make mDNS work for in-flash or netbooted images.

BUT: if you have it, you don't even need a DHCP server to use it.

rminnich@pop-os:~/oreboot/linux$ sidecore . /bbin/ip a
...
2: eth0: <UP,BROADCAST,MULTICAST> mtu 1500 state UP
    link/ether 6c:cf:39:00:48:20
    inet6 fe80::6ecf:39ff:fe00:4820 scope link
       valid_lft forever preferred_lft forever

rminnich@pop-os:~/oreboot/linux$ sidecore vf2 date
Thu Jan  1 00:11:44 UTC 1970
rminnich@pop-os:~/oreboot/linux$
vf2 is in my ~/.ssh/config as
Host vf2
        HostName fe80::6ecf:39ff:fe00:4820
        IdentityFile ~/.ssh/cpu_rsa

i.e. link-local only

You can bring up a set of machines, get their link local address via mDNS, and then use link local from then on.
No DHCP server needed.

In fact this on command
sidecore . /bbin/ip l
will get the macs for ALL machines.
Note: this is why it pays to just put all the u-root commands in the image.

One such command to do this:

(p=$PWD && \
  cd ~/go/src/github.com/u-root/cpu/cmds/cpud/ && \
  GOARCH=riscv64 u-root -tags mDNS \
  -uroot-source ~/go/src/github.com/u-root/u-root/ \
  -files ~/.ssh/cpu_rsa.pub:key.pub \
  -initcmd=/bbin/cpud \
  . all)

xz --check=crc32 -9 --lzma2=dict=1MiB  \
  --stdout /tmp/initramfs.linux_riscv64.cpio  \
  | dd conv=sync bs=512    of=emb.cpio.xz

Signed-off-by: Ronald G Minnich <[email protected]>
Copy link
Member

@orangecms orangecms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always in favor of a good nap! 😴

@orangecms orangecms enabled auto-merge (rebase) September 23, 2023 20:12
@rminnich rminnich force-pushed the more-debug-add-sleep-option branch from 9ee3ee3 to 0ff3f92 Compare September 23, 2023 20:13
@orangecms
Copy link
Member

orangecms commented Sep 23, 2023

@rminnich I've enabled the auto-merge option in the settings. That label is obsolete and only worked with some 3rd party integration up to some point.

This is now an option of the merge button instead.

@orangecms orangecms merged commit ffd2fa5 into u-root:main Sep 23, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants