Secure Boot, and Running KVM in ODROID-XU

fanta
Posts: 18
Joined: Thu Aug 22, 2013 12:42 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by fanta »

Correct, KVM/ARM was added in kernel 3.9 (LWN article); although the changes to u-boot shouldn't prevent older kernels from booting (I didn't think to check for that case, however).

bstemmer
Posts: 11
Joined: Mon Jan 27, 2014 7:33 pm
languages_spoken: english
ODROIDs: ODroid XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by bstemmer »

Hi guys,

i'm trying to build Kernel Version 3.13 from https://github.com/hardkernel/linux.git, but I'm getting Errors.
From where do you get a working version of Kernel 3.13 for the Odroid XU board?

tklengyel
Posts: 16
Joined: Sat Feb 08, 2014 5:09 am
languages_spoken: english
ODROIDs: XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by tklengyel »

mdrjr wrote:NICE :)

Merged. It does requires 3.13 right? since I didn't saw any KVM/Virt on 3.4
Are signed binaries available for the new u-boot somewhere?

mdrjr
Site Admin
Posts: 11793
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 1 time
Been thanked: 41 times
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by mdrjr »

Maybe all over this thread?

tklengyel
Posts: 16
Joined: Sat Feb 08, 2014 5:09 am
languages_spoken: english
ODROIDs: XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by tklengyel »

mdrjr wrote:Maybe all over this thread?
I meant beside this thread, like an official release channel or something (a link on the wiki etc..).

mdrjr
Site Admin
Posts: 11793
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 1 time
Been thanked: 41 times
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by mdrjr »

tklengyel wrote:
mdrjr wrote:Maybe all over this thread?
I meant beside this thread, like an official release channel or something (a link on the wiki etc..).
Not yet, because it relays on a "unstable" kernel yet.

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

Fanta, you're the best! I hope you guys won't mind if I post here a detailed how-to burn Fanta's U-Boot on an SD-card for ODROID-XU for who else wants to start an OS in HYP mode on the board.

NOTE here: you need a working SD card reader for the following process

Assuming you have an SD-card with a working OS for ODROID-XU, here's how you can replace the U-BOOT you have on it with FANTA's one, which will boot your OS in HYP mode:

1. Install an UBUNTU on your PC (easiest way if you don't have it yet -> install one on VirtualBox; I used VirtualBox 4.3.2 r90405 and installed in it a 32-bit UBUNTU 12.04 LTS); open your UBUNTU OS, you'll be working in it from this moment on

2. Make a directory where you'll put your binaries, let's call it ~/$(UBOOT_BIN_DIR); from https://github.com/hardkernel/linux/tre ... -pre-built download bl1.hardkernel.bin.signed and tzsw.hardkernel.bin.signed and put these files in ~/$(UBOOT_BIN_DIR)

3. From admin's post (odroid) on page 3 of this topic where he states:
odroid wrote:Hi fanta,
We've signed. I hope everything goes well.
fanta_spl_test_3.zip
download the file fanta_spl_test_3.zip, unzip it and copy the unzipped file smdk5410-spl.bin.signed in ~/$(UBOOT_BIN_DIR).

4. Open a terminal window and run "sudo apt-get install git binutils-arm-linux-gnueabihf gcc-4.6-arm-linux-gnueabihf-base gcc-arm-linux-gnueabihf dd" => this will ensure you have all the tools needed for this process installed. Keep the terminal window open because we'll run a few more commands

5. In the terminal run "sudo git clone --depth 1 -b odroid-v2012.07-virt https://github.com/FiachAntaw/u-boot ~/UBOOT_OXU_FANTA"

6. Replace ~/UBOOT_OXU_FANTA/arch/arm/cpu/armv7/config.mk with the one in the attached zip file.

7. From one terminal window run:
  • cd ~/UBOOT_OXU_FANTA
    sudo export ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
    sudo make distclean
    sudo make smdk5410_config
    sudo make
If everything went well you should find the file u-boot.bin in ~/UBOOT_OXU_FANTA; copy it to ~/$(UBOOT_BIN_DIR)

8. Insert your SD card in your PC's SD card reader; using dmesg or lsblk might help you identify the sd-card device; assuming it is /dev/sdb, run the following commands:
  • cd ~/$(UBOOT_BIN_DIR)
    sudo dd if=bl1.hardkernel.bin.signed of=/dev/sdb bs=512 seek=1
    sudo dd if=smdk5410-spl.bin.signed of=/dev/sdb bs=512 seek=31
    sudo dd if=u-boot.bin of=/dev/sdb bs=512 seek=63
    sudo dd if=tzsw.hardkernel.bin.signed of=/dev/sdb bs=512 seek=719
If your board doesn't boot:
- Try to write only smdk5410-spl.bin.signed and u-boot.bin (thanks go to jsubirat for this)
- If you've got a HDMI cable connected, unplug it and power-up the board; if it does boot and you see serial output, you can plug it back in


That's all, your OS should now be booted in HYP mode (if the OS is configured with and supports KVM it should work :d).

EDIT: sudo might not be needed in some of the above commands, I've just put it just to be sure no problems arise if it's missing.
Attachments
config.zip
(1010 Bytes) Downloaded 308 times
Last edited by Zozel on Tue Mar 18, 2014 7:47 pm, edited 3 times in total.

Jabberwock
Posts: 33
Joined: Wed Oct 30, 2013 6:25 pm
languages_spoken: english, russian
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Jabberwock »

Great news! Fanta, I admire you :)
Zozel, thank you for good manual, but one needs no "sudo" for building, and do need "sudo" for dd.

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

