Use Fenix scripts to build your own ubuntu image


Whats that change doing? enabling or disabling 64bit inodes? Did the arm64 libraries for mkfs.xx (and friends, fsck etc…) finally catch up to amd64 or something?


the exact content of the change can be displayed on github, there were 3 commits in the past days;

@numbqq :
I have rebuilt my firmware, by using

git pull
source env/

building the img and flashing the EMMC seemed to be as successfull as before
but , again, I got the following errors (in bold case) at boot time:

BULKcmd[     burn_complete 1]
reboot mode: normal
bl31 reboot reason: 0xd
bl31 reboot reason: 0x1
system cmd  1.
TE: 127612

BL2 Built : 20:32:17, Sep  8 2017. 
gxl g6296b83 -

set vcck to 1120 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
DDR3 chl: Rank0+1 @ 768MHz - PASS
Rank0: 1024MB(auto)-2T-11
Rank1: 1024MB(auto)-2T-11
DataBus test pass!
AddrBus test pass!
Load fip header from eMMC, src: 0x0000c200, des: 0x01400000, size: 0x00004000
New fip structure!
Load bl30 from eMMC, src: 0x00010200, des: 0x01100000, size: 0x0000d600
Load bl31 from eMMC, src: 0x00020200, des: 0x05100000, size: 0x0002c600
Load bl33 from eMMC, src: 0x00050200, des: 0x01000000, size: 0x00066a00
NOTICE:  BL3-1: v1.0(release):a625749
NOTICE:  BL3-1: Built : 11:25:15, Aug 25 2017
[BL31]: GXL CPU setup!
NOTICE:  BL31: BL33 decompress pass
[Image: gxl_v1.1.3243-377db0f 2017-09-07 11:28:58 qiufang.dai@droid07]
9d 42 bd c7 a1 12 ec 2f 5f 6 30 b8 [0.354484 Inits done]
secure task start!
high task start!
low task start!
ERROR:   Error initializing runtime service opteed_fast

U-Boot 2015.01 (Jun 04 2018 - 21:29:41)

DRAM:  2 GiB
Relocation Offset is: 76eae000
register usb cfg[0][1] = 0000000077f56a18
[CANVAS]canvas init
boot_device_flag : 1
Nand PHY Ver: (c) 2013 Amlogic Inc.
init bus_cycle=6, bus_timing=7, system=5.0ns
reset failed
get_chip_type and ret:fffffffe
get_chip_type and ret:fffffffe
chip detect failed and ret:fffffffe
nandphy_init failed and ret=0xfffffff1
MMC:   aml_priv->desc_buf = 0x0000000073eae6b0
aml_priv->desc_buf = 0x0000000073eb09d0
SDIO Port B: 0, SDIO Port C: 1
emmc/sd response timeout, cmd8, status=0x1ff2800
emmc/sd response timeout, cmd55, status=0x1ff2800
init_part() 293: PART_TYPE_AML
[mmc_init] mmc init success
dtb magic edfe0dd0
start dts,buffer=0000000073eb3200,dt_addr=0000000073eb3200
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 
In:    serial
Out:   serial
Err:   serial
## defenv_reserve
Saving Environment to aml-storage...
mmc env offset: 0x6c00000 
Writing to MMC(1)... done
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
_verify_dtb_checksum()-909: calc a2d5c9ca, store a2d5c9ca
_verify_dtb_checksum()-909: calc a2d5c9ca, store a2d5c9ca
dtb_read()-1031: total valid 2
dtb_read()-1098: do nothing
vpu: clk_level in dts: 7
vpu: set clk: 666667000Hz, readback: 666660000Hz(0x300)
vpu: vpu_clk_gate_init_off
vpp: vpp_init
cvbs performance type = 6, table = 0
Net:   dwmac.c9410000amlkey_init() enter!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0

[OSD]load fb addr from dts
[OSD]fb_addr for logo: 0x7e000000
[OSD]load fb addr from dts
[OSD]fb_addr for logo: 0x7e000000
[CANVAS]addr=0x7e000000 width=3840, height=2160
amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L507:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L507:key[mac] not programed yet
[KM]Error:f[key_manage_query_size]L507:key[deviceid] not programed yet
saradc - saradc sub-system

saradc saradc open <channel>            - open a SARADC channel
saradc close    - close the SARADC
saradc getval   - get the value in current channel
saradc get_in_range <min> <max> - return 0 if current value in the range of current channel

gpio: pin GPIOAO_2 (gpio 102) value is 1
Product checking: pass!
Hit Enter or space or Ctrl+C key to stop autoboot -- :  0 
card out
emmc/sd response timeout, cmd8, status=0x1ff2800
emmc/sd response timeout, cmd55, status=0x1ff2800
emmc/sd response timeout, cmd1, status=0x1ff2800

