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

Firmware: Add multiple other options to move firmware to Linux #533

Merged
merged 25 commits into from
May 23, 2024

Conversation

AdityaGarg8
Copy link
Member

No description provided.

@AdityaGarg8
Copy link
Member Author

@soopyc , any chance the changes in this PR can be useful for nixOS?

@AdityaGarg8
Copy link
Member Author

This PR adds 2 new options:

  1. Adds ability to rename firmware using python on macOS.
  2. Adds ability to create distribution packages (currently deb has been added only).

I don't know how to make rpm packages, would need @sharpenedblade 's help

@soopyc
Copy link
Contributor

soopyc commented May 11, 2024 via email

Comment on lines 21 to 34
prerequisite_packages () {
cat <<EOF

Prerequisites needed to continue:

1. Python 3
2. ${additional_requirement}

Python 3 is a part of Xcode command line tools. You can also use Homebrew, MacPorts etc.
Continue when you have the prerequisites installed.

Continue? (Y/n)
EOF
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Only ask people to install stuff if they dont already have it:

if ! command -v COMMAND &> /dev/null; then
    # ask to install it here, then return a error
fi

Also do this where you ask people to install python later in the script. You don't need to ask people to continue, just exit if the command is not available.

docs/tools/firmware.sh Show resolved Hide resolved
Comment on lines 133 to 143
echo -e "\nPrerequisites needed to continue:"
echo -e "\n1. Python 3"
echo -e "\nPython 3 is a part of Xcode command line tools. You can also use Homebrew, MacPorts etc."
echo "Continue when you have the prerequisites installed."
echo -e "\nContinue? (Y/n)"
read input
if [[ ($input = n) || ($input = N) ]]
then
echo -e "\nRun the script again when you have installed the prerequisites."
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Run the prerequisite_packages function here instead, it does the same thing.

Comment on lines 163 to 168
read input
if [[ ($input = n) || ($input = N) ]]
then
echo -e "\nRun the script again when you have installed the prerequisites."
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Make prerequisite_packages return a non-zero exit status if dependencies are not installed, then remove this code and replace it with prerequisite_packages || exit 1

docs/tools/firmware.sh Show resolved Hide resolved
@AdityaGarg8 AdityaGarg8 marked this pull request as draft May 15, 2024 13:09
@AdityaGarg8 AdityaGarg8 marked this pull request as ready for review May 17, 2024 17:53
Comment on lines 218 to 236
sudo python3 "$0" $workdir $workdir/firmware-renamed.tar ${verbose}
sudo python3 $0 $workdir $workdir/firmware-renamed.tar ${verbose}
Copy link
Contributor

Choose a reason for hiding this comment

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

Word splitting can cause problems here, leave it in double quotes

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad, that change was unintentional.

Copy link
Contributor

@sharpenedblade sharpenedblade left a comment

Choose a reason for hiding this comment

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

Everything looks good now, just change the sudo python3 command

@AdityaGarg8
Copy link
Member Author

Latest commit adds Arch package as well. @NoaHimesaka1873 @Redecorating , can you test the Arch bit whenever you get time?

Looks like dnf wants to connect to the internet first and then install the .rpm package. Better to use rpm -i
Copy link
Contributor

@sharpenedblade sharpenedblade left a comment

Choose a reason for hiding this comment

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

Can you merge #536, otherwise this looks good. If the other maintainers are fine with it then LGTM

@AdityaGarg8
Copy link
Member Author

A final request for review before we can merge this. IMO its complete now.

@AdityaGarg8
Copy link
Member Author

I just remembered, the wiki will also have to be updated:(

Copy link
Contributor

@soopyc soopyc left a comment

Choose a reason for hiding this comment

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

Looks fine apart from the headings.

docs/guides/wifi-bluetooth.md Outdated Show resolved Hide resolved
@AdityaGarg8
Copy link
Member Author

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

If its not there on arch I would prefer that its also removed from the rpm package since it doesnt really belong there and telling users to reboot isnt that bad.

When I tried installing on a Live EOS ISO, it was trying to remake the initramfs inspite of not specifying it. But since the live CD doesn't have a vmlinuz in /boot, it was failing. So I thought on a real installation, Pacman maybe smart enough to reprobe the driver. I don't think there is anything wrong in simply running a modprobe -r brcmfmac after installing firmware. Why force a user to reboot when there is a simpler way. I guess we should try not to complicate things for users just for sake of standardization or it works but doesn't belong here.

@AdityaGarg8
Copy link
Member Author

Looks fine apart from the headings.

Fixed

@sharpenedblade
Copy link
Contributor

When I tried installing on a Live EOS ISO, it was trying to remake the initramfs inspite of not specifying it. But since the live CD doesn't have a vmlinuz in /boot, it was failing. So I thought on a real installation, Pacman maybe smart enough to reprobe the driver. I don't think there is anything wrong in simply running a modprobe -r brcmfmac after installing firmware. Why force a user to reboot when there is a simpler way. I guess we should try not to complicate things for users just for sake of standardization or it works but doesn't belong here.

AFAIK modprobe doesnt call any package manager stuff and just tells the kernel to load a module, but I guess its fine to leave it in, just add a note to the arch/eos section to reboot.

@AdityaGarg8
Copy link
Member Author

When I tried installing on a Live EOS ISO, it was trying to remake the initramfs inspite of not specifying it. But since the live CD doesn't have a vmlinuz in /boot, it was failing. So I thought on a real installation, Pacman maybe smart enough to reprobe the driver. I don't think there is anything wrong in simply running a modprobe -r brcmfmac after installing firmware. Why force a user to reboot when there is a simpler way. I guess we should try not to complicate things for users just for sake of standardization or it works but doesn't belong here.

AFAIK modprobe doesnt call any package manager stuff and just tells the kernel to load a module, but I guess its fine to leave it in, just add a note to the arch/eos section to reboot.

I guess PKGBUILD has a post_install section as well. I'll probably add it later. Will also have to test on an Arch installation.

Copy link
Contributor

@soopyc soopyc left a comment

Choose a reason for hiding this comment

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

Looks good from my end.

@NoaHimesaka1873
Copy link
Member

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Copy link
Member

@NoaHimesaka1873 NoaHimesaka1873 left a comment

Choose a reason for hiding this comment

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

LGTM

@AdityaGarg8
Copy link
Member Author

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

@NoaHimesaka1873
Copy link
Member

NoaHimesaka1873 commented May 22, 2024

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

No. For that you have to create apple-firmware.install, put post_install() function there, and add install=apple-firmware.install to PKGBUILD.
Reference: https://wiki.archlinux.org/title/PKGBUILD#install

@AdityaGarg8
Copy link
Member Author

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

No. For that you have to create apple-firmware.install, put post_install() function there, and add install=apple-firmware.install to PKGBUILD. Reference: https://wiki.archlinux.org/title/PKGBUILD#install

Should apple-firmware.install be in the same directory as PKGBUILD?

@NoaHimesaka1873
Copy link
Member

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

No. For that you have to create apple-firmware.install, put post_install() function there, and add install=apple-firmware.install to PKGBUILD. Reference: https://wiki.archlinux.org/title/PKGBUILD#install

Should apple-firmware.install be in the same directory as PKGBUILD?

Yes.

@AdityaGarg8
Copy link
Member Author

Can you test now @NoaHimesaka1873 . I've pushed a change.

@AdityaGarg8
Copy link
Member Author

Can you test now @NoaHimesaka1873 . I've pushed a change.

It's regarding automatic reloading of driver btw

@AdityaGarg8
Copy link
Member Author

AdityaGarg8 commented May 22, 2024

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

No. For that you have to create apple-firmware.install, put post_install() function there, and add install=apple-firmware.install to PKGBUILD. Reference: https://wiki.archlinux.org/title/PKGBUILD#install

The latest commit (4037f5e) seems to be reloading the driver on atleast EOS live environment on a VM. I would be nice if I could get a feed back from a bare metal installation.

@AdityaGarg8
Copy link
Member Author

AdityaGarg8 commented May 23, 2024

@soopyc , do you want to make changes to the nixOS guide alongwith this PR? I've noticed something regarding wifi over there.

@soopyc
Copy link
Contributor

soopyc commented May 23, 2024 via email

@AdityaGarg8
Copy link
Member Author

A final request for review before we can merge this. IMO its complete now.

The code looks good to me. Lets wait for @Redecorating or @NoaHimesaka1873 to look at the arch code.

@sharpenedblade @AdityaGarg8 Will test this in Wednesday when I have free time.

Thanks. Also, I'm not really sure whether modprobe -r brcmfmac && modprobe brcmfmac is needed on Arch as a post install script. I haven't added them yet for now.

@AdityaGarg8 It works. LGTM

Is it reloading the driver automatically?

No. For that you have to create apple-firmware.install, put post_install() function there, and add install=apple-firmware.install to PKGBUILD. Reference: https://wiki.archlinux.org/title/PKGBUILD#install

The latest commit (4037f5e) seems to be reloading the driver on atleast EOS live environment on a VM. I would be nice if I could get a feed back from a bare metal installation.

Tested on a EOS installation, it works

@AdityaGarg8
Copy link
Member Author

Alright I am merging this, @soopyc you can open a new PR for nixos. If you want to add support in some way to the script, you can do that as well.

@AdityaGarg8 AdityaGarg8 merged commit f117970 into master May 23, 2024
1 check passed
@AdityaGarg8 AdityaGarg8 deleted the firmware branch May 23, 2024 13:31
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.

4 participants