ignore this message
Last edited by Zozel on Wed Jan 24, 2018 11:20 pm, edited 1 time in total.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Dear all,

First of all, many thanks to everybody involved in having an operating KVM on the XU. I'm very interested on this aspect and I highly appreciate all the work you've done.

I followed the instructions in Zozel's tutorial, except that I directly built the u-boot without cross-compiling: directly on the XU. Once I had all the necessary files, I followed with the card flashing on my computer. I actually first flashed the test image available at http://forum.odroid.com/viewtopic.php?f=55&t=2875 and then applied the 4 flashing steps described in Zozel's tutorial. Specifically, I did:

sudo xzcat ./linaro_ubuntu_14.01_server_20140228.img.xz | dd of=/dev/mmcblk0 bs=10M

At this point, I tested the original image and it booted correctly, with the 3.13 kernel already included in it, and displaying the output into the serial console. Then I executed:

sudo dd if=bl1.hardkernel.bin.signed of=/dev/mmcblk0 bs=512 seek=1
sudo dd if=smdk5410-spl.bin.signed of=/dev/mmcblk0 bs=512 seek=31
sudo dd if=u-boot.bin of=/dev/mmcblk0 bs=512 seek=63
sudo dd if=tzsw.hardkernel.bin.signed of=/dev/mmcblk0 bs=512 seek=719

After these steps, I switched the XU on but I didn't get anything on the serial console, all is black. Does anyone have a clue of what's wrong? What have I done wrong? Many thanks for your help.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

I just tried the exact steps now, with cross-compiling. Same result. :(

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

jsubirat, have you got any HDMI cable connected? If so, get it out, power-up the board and see if any serial output appears. You can reconnect the HDMI cable after you see serial output.
If I leave my HDMI cable plugged in, the board won't boot. I don't know why that happens.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Zozel, thanks for your answer. In fact I don't, I directly connect by serial cable and by ssh over the Ethernet adapter. :( I understand that you flash the different files directly to the device (i.e. /dev/mmcblk0), and not to the first partition, where the kernel is (/dev/mmcblk0p1). I've observed that there is another u-boot.bin in the first partition (FAT). Have you tested your tutorial against this image?

http://dn.odroid.com/Ubuntu_XU/20140228 ... 228.img.xz

And an additional question, in case you know: does this image come with KVM enabled in the kernel?

Many thanks for the help!

fanta
Posts: 18
Joined: Thu Aug 22, 2013 12:42 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by fanta »

Good tutorial Zozel :D! That's basically the same as what I did, although I built on Arch Linux so I used the launchpad toolchain instead of the Ubuntu one, which is probably why you had to change arch/arm/cpu/armv7/config.mk.

@jsubirat: In my experience no serial output at all usually means one or more of the bl1, bl2, u-boot or tzsw aren't signed (that doesn't seem to be the case here), haven't been loaded to the right offsets or are hanging before getting to the u-boot stage where serial output is enabled. Did you flash them on the ODROID-XU directly or on a separate computer? If you can, try flashing them from a different computer in case the ODROID-XU kernel is doing something funny. Also, are you using an SD card or the eMMC module?

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

