Community
cancel
Showing results for 
Search instead for 
Did you mean: 
KM4
Beginner
1,106 Views

Joule ref-os-iot : How do I build and Flash the Kernel Image Independently?

Hi all,

I successfully compiled and flashed the ref-os-iot yocto build for Intel Joule.

However, I have certain logics unexplained. I will explain what i attempted to figure out.

  1. How to generate a UEFI configuration file (/boot/EFI/bootx64.efi) file from the Kernel Image (bzImage) generated?
    • I notice that a run.do_uefiapp yocto script embeds Kernel Image and other files using objcopy.
    • But, I cannot find those files (machine.txt, cmdline, etc.) in the Yocto build.
    • Also, any references which explains UEFI booting process would be welcome
  2. How WIC generates Bootable Images from the Generated Rootfs?
    • I read some articles on how WIC uses the kickstart file (refosiot.wks) to generate the final image full-image-intel-5xx-64.wic.xz.
    • Exactly which options are to be used with wic to generate the Image remains a puzzle to me
  3. Why the full-image-intel-5xx-64.wic.xz Image generated is always a live booting Image?
    • full-image-intel-5xx-64.wic which we flash in the bootable USB / SD card always prompts to install in the EMMC, or performs a live boot.
    • I understand that the rootfs is compressed as squashfs in the Image generated.
    • I cannot figure out what to change in the configuration to generate an actual Image which i can flash and run in the SD card / USB drive.

P.S:

I have attached the above referred run.do_uefiapp python script file, and refosiot.wks WIC Kickstart file.

I beleive you won't require the 1.2G full-image-intel-5xx-64.wic.xz

0 Kudos
6 Replies
idata
Community Manager
75 Views

Hi Kanna,

 

 

Thanks for your interest in the Intel® Joule Platform.

 

 

Those are very good questions that I would like to investigate a little bit more and as soon as I have useful information I'll let you know.

 

 

I'll appreciate your patience during the meantime.

 

 

Regards,

 

-Yermi A.

 

KM4
Beginner
75 Views

Hi Yermi,

Thanks for your interest in this topic. Is there any update on this query?

TIA.

regards,

Kannan M.

idata
Community Manager
75 Views

Hi Kannan,

 

 

At this moment we are still working on your query, I would like to let you know that as soon as I have any updates I'll let you know.

 

 

Regards,

 

-Yermi A.

 

idata
Community Manager
75 Views

Hi Kannan,

 

 

Thank you for your patience. We would like to update you with the following information:

 

  1. How to generate a UEFI configuration file (/boot/EFI/bootx64.efi) file from the Kernel Image (bzImage) generated?
    • bootx64.efi is generated during build via the do_uefiapp function. One can call the function via bitbake like so:
bitbake -f -c uefiapp full-image
  • Next, the xboot64.efi can be copied to the boot partition. See steps below.
For iterative kernel development, the above method is quite time consuming and it's faster to compile the kernel in devshell and then copy the generated bzImage via objcopy on device:
  • Kernel compilation:

bitbake -c devshell virtual/kernel

 

make -j8

 

# Kernel build dir is printed in the first line of make

 

scp /arch/x86/bzImage root@:/tmp/
  • On device:

# mount efi partition so xboot64.efi can be updated

 

mkdir /tmp/boot_part

 

mount /dev/mmcblk1p1 /tmp/boot_part

 

objcopy --remove-section .linux /tmp/boot_part/EFI/BOOT/bootx64.efi /tmp/bootx64-tmp.efi

 

objcopy --add-section .linux=/tmp/bzImage --change-section-vma .linux=0x40000 /tmp/bootx64-tmp.efi /tmp/bootx64-new.efi

 

# replace the bootx64.efi with the new file

 

cp /tmp/bootx64-new.efi /tmp/boot_part/EFI/BOOT/bootx64.efi

 

umount /tmp/boot_part

 

reboot

  • Kernel command line is built from pieces. e.g. meta-ref-os-iot/meta-5xx/conf/machine/intel-5xx-64.conf:

APPEND_append = " console=ttyS2,115200 video=efifb maxcpus=4 reboot=efi kmemleak=off net.ifnames=0"

  • Device boot process/flow is as follows: BIOS -> bootx64.efi -> kernel -> ramdisk -> user space (systemd/init)
    • bootx64.efi has kernel, kernel command line and ramdisk embedded in it

2. How WIC generates Bootable Images from the Generated Rootfs?

  1. Ref-OS-IoT uses intel-refkit as base and WIC generation is done in that layer. WIC itself is part of meta-openempedded layers and is something that comes from yocto/oe.
  2. .wks file is this: intel-iot-refkit/meta-refkit/wic/refkit-directdisk.wks.in

3. Why the full-image-intel-5xx-64.wic.xz Image generated is always a live booting Image?

  1. This is how the development team has decided to implement this feature. It's similar to Ubuntu, you can try and install it in case you are interested in.
  2. rootfs is not using squashfs. The wic image is an uncompressed image (three partitions stitched into one), but wic.xz is a compressed image.
  3. I cannot figure out what to change in the configuration to generate an actual Image which I can flash and run in the SD card / USB drive.
    • Remove the installer and you'll have a booting image without any prompts during boot. Remove/comment out this line (meta-ref-os-iot/meta-5xx/conf/local.conf.sample):

PACKAGE_INSTALL_append_pn-refkit-initramfs = " initramfs-framework-installer"

 

Hope this information helps.

 

 

Regards,

 

-Yermi A.
idata
Community Manager
75 Views

Hi Kanna,

 

 

I would like to know if you have any other questions.

 

 

Regards,

 

-Yermi A.

 

KM4
Beginner
75 Views

Hi Yermi,

Thanks for your reply. The steps mentioned were useful.