Compiling the new firmware



Well now you have uploaded the new sources, I thought I do a quick fast run just to see if I could get a basic one running.

I am afraid I think you will need to make major changes to your documentation, and give us all new guidance…

  1. I compiled as you have left it and loaded it to VIM2.

Hit Enter or space or Ctrl+C key to stop autoboot – : 0
** File not found uImage **
** File not found uInitrd **
** File not found kvim2.dtb **
ee_gate_off …
Wrong Image Format for bootm command
ERROR: can’t get kernel image!

So straight up I can see that for some reason, it is expecting to find ?32 bit files? because for 64bit Linux the Image should be called Image - not uImage. Same goes for uInitrd.

  1. When I compiled linux I did:
    make -j6 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image kvim2.dtb modules

So kvim2 was produced. I also confirmed the package.conf (grabbed from somewhere else in your github) and modified it to look for kvim2

So I know that stuff was correct, since the image was made. its just the image is obviously all a mess.

NOTE:: This means you must have also messed up the VIM1 building - which means all your instructions for any model will be broken.

Also: I found also one foolish typo, so are there more?

" … console=tty0 no_con sole_suspend consoleb … "

So there is a rogue [TAB] sitting in the middle of ‘no_console_suspend’

I am also about to cancel my order for the other VIM unit. This is really poor work.


Yes, the documentation need update, and we will do this soon.

Sorry for the foolish typo, it’s my fault, we will fix it soon.
And thank you very much for your feedback.


Thanks @numbqq,

@Gouwa, @numbqq, @terry,

…documentation… (see below)

Can you please provide a time?
Whilst I could try to work out all your changes, that would be tedious. I will have enough to do making it work the way I would like, without having to decipher how you operate.

Also, are you using the drivers/scripts that are posted in this github?
Can you please ensure that you post all/any changes you have made.

There is a pattern:



So I understand the ‘new’ arm speak for kernels and that uImage is made with mkimage. Did that. Not sure that I have the load address correct.

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n Linux -d Image uImage

I now see that this and dtb are in the /boot folder. So these new build dont look like bastardised Android format Linux builds, but rather they are “proper” linux format.

Khadas - we need guidance please!


Hi freeasinbeer,

You can try the following command to generate uImage and uInitrd.

# mkimage -n 'linux-4.9' -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -d /boot/Image /boot/uImage

# mkimage -A arm64 -O linux -T ramdisk -a 0x0 -e 0x0 -n "initrd"  -d /boot/initrd.img  /boot/uInitrd


Ok thanks, I will try.

If I am making uInitrd, do I still need mkbootimg command?

If I am puttin uInitrd into /boot then do I even need ramdisk.img ?

Do I still use the ramdisk partition?


You needn’t to generate ramdisk.img.

ramdisk partition is still there, but we don’t use it. If you want, you still can use the old BOOTCOMMAND to boot the kernel.

imgread kernel ${bootdisk} ${loadaddr}; bootm ${loadaddr}


Ah, okay.
I will give it a try and see how I go.

Look forward to a new procedure from you guys.

Do you have a time for updating the steps in documentation? I hope it will be this week.

In time spend on this forum thread alone, a whole new guide probably just been written!


Sorry but it is not working.

This is the short of it:
I am in chroot - so ignore pathing etc here - files were placed correctly.

  1. Built u-boot, no modifications
  2. Built kernel, no changes.
  3. mkinitramfs -o /boot/initrd.img
  4. mkimage -n ‘linux-4.9’ -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -d /boot/Image /boot/uImage
  5. mkimage -A arm64 -O linux -T ramdisk -a 0x0 -e 0x0 -n “initrd” -d /boot/initrd.img /boot/uInitrd
  6. copied kvim2.dtb, uImage and uInitrd to /boot (if they were not already there. also copied Image and initrd.img as backup)