@fanta, I'm using a microSD card, and I flashed everything from a separate computer. I used the files mentioned in Zozel's tutorial. From my understanding, the u-boot.bin is not signed by definition, as I'm compiling it myself, right? Or is there any place or missing step in which I can get it signed? I use your bl2 (smdk5410-spl.bin.signed), the u-boot.bin I compile by myself (not signed, I assume) and then the original odroid files: bl1 (bl1.hardkernel.bin.signed) and tzsw (tzsw.hardkernel.bin.signed). Many thanks for your work and your help!

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

Fanta, do you have any idea why the latest U-Boot troubles many of the current OSs for XU (found at http://www.odroid.in and http://dn.odroid.com)?
So far I've tried ubuntu 12.04.3 LTS desktop, xubuntu 13.10 desktop and with the android found here http://dn.odroid.com/ODROID-XU/Android_ ... 09-23-2013 and they all freeze at some point.
I noticed ubuntu stays a bit longer at "Uncompressing Linux..." if I replace the original uboot of the image with yours (which is now merged with the hardkernel one), which points me to some caching problem. Sometimes UBUNTU reaches the login window but if I move the mouse and click the login textbox it freezes. Android freezes at the logo. I'll try to produce some logs and print them out here.

Until then, do you guys know where I can find an OS (prebuilt or source code, linux/android) that works with ODROID-XU and with the latest U-Boot (which supports entering the kernel in HYP mode) and that has a desktop?
I'll try with other OSs in the meantime (some of the newest).
Cheers
Last edited by Zozel on Tue Mar 18, 2014 9:24 pm, edited 2 times in total.

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

jsubirat, I'll start with your image, maybe we hit two birds with one stone

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Guys!!!!! Success!!!! What I did was to simply leave the original bl1 and tzsw of the image I was using untouched (they are already there :D), and simply flash the bl2 (smdk5410-spl.bin.signed) and the u-boot.bin. Look at this beautiful log output:

[ 0.170000] CPU: All CPU(s) started in HYP mode.
[ 0.170000] CPU: Virtualization extensions available.

Now it's time for me to recompile the 3.13 kernel with KVM support. I'll keep you posted! :) MANY thanks!

Zozel
Posts: 38
Joined: Tue Nov 19, 2013 8:53 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Zozel »

jsubirat, beautiful output! Thanks for your feedback, I mis-written that part, although I was doing the same thing here...

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Hi again. I compiled the kernel in https://github.com/hardkernel/linux/tre ... 3.y-linaro . Although I could enable the Virtualization option, KVM was not available inside it. I manually edited the .config file and added the two config options fanta mentioned in a previous post (CONFIG_LPAE and CONFIG_KVM), but this trick didn't work. @fanta, what kernel have you used to run KVM on the Odroid? Is there any place I can get a prebuilt version of it (the uImage, uInitrd and the dtb)? Many thanks for your help!

Jabberwock
Posts: 33
Joined: Wed Oct 30, 2013 6:25 pm
languages_spoken: english, russian
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Jabberwock »

You must not edit .config manually because LPAE and KVM options can require more options to be enabled, better use make menuconfig to enable options.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

But KVM doesn't appear under menuconfig inside the Virtualization menu... :(

Jabberwock
Posts: 33
Joined: Wed Oct 30, 2013 6:25 pm
languages_spoken: english, russian
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Jabberwock »

It does, after you enable LPAE in "System Type" submenu ;)
You can type '/' to search for kvm during menuconfig and see its dependencies:

│ Symbol: KVM [=n]
│ Type : boolean
│ Prompt: Kernel-based Virtual Machine (KVM) support
│ Location:
│ (1) -> Virtualization (VIRTUALIZATION [=n])
│ Defined at arch/arm/kvm/Kconfig:19
│ Depends on: VIRTUALIZATION [=n] && ARM_VIRT_EXT [=y] && ARM_LPAE [=n]
│ Selects: PREEMPT_NOTIFIERS [=n] && ANON_INODES [=y] && HAVE_KVM_CPU_RELAX_INTERCEPT [=n] && KVM_MMIO [=n] && KVM_ARM_HOST [=n]

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Many thanks, Jabberwock! I could enable KVM this time. I enabled everything related to KVM except the CONFIG_KVM_ARM_TIMER, but KVM didn't work anyway (nothing appears at boot up). :(

Jabberwock
Posts: 33
Joined: Wed Oct 30, 2013 6:25 pm
languages_spoken: english, russian
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Jabberwock »

