Merge lp:~manjo/ubuntu/utopic/flash-kernel/filter-useable-kernels into lp:ubuntu/utopic/flash-kernel

Proposed by Manoj Iyer
Status: Merged
Merge reported by: Scott Moser
Merged at revision: not available
Proposed branch: lp:~manjo/ubuntu/utopic/flash-kernel/filter-useable-kernels
Merge into: lp:ubuntu/utopic/flash-kernel
Diff against target: 67 lines (+33/-2)
2 files modified
debian/changelog (+6/-0)
functions (+27/-2)
To merge this branch: bzr merge lp:~manjo/ubuntu/utopic/flash-kernel/filter-useable-kernels
Reviewer Review Type Date Requested Status
Scott Moser Approve
Review via email: mp+231440@code.launchpad.net

Description of the change

https://bugs.launchpad.net/lomond/+bug/1356569

Submitting merge proposal for smoser's patch to filter useable kernels for platform. Currently if the platform uses flavor kernels, and the cloud image has a -generic version that is newer than the flavor version, nothing gets installed and boot.scr is not generated. With this patch, the latest useable flavor kernel is discovered and written to /boot and boot.scr is generated.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-04-24 17:34:28 +0000
3+++ debian/changelog 2014-08-19 19:39:23 +0000
4@@ -1,3 +1,9 @@
5+flash-kernel (3.0~rc.4ubuntu51) utopic; urgency=medium
6+
7+ * Filter the selection of latest useable kernel through the whitelist.
8+
9+ -- Manoj Iyer <manoj.iyer@canonical.com> Tue, 19 Aug 2014 14:27:33 -0500
10+
11 flash-kernel (3.0~rc.4ubuntu50) utopic; urgency=medium
12
13 * Added support for user defined uboot environment variables
14
15=== modified file 'functions'
16--- functions 2014-04-24 17:34:28 +0000
17+++ functions 2014-08-19 19:39:23 +0000
18@@ -351,6 +351,29 @@
19 fi
20 }
21
22+include_only_flavors() {
23+ # include_only_flavors(flav1, flav2, flav3)
24+ # filter lines of input in uname -r format (X.Y.Z-N-flavor)
25+ # and filter-out anything that is not in the listed input
26+ # if exactly zero flavors are given, then assume everything is a match
27+ local cur_uname cur_flav allowed_flav
28+ while read cur_uname; do
29+ if [ $# -eq 0 ]; then
30+ echo "$cur_uname"
31+ else
32+ # could use cur_flav=$(get_kfile_suffix "$cur_uname")
33+ # but this is much faster.
34+ cur_flav=${cur_uname#*-*-}
35+ for allowed_flav in "$@"; do
36+ if [ "${cur_flav}" = "${allowed_flav}" ]; then
37+ echo "$cur_uname"
38+ break
39+ fi
40+ done
41+ fi
42+ done
43+}
44+
45 main() {
46 if [ "x$1" = "x--machine" ]; then
47 machine="$2"
48@@ -369,7 +392,9 @@
49 # kernel + initrd installation/upgrade mode, with optional version
50
51 kvers="$1"
52-latest_version=$(linux-version list | linux-version sort | tail -1)
53+
54+kflavors="$(get_machine_field "$machine" "Kernel-Flavors")"
55+latest_version=$(linux-version list | include_only_flavors $kflavors | linux-version sort | tail -1)
56 if [ -n "$kvers" ] && [ "$kvers" != "$latest_version" ]; then
57 echo "Ignoring old or unknown version $kvers (latest is $latest_version)" >&2
58 exit 0
59@@ -412,7 +437,7 @@
60 error "Unsupported platform."
61 fi
62
63-if kflavors="$(get_machine_field "$machine" "Kernel-Flavors")"; then
64+if [ -n "$kflavors" ]; then
65 if ! check_kflavors "$kfile_suffix" $kflavors; then
66 echo "Kernel suffix $kfile_suffix does not match any of the expected flavors ($kflavors), therefore not writing it to flash." >&2
67 exit 0

Subscribers

People subscribed via source and target branches

to all changes: