[3/6] wic: bootimg-efi-isar: Add support for Ubuntu

Message ID 57c2d3cf997a0355af0dd04eb6b2924ac7920f43.1607929886.git.jan.kiszka@siemens.com
State Accepted, archived
Headers show
Series Add support for Ubuntu | expand

Commit Message

Jan Kiszka Dec. 13, 2020, 9:11 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Ubuntu places the kernel and initrd links under /boot. Account for that.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/wic-img.bbclass                           |  2 +-
 .../scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Henning Schild Dec. 14, 2020, 2:13 a.m. UTC | #1
Did you check the custom kernel case? Do we not have pre/post install
scripting in place which deals with symlinks? Or is this scripting just
part of the distro?

Henning

Am Mon, 14 Dec 2020 08:11:24 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Ubuntu places the kernel and initrd links under /boot. Account for
> that.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  meta/classes/wic-img.bbclass                           |  2 +-
>  .../scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 10
> +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes/wic-img.bbclass
> b/meta/classes/wic-img.bbclass index bbf5dd8a..dedd2bf0 100644
> --- a/meta/classes/wic-img.bbclass
> +++ b/meta/classes/wic-img.bbclass
> @@ -99,7 +99,7 @@ WICVARS += "\
>             KERNEL_NAME KERNEL_FILE"
>  
>  # Isar specific vars used in our plugins
> -WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO_ARCH"
> +WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
>  
>  python do_rootfs_wicenv () {
>      wicvars = d.getVar('WICVARS', True)
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index
> 2285d2ef..67efa52e 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -65,6
> +65,10 @@ class BootimgEFIPlugin(SourcePlugin): # Create grub
> configuration using parameters from wks file bootloader =
> creator.ks.bootloader 
> +            kernel_initrd_path = "/"
> +            if get_bitbake_var("DISTRO").startswith("ubuntu"):
> +                kernel_initrd_path = "/boot/"
> +
>              grubefi_conf =  "serial --unit=0 --speed=115200 --word=8
> --parity=no --stop=1\n" grubefi_conf += "terminal_input --append
> serial\n" grubefi_conf += "terminal_output --append serial\n"
> @@ -77,9 +81,9 @@ class BootimgEFIPlugin(SourcePlugin):
>                      grubefi_conf += "set root=$bootdisk',gpt%d'\n" %
> part.realnum grubefi_conf += "\n"
>              grubefi_conf += "menuentry 'boot'{\n"
> -            grubefi_conf += "    linux /vmlinuz root=%s rootwait
> %s\n" \
> -                            % (creator.rootdev, bootloader.append or
> "")
> -            grubefi_conf += "    initrd /initrd.img\n"
> +            grubefi_conf += "    linux %svmlinuz root=%s rootwait
> %s\n" \
> +                            % (kernel_initrd_path, creator.rootdev,
> bootloader.append or "")
> +            grubefi_conf += "    initrd %sinitrd.img\n" %
> kernel_initrd_path grubefi_conf += "}\n"
>  
>          logger.debug("Writing grubefi config
> %s/hdd/boot/EFI/BOOT/grub.cfg",
Jan Kiszka Dec. 14, 2020, 2:28 a.m. UTC | #2
On 14.12.20 13:13, Henning Schild wrote:
> Did you check the custom kernel case? Do we not have pre/post install
> scripting in place which deals with symlinks? Or is this scripting just
> part of the distro?

Yes, see https://github.com/siemens/meta-iot2050/commits/jan/ubuntu.

Jan

> 
> Henning
> 
> Am Mon, 14 Dec 2020 08:11:24 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Ubuntu places the kernel and initrd links under /boot. Account for
>> that.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  meta/classes/wic-img.bbclass                           |  2 +-
>>  .../scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 10
>> +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/classes/wic-img.bbclass
>> b/meta/classes/wic-img.bbclass index bbf5dd8a..dedd2bf0 100644
>> --- a/meta/classes/wic-img.bbclass
>> +++ b/meta/classes/wic-img.bbclass
>> @@ -99,7 +99,7 @@ WICVARS += "\
>>             KERNEL_NAME KERNEL_FILE"
>>  
>>  # Isar specific vars used in our plugins
>> -WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO_ARCH"
>> +WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
>>  
>>  python do_rootfs_wicenv () {
>>      wicvars = d.getVar('WICVARS', True)
>> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
>> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index
>> 2285d2ef..67efa52e 100644 ---
>> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
>> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -65,6
>> +65,10 @@ class BootimgEFIPlugin(SourcePlugin): # Create grub
>> configuration using parameters from wks file bootloader =
>> creator.ks.bootloader 
>> +            kernel_initrd_path = "/"
>> +            if get_bitbake_var("DISTRO").startswith("ubuntu"):
>> +                kernel_initrd_path = "/boot/"
>> +
>>              grubefi_conf =  "serial --unit=0 --speed=115200 --word=8
>> --parity=no --stop=1\n" grubefi_conf += "terminal_input --append
>> serial\n" grubefi_conf += "terminal_output --append serial\n"
>> @@ -77,9 +81,9 @@ class BootimgEFIPlugin(SourcePlugin):
>>                      grubefi_conf += "set root=$bootdisk',gpt%d'\n" %
>> part.realnum grubefi_conf += "\n"
>>              grubefi_conf += "menuentry 'boot'{\n"
>> -            grubefi_conf += "    linux /vmlinuz root=%s rootwait
>> %s\n" \
>> -                            % (creator.rootdev, bootloader.append or
>> "")
>> -            grubefi_conf += "    initrd /initrd.img\n"
>> +            grubefi_conf += "    linux %svmlinuz root=%s rootwait
>> %s\n" \
>> +                            % (kernel_initrd_path, creator.rootdev,
>> bootloader.append or "")
>> +            grubefi_conf += "    initrd %sinitrd.img\n" %
>> kernel_initrd_path grubefi_conf += "}\n"
>>  
>>          logger.debug("Writing grubefi config
>> %s/hdd/boot/EFI/BOOT/grub.cfg",
>
Henning Schild Dec. 14, 2020, 2:33 a.m. UTC | #3
Am Mon, 14 Dec 2020 13:28:09 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 14.12.20 13:13, Henning Schild wrote:
> > Did you check the custom kernel case? Do we not have pre/post
> > install scripting in place which deals with symlinks? Or is this
> > scripting just part of the distro?  
> 
> Yes, see https://github.com/siemens/meta-iot2050/commits/jan/ubuntu.

Sweet. I do not like the distro (at all), but i like that Isar can
cater for it if need be. A few people seem to care ;)