What do you mean by "nothing appears at boot up"?

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

@Jabberwock: I don't get the lines:

[ 0.785000] kvm [1]: interrupt-controller@10484000 IRQ25
[ 0.785000] kvm [1]: Hyp mode initialized successfully

:(

Jabberwock
Posts: 33
Joined: Wed Oct 30, 2013 6:25 pm
languages_spoken: english, russian
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by Jabberwock »

This message is printed with kvm_info, at info log level that can be hidden by default. Check if /dev/kvm node is present.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

@Jabberwock: I tried, but it wasn't there. I tried compiling with just KVM and some network filesystems enabled, and although the kernel crashed at bootup, I could see the KVM messages this time. I'm currently recompiling with just the KVM (but not the timer's) option and not NFS, and see if that works. I'll keep working with the different kernel options until I find a stable configuration suitable for my needs. I'll keep you posted. :)

bstemmer
Posts: 11
Joined: Mon Jan 27, 2014 7:33 pm
languages_spoken: english
ODROIDs: ODroid XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by bstemmer »

hi jsubirat,

i'm also in the same state as you. I'm running Kernel 3.13 in HYP mode with my custom built kernel. After that i activated KVM in menuconfig.
Build also is ok. But when i try to boot, the Odroid stick when Starting Kernel:

27729 bytes read
## Booting kernel from Legacy Image at 40007000 ...
Image Name: Linux-3.13.0+
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4796768 Bytes = 4.6 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 41f00000
Booting using the fdt blob at 0x41f00000
Loading Kernel Image ... OK
OK
Using Device Tree in place at 41f00000, end 41f09c50

Starting kernel ...

How did you fix that...How far are you with trying the Kernel options?

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Hi guys, no success so far... Find in these pastebins the boot process using the default kernel config with CONFIG_LPAE and CONFIG_KVM enabled but CONFIG_KVM_ARM_TIMER disabled, using the default boot.ini of the image: http://pastebin.com/vd4vpb5U

Then I adapted the boot.ini to match the one used by fanta, but the result was the same: http://pastebin.com/LfhQZa3n

Can anybody guess what I'm doing wrong? :(

@bstemmer, have you also compiled the uInitrd? Have you followed the process at the bottom of http://odroid.com/dokuwiki/doku.php?id=en:odroid-xu ?

bstemmer
Posts: 11
Joined: Mon Jan 27, 2014 7:33 pm
languages_spoken: english
ODROIDs: ODroid XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by bstemmer »

Hi, no, i'm not building the uInitrd. Because as i see it in the bootlog of fanta (working with kvm and qemu) he does not load the uInitrd in boot.ini.
But i have tried the process of your link with zImage and also a version from: http://rwmj.wordpress.com/2013/12/08/co ... attempt-3/. Here they use uImage. Both processed work for me without kvm enabled. When i enable it in menuconfig i'm always stuck at Starting Kernel...

see here: http://pastebin.com/7q2mT273

Any idea what the problem might be?

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

I think that when you copied the command, you missed the end of the line. See, in your log you have:

setenv bootcmd "fatload mmc 0:1 0x40000000 zImage; fatload mmc 0:1 0x46000000 exynos5410-odroidxu.dtb; bootz 0x40"

And I think that in your case it should be:

setenv bootcmd "fatload mmc 0:1 0x40000000 zImage; fatload mmc 0:1 0x46000000 exynos5410-odroidxu.dtb; bootz 0x40000000 - 0x46000000"

I just tried on my side and it makes no difference when booting without the uInitrd, the result is the same.
Last edited by jsubirat on Thu Mar 20, 2014 7:46 pm, edited 1 time in total.

bstemmer
Posts: 11
Joined: Mon Jan 27, 2014 7:33 pm
languages_spoken: english
ODROIDs: ODroid XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by bstemmer »

na, this was only a copy paste error from my terminal window. I have doublechecked the settings, same result.
Do you also build the modules?

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Yes I did

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

I just wanted you to know that...

root@odroid:~# ls /dev/kvm
/dev/kvm

TADA! :D In my case, the problem I had was that in this tutorial (http://rwmj.wordpress.com/2013/12/08/co ... attempt-3/) it uses a LOADADDR=40008000 instruction just before the make. I removed it, and it worked! I compile the uImage, zImage, dtb and modules, but I don't use the zImage. So, in my case:

---On my laptop---
- I read the whole forum thread and thanked everyone involved in making KVM on Odroid-XU a reality. Thanks again, guys! :)
- I flashed the image in http://forum.odroid.com/viewtopic.php?f=55&t=2875 . The image was not available at the link mentioned in this post, but I got it from http://dn.odroid.com/Ubuntu_XU/20140228 ... 228.img.xz
- I used gparted to increase the partition size to fill the whole microSD.
- I compiled fanta's u-boot as described by Zozel but I only flashed the u-boot.bin and the smdk5410-spl.bin.signed (leaving the original bl1 and tzsw).

---On the Odroid-XU---
- I got the 3.13.0+ kernel from https://github.com/hardkernel/linux/tre ... 3.y-linaro using git, and compiled it following the instructions in: http://odroid.com/dokuwiki/doku.php?id=en:odroid-xu . These are orientative steps. Adapt them according to your needs and kernel version. In my case, I compiled the kernel with "make -j5 uImage dtbs zImage modules", I replaced the files in the first partition of the microSD with the new ones (keeping the old ones as a backup). What was important for me at this step was NOT to include the LOADADDR=40008000 before the make, as I had seen in other tutorials.
- Rebooted and... TADA!

I hope this is useful for later people to come! :)

User avatar
memeka
Posts: 4420
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART
Has thanked: 2 times
Been thanked: 60 times
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by memeka »

so, you got the a vm booting? what's available to it?

youka
Posts: 163
Joined: Wed Oct 09, 2013 8:38 pm
languages_spoken: english
ODROIDs: Odroid XU+E, U2, U3, XU3, XU4 + Cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by youka »

Hey jsubirat, I've been following your posts here silently since I've been having the same issue of getting stuck at "Starting kernel..." I've compiled the kernel without LOADADDR as you've mentioned, but I'm still not able to get it to boot. I'm thinking I've probably got the wrong addresses in my boot.ini

Could you post how your's looks, please?

youka
Posts: 163
Joined: Wed Oct 09, 2013 8:38 pm
languages_spoken: english
ODROIDs: Odroid XU+E, U2, U3, XU3, XU4 + Cloudshell
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by youka »

Nevermind, I got it working. It was a stupid mistake, I didn't put the " - " between the two addresses by the bootz command, as I'm also not using uInitrd

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

@fanta: didn't you get a message "XML error: No PCI buses available" when starting the VM? I tried to start it using libvirt, but to no avail. All the VM files have been tested to work on another platform and the XML is correct. I tried to recompile the kernel and to include PCI support, but then the kernel doesn't boot (it prints a stacktrace). I don't know what else to try. :(

fanta
Posts: 18
Joined: Thu Aug 22, 2013 12:42 pm
languages_spoken: english
ODROIDs: ODROID-XU
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by fanta »

@jsubirat: That seems odd; I just used qemu from the command line directly and didn't encounter any issues. I don't think it's a problem with the host kernel, the message seems to be complaining that you're trying to allocate a device to a PCI bus but one isn't emulated. What guest architecture are you targeting, and what devices are you attaching? The vexpress-a15 for example doesn't have a PCI bus; so trying to attach certain devices (e.g. SCSI and IDE controllers/drives, virtio devices other than the 'virtio-*-device' family) could cause that message.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

@fanta: I'm using a vexpress-a15, indeed. But the weird thing is that I'm using the exact same kernel, uInitrd, dtb, qcow2 image and libvirt xml descriptor for the guest VM that I used in another board, an Arndale board. And this VM boots correctly there and without this error message... :( I just use virtio devices, but I checked in the kernel configuration and even though all virtio drivers are included, the virtio PCI driver is not, as the PCI support is not included.

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

That's interesting: http://releases.linaro.org/13.06/compon ... emu-linaro

"fixes to the VersatilePB and Realview model PCI controller"

I'll work on that. :)

jsubirat
Posts: 39
Joined: Mon Oct 28, 2013 8:57 pm
languages_spoken: english, catalan, spanish
ODROIDs: ODROID-XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by jsubirat »

Thanks fanta for pointing me in the correct direction. I compiled qemu-linaro and libvirt from sources and it worked correctly this time, at last. Many thanks for all your help!

dragao-azul
Posts: 14
Joined: Sun Nov 03, 2013 10:25 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by dragao-azul »

Hello!

Although my question is not entirely related to the topic I believe someone might be able to help me here:

I'm trying to enable the performance counters on the ODROID-XU, I get a problem which was already reported many times where the cycle counter works but the other counters report 0 values. Right now I'm using kernel 3.4 since I'm afraid the more recent versions (I found 3.13 and 3.14 ported from linaro on git) are not stable yet (correct me if I'm wrong, please).

I think the problem (also as reported before in other topics) is the assertion of the NIDEN or DBGEN bits which allow debugging. They seem to have to be activated by some peripheral, which I'm not sure is present or not, but I'm not yet sure if these are the only bits capable of enabling the performance counters.

Nevertheless the relevance of this topic to my problem lies on the secure mode: I believe the board is currently running on the non-secure mode, chosen at boot time, and I'd like to run it in the secure mode so that I can look into all control registers. I believe that since this is for development purposes that won't be a critical issue, and thus I'd like to ask for some help enabling it and, if anyone as any idea, a direction on how to enable the performance counters.

But first thing first: I took a look at the assembly code on those binaries which where signed and I think the following portion of code is responsible for bringing the board to the non-secure world:

Code: Select all

	/* Configure SCR (NS, !IRQ, !FIQ, !EA, HCE, SIR) */
	mrc	p15, 0, r0, c1, c1, 0
	orr	r0, r0, #(SCR_NS)
	bic	r0, r0, #(SCR_IRQ | SCR_FIQ | SCR_EA)
	orr	r0, r0, #(SCR_HCE | SCR_SIR)
	mcr	p15, 0, r0, c1, c1, 0
This is taken from the file on this post. Now as I said I'm only interested on the performance counters and (for now at least) not on any other extensions, do you think I'll run into any problems by staying on secure world and working with the other extensions enabled? With time I can probably make a file of my own but since Fanta already invested so much time in this I believe he arrived to a stable enough version which I can hopefully use.

Thanks in advance for any help!

EDIT: I haven't yet found another alternative to enable the performance counters (but am still looking), I did find this, which states that an external peripheral to the core is needed to enable the debug bits I need. Can anyone with a better knowledge of the Exynos 5410 and Odroid-XU tell me if this is available?

suriyan
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by suriyan »

Hello dragao-azul,
Did you check this -> http://saiparancs.wordpress.com/2012/12/18/172346963/. Its for the Exynos4412 but I am guessing it might be quite similar to he Exynos5410. This might give you something to dig further.
- Suriyan

dragao-azul
Posts: 14
Joined: Sun Nov 03, 2013 10:25 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by dragao-azul »

Hello!

Thanks for your reply, no I hadn't stumbled upon that link before, but unfortunately after a quick read it does not seem to be my problem. I'll still look further into it, but the problem it is reporting is the interrupts caused by the performance counters (on overflow) where not being registered. This might justify perf not reporting anything, but in my case it even says 0 events are available which is strange because even without interrupts they should be there.

Nevertheless I think the problem is worse because with the help of a small kernel module with direct access to the counters I verified they were never incremented (except the cycle counter), which is the reported expected behaviour on the manual when non-invasive debug is disabled (which I also verified it is).

The question remains on how to assert the NIDEN or DBGEN bits... Any other suggestions? Is it at all possible to get access to the Exynos 5410 manual or only through Samsung?

suriyan
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by suriyan »

Hello dragao-azul,
Your problem definitely seems interesting! I guess this has been on the forum for a while (I saw some older posts dating back to Oct 2013!).
I have tried to get hold of the manuals (exynos5410) from Samsung, but have not been successful at all. I guess you too should pester them :-)
BTW, I was googling on your behalf and found a #define EXYNOS5_TZPC1_DECPROT1SET 0x10110810
In https://chromium.googlesource.com/chrom ... vel_init.S
I see:
/*
* It is for EVT0 silicon only and should be removed as soon as
* we can deprecate EVT0.
*/
ldr r0, =EXYNOS5_TZPC1_DECPROT1SET
mov r1, #0xF /* [DBGEN, NIDEN, SPIDEN, SPNIDEN] = [1,1,1,1] */
str r1, [r0]

