DIY mainline kernel (4.12)+ ubuntu base 17.04 (zesty) for vim pro and EMMC install

And here is the latest version of my build tool : 99.ChrootScript.sh

and the remaining errors dmesg are:

[ 0.181403] dmi: Firmware registration failed.
[ 0.812470] of_pwm_get(): PWM chip not found
[ 2.133055] mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
[ 2.429210] of_pwm_get(): PWM chip not found
[ 2.436011] leds_pwm pwmleds: unable to request PWM for vim:red:power: -517

Ethernet works wanyway, and red led probably not

I need now to check if bluetooth worksā€¦

Ok, bluetooth DONE!

Here is what I did to make embedded bluetooth work (but not fully tested yet)ā€¦

Please run these as root on kvim once it is booted up !

echo "hci_uart" >> /etc/modules
cd /usr/local/bin
vi khadas-bt-init

(ā€¦and fill it with the khadas-bt-init on your PC or w/ #! /bin/sh# /etc/init.d/khadas-bt-init#do_start(){ #non mainline: mo - Pastebin.com)

chmod +x khadas-bt-init
update-rc.d khadas-bt-init defaults
wget http://download1339.mediafireuserdownload.com/1pbaw901nrng/18v8miyhefi7vm8/brcm_patchram_plus
chmod +x brcm_patchram_plus

edit /etc/apt/sources.list and uncomment ā€œdeb Index of /ubuntu xenial partnerā€

apt-get update
apt-get install -y bluetooth blueman bluez bluez-tools libbluetooth-dev
sync; reboot
lsmod | grep hci_uart

ā€¦then and just let ā€œ/usr/local/bin/khadas-bt-initā€ do its thing (using init.d style) at each bootup (and not that old rc.local !!)
Maybe we would need to take into accnt what /etc/init.d/bluetooth already does ??

Anyway, hooray :tropical_drink::sparkler::unicorn:
right after login, hciconfig now saysā€¦

raxy@ivnVimPro:~$ hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 44:2C:05:B6:BD:FF ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:717 acl:0 sco:0 events:41 errors:0
TX bytes:1008 acl:0 sco:0 commands:41 errors:0

Latest version of my toolsetā€¦(respectively 123sh, 99sh and khadas-bt-init)
https://pastebin.com/3i2m8F4e
and
https://pastebin.com/Su82GLEW
and
https://pastebin.com/jd98u90k

1 Like

Next issue to solve : use my national keyboard layout (fr) instead of the yankee one, because I do not have qwerty keyboardā€¦

I did :
raxy@ivnVimPro:~$ locale -a
C
C.UTF-8
POSIX

It seems incomplete to me so I did :

sudo apt-get install locales
sudo locale-gen  fr_FR
sudo locale-gen  fr_FR.utf8
sudo locale-gen   en_US
sudo locale-gen   en_US.UTF-8
sudo update-locale
raxy@ivnVimPro:~$ locale -a
C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
french
fr_FR
fr_FR.iso88591
fr_FR.utf8
POSIX

Now it is much better, but kbd layout still not okā€¦

Issues for now areā€¦

raxy@ivnVimPro:~$ sudo apt-get install keyboard-configuration
Reading package lists... Done
Building dependency tree       
Reading state information... Done
keyboard-configuration is already the newest version (1.108ubuntu15.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
raxy@ivnVimPro:~$ sudo dpkg-reconfigure keyboard-configuration
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: warning: script 'K01khadas-bt-init' missing LSB tags and overrides
insserv: warning: script 'khadas-bt-init' missing LSB tags and overrides
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: warning: script 'K01khadas-bt-init' missing LSB tags and overrides
insserv: warning: script 'khadas-bt-init' missing LSB tags and overrides
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.122ubuntu8.8) ...

Visibly, sudo dpkg-reconfigure keyboard-configuration encounters some mess related to insserv and or update-rc.d,
WTF !!! :pouting_cat:

for now, this is my best bet
localectl set-keymap fr
but it does not do the job

And I definitely need to fix the mess with my startup scripts and init.d which visibly prevents me from running my beloved kbd configuration command (sudo dpkg-reconfigure keyboard-configuration)

Time to publish a few updates of the toolset,
mainly the new /etc/init.d/khadas-bt-init (see new link below)

to install it, as root,

cd /etc/init.d
vi khadas-bt-init (copy paste from https://pastebin.com/E2qg0LYX)
chmod +x khadas-bt-init
update-rc.d khadas-bt-init defaults
update-rc.d khadas-bt-init enable

then reboot
If you have previously paired a BT keyboard, then it will get automatically re-connected for typing login and password

1 Like

finally, DONE ! :star_struck::man_mechanic::sweat_smile::keyboard:

these allowed me to have the keybord layout i was expecting (fr) to log on the tty1 session on the hdmi display :

sudo apt-get install console-setup
sudo dpkg-reconfigure console-setup
(and just confirm whatever default it proposes)

about wifi ,
it also works;
I can connect to my phoneā€™s hotspot,
shutdown eth0, and still manage to do an apt-get update successfully;

you remember I could not connect on a channel 13 wifi network yet,
but at least I can say that this current distro (4.12.7/16.04.3) is doing wifi (and maybe will not stall as ethernet did with older versions of the mainline kernel)

to be tested under load (like downloading a big video file maybe)

1 Like

Nice work! :slight_smile:

Iā€™m thinking to build Ubuntu for my second Khadas Vim Pro and stumbled upon this detailed thread. Will definitely try out :wink:

Why arenā€™t you putting your scripts on GitHub? Would be easier to get always the latest version and see modifications.

1 Like

Is it somehow possible to publish your kernel as a *.deb file? I would like to install it over my 4.9 ubuntu server installation.

Is everything working (USB / Ethernet)?

hi,
usb does not work,
sorry i do not know how to build a .deb out of my kernel;
how would you install a .deb as the kernel of your existing distro?

make ARCH=arm64 deb-pkg :wink:

2 Likes

Salut Neil,

I kinda failed at my very 1st attempt to build a .deb kernel package,
please check logs below and help me understand what went wrongā€¦tks

raxy@bodhi-giada:~/project/khadas-build-script/Khadas-Components/linux-kernel$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
raxy@bodhi-giada:~/project/khadas-build-script/Khadas-Components/linux-kernel$ make ARCH=arm64 deb-pkg arch/arm64/Makefile:23: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
  CHK     include/config/kernel.release
    make clean
      CLEAN   .
      CLEAN   arch/arm64/kernel/vdso
      CLEAN   arch/arm64/kernel
      CLEAN   drivers/firmware/efi/libstub
      CLEAN   drivers/tty/vt
      CLEAN   drivers/video/logo
      CLEAN   kernel
      CLEAN   lib/raid6
      CLEAN   lib
      CLEAN   usr
      CLEAN   arch/arm64/boot
      CLEAN   arch/arm64/boot/dts/amlogic
      CLEAN   .tmp_versions
      TAR     linux-4.12.10.tar.gz
    make KBUILD_SRC=
    arch/arm64/Makefile:23: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
    arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
      CHK     include/config/kernel.release
      UPD     include/config/kernel.release
      CHK     include/generated/uapi/linux/version.h
      CHK     include/generated/utsrelease.h
      UPD     include/generated/utsrelease.h
      HOSTCC  scripts/basic/fixdep
      HOSTCC  scripts/basic/bin2c
      CC      kernel/bounds.s
    gcc: error: unrecognized command line option ā€˜-mlittle-endianā€™
    gcc: error: unrecognized command line option ā€˜-mgeneral-regs-onlyā€™
    make[3]: *** [kernel/bounds.s] Error 1
    make[2]: *** [prepare0] Error 2
    make[1]: *** [deb-pkg] Error 2
    make: *** [deb-pkg] Error 2

After googling the errors,
I ended up trying this new command line:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- deb-pkg

first errors are now gone,I wait for build result
I still have no idea of what to do next to take into account the dtb and the modules, and how to install all this on a running 4.9 or 4.12.7 systemā€¦:plate_with_cutlery: :haircut_man:

Edit:
build ended without error,
now, I see no evident sign of a .deb file anywhere, so, where is it ?

Ok, while I try to get documented on how to build a debian kernel package,
I decided to build the full xenial distro including the up-to-date 4.12.10 stable kernel;

and the good news is,
the build method I described before just works as well on the latest (4.12.10) mainline stable kernel sources;

so now, I managed to build, deploy and boot a working ubuntu base16.04.3+kernel 4.12.10 :checkered_flag::star_struck::tongue::palm_tree:

the bad news is,USB keyboard does not get recognized yet: no message in console nor in dmesg when I plug my usb keyboard,
and lsusb command cannot be found! this is too baaad !

As @balbes150 says his armbian built with the same kernel has working usb ports and I cannot get usb to work yet, I need to figure out what could be wrong in my distro;

any hint @numbqq or @narmstrong please ?
thanks

please find boot trace (dmesg) at this pastebin

See Neil patches for the kernel. For example in the project ā€œmeta-mesonā€.
Or use to build the kernel GIT Armbian.

Sorry i cannot find such patched source code,
Please kindly provide git url and branch or tag name to be used, tks !

An indication of the kernel Sources.
https://github.com/superna9999/meta-meson/blob/master/recipes-kernel/linux/linux-yocto-meson64_4.13.bb#L8

Indication used the kernel configuration and patches.
https://github.com/superna9999/meta-meson/blob/master/recipes-kernel/linux/linux-yocto-meson64_4.13.bb#L10

The files kernel configuration and patches.
https://github.com/superna9999/meta-meson/tree/master/recipes-kernel/linux/linux-yocto-meson64-4.13

I recommend using this step-by-step manual to start the Assembly. By the way, you can start the build only one kernel and get the output files of the kernel and dtb, and you can specify in customizing, that would have been collected ready deb\rpm packages which can install the usual commands in the existing system.

1 Like