Custom image upgrade without reflashing

Hi,

I have built a custom image (kernel_version=4.1.20) in SD card from Robert Nelson.

The current kernel version seems to be 4.5. How to upgrade from 4.1 to 4.5 without reflashing the SD card image.
The custom kernel upgrade should be downloaded from the local network and not using apt-get.
Any pointers how to do the upgrade from the existing image without reflashing the sdcard will be helpful.

Thanks,
Veera

william@beaglebone:~$ apt-cache search linux-image |grep 4.1

Too much output here to view. Narrow search parameters assuming I want a bone kernel, and not ti kernel.

william@beaglebone:~$ apt-cache search linux-image |grep 4.1bone
linux-image-4.0.4-bone4 - Linux kernel, version 4.0.4-bone4
linux-image-4.1.14-bone-rt-r17 - Linux kernel, version 4.1.14-bone-rt-r17
linux-image-4.1.14-bone17 - Linux kernel, version 4.1.14-bone17
linux-image-4.1.4-bone15 - Linux kernel, version 4.1.4-bone15
linux-image-4.2.4-bone2 - Linux kernel, version 4.2.4-bone2
linux-image-4.3.4-bone4 - Linux kernel, version 4.3.4-bone4
linux-image-4.5.0-rc4-bone2 - Linux kernel, version 4.5.0-rc4-bone2

Much more manageable, now I just need to pick one. In this case, let’s assume I want the latest rt image.

william@beaglebone:~$ sudo apt-get install linux-image-4.1.14-bone-rt-r17
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
linux-firmware-image-4.1.14-bone-rt-r17
The following NEW packages will be installed:
linux-image-4.1.14-bone-rt-r17
0 upgraded, 1 newly installed, 0 to remove and 45 not upgraded.
Need to get 26.0 MB of archives.
After this operation, 64.8 MB of additional disk space will be used.
Get:1 http://repos.rcn-ee.com/debian/ wheezy/main linux-image-4.1.14-bone-rt-r17 armhf 1wheezy [26.0 MB]
Fetched 26.0 MB in 1min 13s (353 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package linux-image-4.1.14-bone-rt-r17.
(Reading database … 26266 files and directories currently installed.)
Unpacking linux-image-4.1.14-bone-rt-r17 (from …/linux-image-4.1.14-bone-rt-r17_1wheezy_armhf.deb) …
Setting up linux-image-4.1.14-bone-rt-r17 (1wheezy) …
update-initramfs: Generating /boot/initrd.img-4.1.14-bone-rt-r17
zz-uenv_txt: Updating /boot/uEnv.txt [uname_r=4.1.14-bone-rt-r17]

After which we need to reboot. But first. Let’s confirm we’re not already using that kernel.

william@beaglebone:~$ uname -r
4.1.12-bone-rt-r16
william@beaglebone:~$ sudo reboot

Broadcast message from root@beaglebone (pts/0) (Thu Apr 7 15:37:25 2016):
The system is going down for reboot NOW!

Log in after reboot . . .

william@beaglebone:~$ uname -r
4.1.14-bone-rt-r17

Also keep in mind that the old kernel is still in place, and in fact can be set to be the boot kernel again by making a single modification to one file. So, if in fact you’re done with the old kernel, it may behoove you to remove it least it clogs of your storage, and you soon run out of room.

Robert,

Your linux-images packages clean up after themselves if running sudo apt-get remove --purge on old unwanted images ?

I can’t recall doing this, but perhaps I should have been doing things this way as it’s much easier. I do recall using rm -rf on a couple occasions however . . .

william@beaglebone:~$ ls /boot/
SOC.sh config-3.8.13-bone70 initrd.img-3.8.13-bone70 uboot
System.map-3.8.13-bone70 config-4.1.12-bone-rt-r16 initrd.img-4.1.12-bone-rt-r16 vmlinuz-3.8.13-bone70
System.map-4.1.12-bone-rt-r16 config-4.1.14-bone-rt-r17 initrd.img-4.1.14-bone-rt-r17 vmlinuz-4.1.12-bone-rt-r16
System.map-4.1.14-bone-rt-r17 config-4.1.9-bone-rt-r16 initrd.img-4.1.9-bone-rt-r16.bak vmlinuz-4.1.14-bone-rt-r17
System.map-4.1.9-bone-rt-r16 dtbs uEnv.txt vmlinuz-4.1.9-bone-rt-r16

Yeah, look at that mess hah ! Ok, so attempting apt-get remove.

william@beaglebone:~$ sudo apt-get remove --purge linux-image-4.1.12-bone-rt-r16
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
linux-image-4.1.12-bone-rt-r16*
0 upgraded, 0 newly installed, 1 to remove and 44 not upgraded.
After this operation, 67.1 MB disk space will be freed.
Do you want to continue [Y/n]? y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database … 28939 files and directories currently installed.)
Removing linux-image-4.1.12-bone-rt-r16 …
update-initramfs: Deleting /boot/initrd.img-4.1.12-bone-rt-r16
Purging configuration files for linux-image-4.1.12-bone-rt-r16 …