Henning

> Jan
> 
> > 
> > Henning
> > 
> > Am Mon, 14 Dec 2020 08:11:24 +0100
> > schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> >   
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> Ubuntu places the kernel and initrd links under /boot. Account for
> >> that.
> >>
> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >> ---
> >>  meta/classes/wic-img.bbclass                           |  2 +-
> >>  .../scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 10
> >> +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/meta/classes/wic-img.bbclass
> >> b/meta/classes/wic-img.bbclass index bbf5dd8a..dedd2bf0 100644
> >> --- a/meta/classes/wic-img.bbclass
> >> +++ b/meta/classes/wic-img.bbclass
> >> @@ -99,7 +99,7 @@ WICVARS += "\
> >>             KERNEL_NAME KERNEL_FILE"
> >>  
> >>  # Isar specific vars used in our plugins
> >> -WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO_ARCH"
> >> +WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
> >>  
> >>  python do_rootfs_wicenv () {
> >>      wicvars = d.getVar('WICVARS', True)
> >> diff --git
> >> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> >> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index
> >> 2285d2ef..67efa52e 100644 ---
> >> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
> >> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -65,6
> >> +65,10 @@ class BootimgEFIPlugin(SourcePlugin): # Create grub
> >> configuration using parameters from wks file bootloader =
> >> creator.ks.bootloader 
> >> +            kernel_initrd_path = "/"
> >> +            if get_bitbake_var("DISTRO").startswith("ubuntu"):
> >> +                kernel_initrd_path = "/boot/"
> >> +
> >>              grubefi_conf =  "serial --unit=0 --speed=115200
> >> --word=8 --parity=no --stop=1\n" grubefi_conf += "terminal_input
> >> --append serial\n" grubefi_conf += "terminal_output --append
> >> serial\n" @@ -77,9 +81,9 @@ class BootimgEFIPlugin(SourcePlugin):
> >>                      grubefi_conf += "set
> >> root=$bootdisk',gpt%d'\n" % part.realnum grubefi_conf += "\n"
> >>              grubefi_conf += "menuentry 'boot'{\n"
> >> -            grubefi_conf += "    linux /vmlinuz root=%s rootwait
> >> %s\n" \
> >> -                            % (creator.rootdev, bootloader.append
> >> or "")
> >> -            grubefi_conf += "    initrd /initrd.img\n"
> >> +            grubefi_conf += "    linux %svmlinuz root=%s rootwait
> >> %s\n" \
> >> +                            % (kernel_initrd_path,
> >> creator.rootdev, bootloader.append or "")
> >> +            grubefi_conf += "    initrd %sinitrd.img\n" %
> >> kernel_initrd_path grubefi_conf += "}\n"
> >>  
> >>          logger.debug("Writing grubefi config
> >> %s/hdd/boot/EFI/BOOT/grub.cfg",  
> >   
> 
>

Patch

diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index bbf5dd8a..dedd2bf0 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -99,7 +99,7 @@  WICVARS += "\
            KERNEL_NAME KERNEL_FILE"
 
 # Isar specific vars used in our plugins
-WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO_ARCH"
+WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
 
 python do_rootfs_wicenv () {
     wicvars = d.getVar('WICVARS', True)
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 2285d2ef..67efa52e 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -65,6 +65,10 @@  class BootimgEFIPlugin(SourcePlugin):
             # Create grub configuration using parameters from wks file
             bootloader = creator.ks.bootloader
 
+            kernel_initrd_path = "/"
+            if get_bitbake_var("DISTRO").startswith("ubuntu"):
+                kernel_initrd_path = "/boot/"
+
             grubefi_conf =  "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
             grubefi_conf += "terminal_input --append serial\n"
             grubefi_conf += "terminal_output --append serial\n"
@@ -77,9 +81,9 @@  class BootimgEFIPlugin(SourcePlugin):
                     grubefi_conf += "set root=$bootdisk',gpt%d'\n" % part.realnum
             grubefi_conf += "\n"
             grubefi_conf += "menuentry 'boot'{\n"
-            grubefi_conf += "    linux /vmlinuz root=%s rootwait %s\n" \
-                            % (creator.rootdev, bootloader.append or "")
-            grubefi_conf += "    initrd /initrd.img\n"
+            grubefi_conf += "    linux %svmlinuz root=%s rootwait %s\n" \
+                            % (kernel_initrd_path, creator.rootdev, bootloader.append or "")
+            grubefi_conf += "    initrd %sinitrd.img\n" % kernel_initrd_path
             grubefi_conf += "}\n"
 
         logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg",