rpi-update - Firmware updater for Raspberry Pi


40 posts   Page 1 of 2   1, 2
by Hexxeh » Sat Apr 21, 2012 8:59 pm
Seeing so many releases of the Debian image in a relatively short period of time made me think. It'd be nice if there was a way to keep up to date without having to entirely reimage your SD card.

So I've thrown together a tool that lets you install the latest firmware/kernel easily. The idea is that this could be included in any distribution (since it doesn't rely on any package manager, it just needs you to have Git installed), and provide a simple way to install new firmware versions.

It's rather experimental, so it might break or do unexpected things, but I'm running it on my Pi, and I'll continue to do so, updating as each new version of the firmware is released. If you're happy to experiment, give it a go and let me know how you get on.

Currently, it updates the firmware, kernel and modules. I'm going to make it update the VC libs eventually too, once I figure out a clean way of doing so.

Instructions to install the tool are on my GitHub here: https://github.com/Hexxeh/rpi-update

Once the tool is installed, updating is as simple as typing "rpi-updater" in a root shell, or with sudo prefixed. By default, it'll use the 224MB/32MB split. If you want to use the 192MB/64MB split, then type "rpi-updater 192" instead. Same goes for 128MB splits.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by dom » Sat Apr 21, 2012 9:57 pm
Nice.
I think you do need /opt/vc updated at the same time.
Sometimes there are dependencies between start.elf and /opt/vc.
But, I could find this useful.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4030
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Hexxeh » Sat Apr 21, 2012 10:08 pm
Sure, I'll add them to the tool very soon. The tool updates itself, so anyone who already has it installed doesn't need to reinstall it.

The one problem I can see with updating the /opt/vc folder is that there are softfp and hardfp versions. We could ask the user which they have, but that's not within the spirit of keeping it easy.

The only way I can think of getting around this, is to check an existing binary on the system with readelf to see whether it's been compiled hardfp, but that'd require that readelf was installed, which it might not be.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by plugwash » Sat Apr 21, 2012 10:22 pm
Afaict the only hardfloat port for the Pi is mpthompsons port of debian so it should be safe to use dpkg --print-architecture if dpkg exists and assume softfp if dpkg doesn't exist.
Forum Moderator
Forum Moderator
Posts: 2266
Joined: Wed Dec 28, 2011 11:45 pm
by Hexxeh » Sat Apr 21, 2012 10:37 pm
I'm planning on shipping hardfloat Chromium OS, so that won't work in that instance.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by Chromatix » Sun Apr 22, 2012 1:14 am
Also, hardfloat Gentoo exists - but that uses a rolling upgrade by design, so there are obvous better ways to do it.
The key to knowledge is not to rely on people to teach you it.
User avatar
Posts: 430
Joined: Mon Jan 02, 2012 7:00 pm
Location: Helsinki
by nullstring » Sun Apr 22, 2012 1:29 am
RPI doesn't have it's own debian repository to do this?

It seems like this should be done with each distribution's native package manager.
Posts: 178
Joined: Sun Oct 02, 2011 3:05 pm
by asb » Sun Apr 22, 2012 9:02 am
nullstring said:


RPI doesn't have it's own debian repository to do this?

It seems like this should be done with each distribution's native package manager.


Not yet. It's obviously a high priority.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 799
Joined: Fri Sep 16, 2011 7:16 pm
by john.mills » Sun Apr 22, 2012 11:18 am
It doesn't at the moment, but a 'complete' version is being compiled using hardfloat by mpthompson. The source has been pulled in and is being compiled as we speak. I believe he thinks it will be around a month to have a complete build of Debian available. You can follow progress here:

http://www.raspberrypi.org/for.....hf-for-rpi

If you can support the project in anyway I'm sure it would be very much appreciated.
Posts: 81
Joined: Mon Apr 09, 2012 5:23 am
by Hexxeh » Sun Apr 22, 2012 1:03 pm
I've added basic support for updating the VC libs/headers/binaries to the updater tool.

It uses readelf to try to detect whether you're running SoftFP or HardFP. One thing I did notice, is that the libilclient.a in the hello_pi/libs folder is HardFP for both the SoftFP and HardFP files. So currently, that file will be HardFP even if you're running SoftFP.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by Auron » Fri May 25, 2012 11:04 am
Just trying this, thanks.

Having an issue though - when I try to install ca-certificates, I get 'Failed to fetch... 404 Not Found'. It's attempting to get files from the UK Debian FTP server but failing.
Posts: 15
Joined: Tue Feb 14, 2012 1:40 am
by observing » Fri May 25, 2012 11:37 am
Auron wrote:Just trying this, thanks.

Having an issue though - when I try to install ca-certificates, I get 'Failed to fetch... 404 Not Found'. It's attempting to get files from the UK Debian FTP server but failing.


What solved it for me was to do a "sudo apt-get update"

I also did a "sudo apt-get upgrade" after that, but I think the problem was solved with the update.
Posts: 41
Joined: Mon Feb 27, 2012 12:18 pm
by Hexxeh » Sat May 26, 2012 1:56 pm
Updates from AndrewS pushed today, updated the firmware repo yesterday.
Posts: 90
Joined: Thu Apr 05, 2012 3:07 pm
by AndrewS » Sat May 26, 2012 11:23 pm
*wave* :D
These updates including:
    auto-detection of the current memory-split setting
    skip updating if the latest firmware is already in place
    "offline mode" so you can run it with your SD card plugged into your 'regular' Linux PC - great if you need to update to the latest firmware before your RPi will boot from your SD card :)
    ability to skip overwriting the kernel & kernel-modules if you're using a custom kernel
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by dtud2 » Sun Jun 03, 2012 8:52 pm
Can you tell me what sockets rpi-update uses when connecting to the internet?
I receive the following error & I suspect a new firewall rule at the perimeter is needed to allow access.