Made a ramdisk.img because it still wants one (because your scripts for aml-packer still expects it)
7. mkbootimg --kernel Image --ramdisk initrd.img -o ramdisk.img

  1. make the emmc image: aml_image_v2_packer -r package.conf ./ update.img

Load it to emmc and run:

start dts,buffer=00000000b3edb1b0,dt_addr=00000000b3edb1b0
parts: 3
00:      logo   0000000002000000 1
01:   ramdisk   0000000002000000 1
02:    rootfs   ffffffffffffffff 4
init_part() 293: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
check pattern success
mmc env offset: 0x6c00000
gpio: pin GPIOAO_2 (gpio 102) value is 1
Product checking: pass!
Hit Enter or space or Ctrl+C key to stop autoboot -- :  0
** File not found uImage **
** File not found uInitrd **
** File not found kvim2.dtb **
ee_gate_off ...
Wrong Image Format for bootm command
ERROR: can't get kernel image!
[rsvmem] get fdtaddr NULL!
rsvmem - reserve memory

rsvmem check                   - check reserved memory
rsvmem dump                    - dump reserved memory

rsvmem check failed
ee_gate_on ...

Hope you can spot what I am missing…


Hi freeasinbeer,

In chroot, excute the following commands to create some links.

# ln -s /boot/uImage uImage
# ln -s /boot/uInitrd uInitrd
# ln -s /boot/kvim2.dtb kvim2.dtb


I mount the rootfs similar to the docs here.
mount -o loop rootfs.img /rootfs
And I have already put the real files in /rootfs/boot. So they should be in the correct location. So no need for static links.


Please try this in u-boot command line:

# ext4ls mmc 1:5

Can you find uImage, uInitrd and kvim2.dtb?


Just tried an image where I changed u-boot as you suggested
imgread kernel ${bootdisk} ${loadaddr}; bootm ${loadaddr}

This didnt work either (got to uboot load times then stopped)

I will reload the previous image I made , and run your u-boot command
# ext4ls mmc 1:5
and report back


Ahh, do I need a link to the root of the fs ?

kvim2#ext4ls mmc 1:5
<DIR>       4096 .
<DIR>       4096 ..
<DIR>       4096 bin
<DIR>       4096 boot
<DIR>       4096 dev
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 opt
<DIR>       4096 proc
<DIR>       4096 root
<DIR>       4096 run
<DIR>       4096 sbin
<DIR>       4096 srv
<DIR>       4096 sys
<DIR>       4096 tmp
<DIR>       4096 usr
<DIR>       4096 var


Yes, you can see the CONFIG_BOOTCOMMAND that load uImage from root directory, but uImage is in /boot, so you need to create links.

#define CONFIG_BOOTCOMMAND "ext4load mmc 1:5 1080000 uImage;ext4load mmc 1:5 10000000 uInitrd;ext4load mmc 1:5 20000000 kvim2.dtb;bootm 1080000 10000000 20000000"


Success!!! Thank you.

my OCD will go nuts if I have to keep looking at those links!

Can I modify the BOOTCOMMAND ??

#define CONFIG_BOOTCOMMAND "ext4load mmc 1:5 1080000 /boot/uImage;ext4load mmc 1:5 10000000 /boot/uInitrd;ext4load mmc 1:5 20000000 /boot/kvim2.dtb;bootm 1080000 10000000 20000000"



Hi freeasinbeer,

You can have a try. It is ok too.


It works!

Well this is good. I can at least tinker and start doing what I need to do.

Can you please respond when you can regarding drivers you are using for your 4.9.40 release (wifi/bt/gpu)
It looks like the same ones from the ?fenix? folder in your github.

I hope we see a detailed howto on this all soon. I notice that I still have some problems.

I cannot hold power button and push reset to get into u-boot mode now! (at least I have serial access)

Boot Into Upgrade Mode impossible

Hi freeasinbeer,

I use these Fenix scripts to build ubuntu image. Testing still in progress, and will push to Khadas GitHub int the future.