william@beaglebone:~$ ls /boot/
SOC.sh config-3.8.13-bone70 initrd.img-3.8.13-bone70 uboot
System.map-3.8.13-bone70 config-4.1.14-bone-rt-r17 initrd.img-4.1.14-bone-rt-r17 vmlinuz-3.8.13-bone70
System.map-4.1.14-bone-rt-r17 config-4.1.9-bone-rt-r16 initrd.img-4.1.9-bone-rt-r16.bak vmlinuz-4.1.14-bone-rt-r17
System.map-4.1.9-bone-rt-r16 dtbs uEnv.txt vmlinuz-4.1.9-bone-rt-r16

Yeap, all gone.

Robert,

Your linux-images packages clean up after themselves if running sudo
apt-get remove --purge on old unwanted images ?

I can't recall doing this, but perhaps I should have been doing things
this way as it's much easier. I do recall using rm -rf on a couple
occasions however . . .

Only when you have one of the third party modules also installed (sgx,
mt7601u, rtl81xxx), as there are some files left in /lib/modules/<kernel

.. then an rm -rf is needed...

Regards,

Thanks Williams and Robert for the idea to upgrade the image. Could you help me with this additional clarification on upgrading the Image.

  1. Will the Debian Image(8.2) will also be upgraded to Debian 8.3 when I sudo apt-get install linux-imagexxx where xxx is the next higher version of image? If not how to upgrade the Debian Image also.

  2. Unless there is third party installed remove --purge previous img is not required? Is my understanding correct or is remove purge required always( sudo apt-get remove --purge linux-image-yyy where yyy is previous version of image )?

  3. I have custom capes included in the current image. I hope the custom capes in current image will be retained after the img upgrade using sudo apt-get install linux-imagexxx?

  4. Is there a way to find the latest stable version compared to current image. The Command needs to find the latest stable image compared to its current version without exactly knowing what the exact next version number?

Thanks,
Veera

Thanks Williams and Robert for the idea to upgrade the image. Could you help with this additional clarification on upgrading the Image.

  1. Will the Debian Image(8.2) will also be upgraded when I sudo apt-get install linux-imagexxx where xxx is the next higher version of image?

  2. Unless there is third party installed remove --purge previous img is not required? Is my understanding correct or is remove purge required always( sudo apt-get remove --purge linux-image-yyy where yyy is previous version of image )?

  3. I have custom capes included in the current image. I hope the custom capes in current image will be retained after the upgrade using sudo apt-get install linux-imagexxx?

  4. Is there a way to find the next higher and the latest version of kernal image instead of searching? The ugrade process script will check for next higher stable version of kernel image and apply the upgrade.

Thanks,
Veera