github.com[0: 207.97.227.239]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
R Tape loading error, 0:1
Posts: 14
Joined: Thu May 31, 2012 10:02 pm
by rurwin » Sun Jun 03, 2012 10:20 pm
Socket 9418, TCP and UDP according to the assigned numbers. I'd doubt that UDP, but it might be so.
There's a Stackoverflow answer that says it can use HTTP on port 80, but it's very slow.
User avatar
Forum Moderator
Forum Moderator
Posts: 2913
Joined: Mon Jan 09, 2012 3:16 pm
by piglet » Sun Jun 03, 2012 11:14 pm
Any update there for the "can't have fast and slow devices on the same incoming usb socket?

Do you have a linky for the git repo to see change logs?

*edit* no update detected for me...hmmm
User avatar
Posts: 569
Joined: Sat Aug 27, 2011 1:16 pm
by dtud2 » Sun Jun 03, 2012 11:17 pm
Thank you, opening UDP & TCP on that port did get me further however still an error.


Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
Performing self-update
Autodetecting memory split
Using ARM/GPU memory split of 224MB/32MB
We're running for the first time
Setting up firmware (this will take a few minutes)
Using SoftFP libraries
/opt/vc/sbin/vcfiled: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory
If no errors appeared, your firmware was successfully setup
A reboot is needed to activate the new firmware

[Edit] I do see references to Soft/Hard FP earlier in this thread but I'm afraid that as a beginner it doesn't mean much to me...
R Tape loading error, 0:1
Posts: 14
Joined: Thu May 31, 2012 10:02 pm
by AndrewS » Sun Jun 03, 2012 11:41 pm
dtud2 wrote:/opt/vc/sbin/vcfiled: error while loading shared libraries: libvchiq_arm.so: cannot open shared object file: No such file or directory

I get that error too (only the first time rpi-update gets run), but I haven't got round to emailing Hexxeh about it yet. It's safe to ignore, and simply rebooting your RPi will cause the vcfiled service to start correctly.

[Edit] I do see references to Soft/Hard FP earlier in this thread but I'm afraid that as a beginner it doesn't mean much to me...

If you don't know what it means, it's safe to just ignore it ;) But if you're curious, there's more detail at http://www.raspbian.com/RaspbianFAQ#What_is_Raspbian.3F
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by AndrewS » Mon Jun 04, 2012 12:30 am
piglet wrote:Do you have a linky for the git repo to see change logs?

rpi-update gets it's changes from https://github.com/Hexxeh/rpi-firmware which is essentially a slimmed-down copy of https://github.com/raspberrypi/firmware
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by dtud2 » Mon Jun 04, 2012 12:11 pm
Thanks Andrew.
Just as a by I am now getting all sorts of reading SD card errors when the Pi powers up, eventually after a good 5 minutes it changes to an alternative mode (something about single block) & then boots fine.

The output is:-
-Error 110 whilst initialising SD card
Problem reading SD Status register.


[This just loops & fills the screen]

Could this be an affect of running the updater or just a coincidence?
Sorry for the vagueness of the fault but after the error loop the details zooms past & the [Pause] option on my KB doesn't seem to work on the Pi.
R Tape loading error, 0:1
Posts: 14
Joined: Thu May 31, 2012 10:02 pm
by AndrewS » Mon Jun 04, 2012 12:21 pm
If you're getting errors after updating the firmware, then I think dom would like to hear from you ;)
viewtopic.php?f=63&t=6093
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by dtud2 » Mon Jun 04, 2012 12:35 pm
It's been working fine for the last month though so I can be almost certain that the SD is good...
When I've searched the forum I see that the 110 error are common however I don't see anyone that has had a good build go bad?

My header now reads...
Linux raspberrypi 3.1.9+ #95 PREEMPT Thu May 31 13:21:40 BST 2012 armv6l

Has my Kernel been updated? Can I revert back to the 19-04 Kernel?
Are there any fixes that I can try?

For info the SD is a "A Data - Class 6 Turbo 16GB"

[Edit] My card is listed as working on the Wiki.... http://elinux.org/RPi_VerifiedPeripherals#SD_cards
R Tape loading error, 0:1
Posts: 14
Joined: Thu May 31, 2012 10:02 pm
by dtud2 » Mon Jun 04, 2012 2:44 pm
After reading related posts in the forum I've returned my Pi to its previous state. I'm sure that I've gone the long way around the houses but here's how I did it.

Imaged a second SD card with the Debian 19-04 image. Inserted this card into my laptop & copied these files to a folder on its desktop.....
kernel
kernel_emergency
loader.bin
start.elf


Inserted my original SD into the laptop & copied the four above files onto it overwriting originals.

All back to normal though I am not claiming this is a fix as it obviously isn't but at least it's a fudge to get me back to where I was.

Linux raspberrypi 3.1.9+ #90 Wed Apr 18 18:23:05 BST 2012 armv6l


I'll create a backup image of the SD card & run rpi updater again to see if it recreate the problem.
R Tape loading error, 0:1
Posts: 14
Joined: Thu May 31, 2012 10:02 pm
by AndrewS » Mon Jun 04, 2012 4:46 pm
Just a couple of quick FYIs...
Unless you specifically rename it to kernel.img, kernel_emergency.img never gets used.
By doing it the way you have, you might get a module version mismatch - the files in /lib/modules/ need to match the kernel.img you have installed.
I'm not sure if or how much it changes, but there's also a bootcode.bin file.
User avatar
Posts: 3626
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK