-
Notifications
You must be signed in to change notification settings - Fork 12
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
Pull wireless from config, enabling use in image and initramfs #72
Conversation
cattlepi_bring_up_wlan() { | ||
interface="${1:-wlan0}" | ||
wpa_supplicant_location="${2:-/etc/wpa_supplicant/wpa_supplicant.conf}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you use this var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops - missed that. Will do!
cmp -s "${CATTLEPI_DIR}/wpa_supplicant.conf" /tmp/wpa_supplicant.conf | ||
if [ $? -ne 0 ]; then | ||
mv /tmp/wpa_supplicant.conf "${CATTLEPI_DIR}/wpa_supplicant.conf" | ||
echo "wpa_supplicant.conf updated" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we force a reboot if the supplicant was written? this way we could use it immediately.
also, one question i had was: if the initrd writes the supplicant, can the actual raspbian os in which we're booting use ti the first time? (or do we need a reboot also?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Yeah, I suppose we could reboot right away?
After wpa_supplicant is written to $CATTLEPI_DIR in this step, later in the boot process the build step runs which should copy the file to the raspbian filesystem in the appropriate place.
also: |
That's awesome!! Can' wait to see the e2e |
Oh.... Looks like this will require a change to the API as well? Docs say that keys will get ignored unless they are known. I'm guessing the API doesn't know about a key "wpa_supplicant". |
Yep. |
Update - I finally had a bit of time to dig into why my Derpaderp the local API server doesn't seem support that method yet!! I should be able to edit the Apologies for the long wait. |
Yes. It’s pretty limited and mosty for serving images. We could extend it or at a minimum have it return something more meaningful |
Working through a few issues I found, will update this PR once I fix them. |
The wpa_supplicant file is correctly created and put in CATTLEPI_DIR as well as /etc/wpa_supplicant. In |
The netup runs before the rootfs is built. So when it’s running there is nothing there. Later in the process it the rootfs is built but by this time it’s too late? (This is just a guess) |
Correct, rootfs won't be available. I just realized that Is there any reason you can see not to mount
|
Somewhat agree w/ all of the above. I do NOT want to alter the initramfs as this would take us on an interesting path. Here is what I would suggest: let’s add a few methods to the helpers that deal with mounting [ro and rw] and unmounting the sdcard. Invoke those where it’s appropriate. Remove the sdmount and sdmountro steps. I would also strongly recommend a reboot if the supplicant is updated. (It’s okay if the pi reboots once or twice while booting and picking up “persisting” changes - this ensures it’s going to work if it loses power while up and comes back w/ no network). I am already doing this if I need to partition the sd card. |
templates/raspbian_cattlepi/resources/usr/share/initramfs-tools/scripts/cattlepi-base/helpers
Show resolved
Hide resolved
templates/raspbian_cattlepi/resources/usr/share/initramfs-tools/scripts/cattlepi-base/helpers
Show resolved
Hide resolved
templates/raspbian_cattlepi/resources/usr/share/initramfs-tools/scripts/cattlepi-base/helpers
Outdated
Show resolved
Hide resolved
templates/raspbian_cattlepi/resources/usr/share/initramfs-tools/scripts/cattlepi-base/helpers
Show resolved
Hide resolved
templates/raspbian_cattlepi/resources/usr/share/initramfs-tools/scripts/cattlepi-base/helpers
Show resolved
Hide resolved
This commit finishes adding the correct modules/drivers to the initramfs. We also specify the control interface during wpa_supplicant invocation in the initramfs to avoid any conflicts with any interface the user has specified in the wpa_supplicant.conf.
This is fully working now! You can have a fully wireless You need a few things for this to function correctly.
Even with proper wireless config, a fully booted raspbian_cattlepi machine that has an ethernet cable plugged into it will give precedence to the hardwired network. I personally feel that this is a good default. Feel free to pull the cable, reboot the box (just to be safe) and your machine can function wirelessly from then on forward. Example
Example
|
thank you |
Once testing is completed, this should fix #17
After a few iterations and much pondering, I believe this is the safest, simplest, and easiest way to make wireless connectivity possible both in the rasbian image as well as the initramfs.
Basically if the
.wpa_supplicant
key exists in the config, we decode it and put it in the${CATTLEPI_DIR}/wpa_supplicant.conf
. This makes it available in subsequent boots to both the initramfs and (after injecting it) the image. We also attempt to update thewpa_supplicant.conf
every boot.Documentation for wpa_suppicant is here.
I'm happy to further explain why I went about it this way, but honestly this is pretty straight forward and I couldn't see how my other (more-complex) methods would have been any better.