I don't know how much the above is relevant, but something to investigate?
- Suriyan

dragao-azul
Posts: 14
Joined: Sun Nov 03, 2013 10:25 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by dragao-azul »

I contacted Samsung trough their contact page, I'm not sure I'll get any useful answer, but let's hope for it!

On the meantime I did look at that file and went to find the definition of that constant here. I'm just not sure if that address is valid for this specific CPU nor what it does exactly, a Samsung manual would really come in handy... Maybe someone from Hardkernel can verify if this is the right register to write to? It appears to be memory mapped, but again I can only verify that with a manual...

EDIT: Ok, you had already found the definition, but the question remains, that does not appear to be an ARM register (should be one of those that is implementation specific) and thus I can only really verify what it does and if it is on this SoC with a manual...

EDIT2: I was also checking the uboot code on git and I came across this:

Code: Select all

#define PMU_DEBUG_OFFSET		0x00A00
This is used on the init code, but I think this is Power and not performance related

Thanks!

pytaloud
Posts: 1
Joined: Fri Feb 21, 2014 6:58 pm
languages_spoken: english
ODROIDs: ODROID XU+E
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by pytaloud »

Hi all,

I am trying to reproduce what has been described in this thread to enable KVM/ARM on my ODROID-XU board. I use basically the setup described by jsubirat in the following post:
http://forum.odroid.com/viewtopic.php?f ... =80#p34271