Bad device mmc 0 **
cfgload: fatload: no boot.ini or empty file
** File not found /boot/boot.ini **
cfgload: ext4load: no boot.ini or empty file
** File not found zImage **
** File not found uInitrd **
** File not found dtb.img **
** [rsvmem] get fdtaddr NULL!

** rsvmem - reserve memory**

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

rsvmem check failed
Bad Linux ARM64 Image magic!
Set Addr 23
Get DT cfg
Get DT cfg
set CFG


I suspected my context to be a bit unusual,
so I did
make clean

I was surprised gcc (and maybe other packages) were reinstalled ! this is unexpected and possibly wrong.

Let’s now wait a bit to finish the “make” step


same issue as before !
Failure here on buntu 17


Hi freeasinbeer,

This change disable ext4 64bit and metadata_csum feature, because current u-boot does not support such features.

The effect of not using 64bit ext4 is that you’ll be limited to ~ 15T volumes. Where as you can have 1EiB volumes if you use the 64Bit flag. However, 16T is the recommended max volume size for ext4 anyway.



Oh, it’s too bad…

I don’t have Ubuntu 17.10 build host.

It’s recommend to use Ubuntu 18.04. Ubuntu 17.10 is not a LTS and will end of life soon(July 2018). :wink:


You probably did not event try to take into account ubuntu 17 in your fixes,
so I did this change to your latest build-rootf file :

info_msg “Preparing image file for rootfs…”

if [ $(lsb_release -sc) == “bionic” ]; then
EXT4_MKOPTS="-q -F -L ROOTFS -m 2 -O ^64bit,^metadata_csum"
elif [ $(lsb_release -sc) == “artful” ]; then
EXT4_MKOPTS="-q -F -L ROOTFS -m 2 -O ^64bit,^metadata_csum"
elif [ $(lsb_release -sc) == “xenial” ]; then
EXT4_MKOPTS="-q -F -L ROOTFS -m 2"

then I removed all .img files from my previous make session
and then make

then when the resulting img was regenerated, if flashed as usual, and this time, it booted ok on vim1 pro !
and says this…

Debian GNU/Linux 9 Khadas ttyS0

Khadas login: khadas

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
khadas@Khadas:~$ uname -a
Linux Khadas 4.9.40 #2 SMP PREEMPT Mon Jun 4 22:38:05 CEST 2018 aarch64 GNU/Linux
khadas@Khadas:~$ [   62.462624@3] fb: mem_free_work, free memory: addr:6af000


How about that ?
my change surely is much easier and more sustainable than your suggestion to change from buntu 17 to 18.
ubuntu 18.04 still need to be challenged and its all its undiscovered issues and quirks need some time before developpers massively jump into it

Now, let’s check which functions this uboot/kernel/linux combo are ok are which are not…

Never give up, never settle !


Ahh, yes, it’s my fault…forget to change it for Ubuntu 17.10. Sorry…

Yes, you are right, thanks for your work.


Ok, Nick,
so here what my vim1 home built debian says…

khadas@Khadas:~$ uname -a
Linux Khadas 4.9.40 #2 SMP PREEMPT Mon Jun 4 22:38:05 CEST 2018 aarch64 GNU/Linu
khadas@Khadas:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch


Great. I will fixup this or you can open a PR for this.:wink:



Welcome code donation :wink:


please just include those 2 lines, no need for a complicated PR, approval, merge, etc…


hi @numbqq
i’d like to use your script to build ubuntu 17 and 18 based firmwares,
currently, this is not possible.
If the prebuilt buntu for arm64 are available (I know that at least 17.10 is available) ,
then I’d like to modify the script for allowing that,
what do you think ?


Hi ravelo,

I have added basic support for Ubuntu 18.04, you can find here:

Note: These commits may be changed in the future.


i meant: build an ubuntu 18 arm64 firmware to flash on vim board, currently, fenix scripts offer only xenial based firmware for vim, which is becoming obsolete as some says


ok, now i see it in
i will then use your version instead of the other official repo


Ok, so I deployed nick’s own version (as of yesterday) of the fenix building tool on my artful linux machine and I’ve just built,deployed,booted an ubuntu xenial + uboot2005.01 on my board,
so far so good.
Next step is connect the board to the Net using wifi, run update and dist-upgrade and recheck what does not work (if any) with this kernel 4.9
Later, I’ll replace xenial w/ artful in the process before and 4.9 with nick’s mainline


currently, fenix allows to create bionic firmware only from a bionic host (that I do not have),
my initial intention was to create an artful firmware from an artful host, by I do not really know yet what to change and in which file…

Since the vim1 pro is running this khadas firmware,
i fell it is hot, not as any other firmware i’ve used before,
is this a known issue/situation ?


I have no idea yet, I haven’t build Ubuntu artful for now, I’m not sure whether it is a bug or not…