Skip to content

Testing BKMs

Sathyanarayanan Kuppuswamy Natarajan edited this page Apr 24, 2017 · 1 revision

How to test the kernel using Qemu

First setup the environment by following the kdev setup instructions detailed in home page.

source scripts/setenv.sh
export SELECTED_TARGET_DIR=target-recipes/qemu/x86_64
build.py

Once the build is successful, you can test the kernel in Qemu using following command.

if the kernel is built only with initramfs,

qemu-system-x86_64 -enable-kvm -m 128M -kernel out/qemu_x86_64/images/bzImage.efi -append "console=ttyS0 rdinit=/sbin/init" -serial stdio

if the kernel is built with external rootfs,

qemu-system-x86_64 -enable-kvm -m 128M -hda out/qemu_x86_64/images/rootfs.img.ext2 -kernel out/qemu_x86_64/images/bzImage.efi -append "console=ttyS0 root=/dev/sda init=/sbin/init" -serial stdio

How to test in external hardware

First setup the environment by following the kdev setup instructions detailed in home page. In this example, we will be using joule hardware as target.

source scripts/setenv.sh
export SELECTED_TARGET_DIR=target-recipes/bxt/joule
build.py

Once the build is successful, you can use following instructions to test the kernel.

  • Take a > 4GB USB drive and connect it to your host. Then format the USB drive(/dev/sdX) using gparted and create boot(fat32) and rootfs(ext4) partition. Also make sure the boot partition is bootable by setting the boot flag.

  • mount the boot partition(/dev/sdX1) to /mnt/boot

  • Copy out/bxt_joule_pr0/images/bzImage.efi to /mnt/boot/

  • if the external rootfs option is used, copy the rootfs using following command
    sudo dd if=out/bxt_joule_pr0/images/rootfs.img.ext2 of=/dev/sdX2 bs=10M

  • Create startup.nsh script under /mnt/boot and add following content.

    echo -off
    echo Welcome to kdev bootable disk
    fs0:
    # if external rootfs option is used then use following command.
    bzImage.efi console=<console-dev> root=/dev/sda2 rw init=/sbin/init
    # if initramfs option is used then use following command.
    bzImage.efi rw console=<console-dev> init=/init

  • Unmount the usb drive(/dev/sdX) from your host.

  • Connect this usb drive to your target and boot from the usb drive.

Clone this wiki locally