I managed to get the following:

[ 0.155000] CPU: All CPU(s) started in HYP mode.
[ 0.155000] CPU: Virtualization extensions available.

and

[ 0.845000] kvm [1]: interrupt-controller@10484000 IRQ25
[ 0.845000] kvm [1]: Hyp mode initialized successfully

But I get the following issue, in kernel 3.13+ init:

[ 2.910000] xhci-hcd xhci-hcd.4.auto: xHCI Host Controller
[ 2.920000] xhci-hcd xhci-hcd.4.auto: new USB bus registered, assigned bus number 1
[ 2.930000] Unable to handle kernel paging request at virtual address 6784455c
[ 2.935000] pgd = c0003000
[ 2.940000] [6784455c] *pgd=80000040005003, *pmd=00000000
[ 2.950000] Internal error: Oops: 206 [#1] SMP THUMB2

I have a working 3.13+ kernel (https://github.com/hardkernel/linux/tre ... 3.y-linaro / odroidxu_defconfig) in which LPAE is deactivated.
I tried to recompile, only activating LPAE in make xconfig (not KVM nor VIRTUALIZATION), and I get the same problem.

Can anybody help? I can share the .config file and a log of my kernel init log if needed.

Thanks a lot, in advance, for you help,

Best regards,

Pierre-Yves


---

I have finally managed to get kernel boot with kvm activated on my board. The issue was that I was using an old 3.13+ git fetch. Fetching the source code from yesterday, it worked perfectly.

Thanks a lot for the great job done so far.

Best regards,

Pierre-Yves
Last edited by pytaloud on Tue Jun 10, 2014 10:19 pm, edited 1 time in total.

hnaves
Posts: 22
Joined: Mon May 05, 2014 12:01 am
languages_spoken: portuguese, english
ODROIDs: ODROID-XU Lite
Has thanked: 0
Been thanked: 0
Contact:

Re: Secure Boot, and Running KVM in ODROID-XU

Post by hnaves »

fanta wrote:I've played around a bit with the new signed images (thanks again for signing them), and it looks like the second image worked in that it let unsigned code run in the 'BL2' stage of boot, which led to a few interesting things (the most notable being that the 'secure' iRAM space between 0x02030000-0x02073000 is not secured in BL2), but there's not much we can do at that point in the boot process other than load a signed TZSW with SMC_CMD_COLDBOOT.

As for the TZSW stub, at first I thought it was just silently failing verification, but after looking at it a bit closer it looks like it did work but I had the meaning of the NS bit backwards; I was setting it to 1 (Non-Secure mode) instead of clearing it (Secure mode). I've attached another TZSW, this one does a few extra things (like saving the CPU state to memory) but I'm pretty confident it'll work (I included source in case anyone wants to look at it, put it in the U-boot directory and run 'make tzsw.o' to build it). Could I get this one signed too? Attachments don't seem to be working for me for some reason, so I uploaded it to Dropbox: https://dl.dropboxusercontent.com/u/145 ... a_tzsw.tar
Hi fanta,

Congratulations on your great work!
I have a couple of questions for you: when you say that the iRAM space is not secured in BL2, do you mean that you can access this region from the non-secure world? Another thing, do you think it is possible to dump the contents of iROM, or of the in-memory decrypted BL1?

Best

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests