Compiling an ARM Linux kernel with EBC eink interface

First of all the essentials which are clearly explained here:

Build your first Linux kernel and make sure you have at least 8 GB free disk space .
Please be aware that building your own Linux kernel needs to be done with care and it’s a risky operation where you might need to wipe everything if done incorrectly. This was done on a fresh installation of Manjaro in my PINE64 Model A board.
Since writing for the web they say you need to start with the solution, after building my kernel in the board, I forked Smaeul and updated my changes:

Branch: rk356x-ebc-compiled
Don’t use that yet: I took the wrong branch when doing this and used master. The right one is: rk356x-ebc-dev

Regulator kernel module needed for the high voltages
EBC module made by Samuel Holland

This is already compiled now and I’m currently checking that it works before pushing it again to the repository

If you choose to use this you can go directly to Step 2 since the make is already done.

Step1. Download the kernel and build it

I’ve used the link to the Linux kernel from Smaeul fork that is linked on the Pinebook Wiki page. Please note that our target PC is a Quartz model A board from Pine64

ZIP or compressed is highly recommended because it’s almost 4 GB

Build it using:

make -j$(nproc)

That will take a long while specially if your PC is slow

2. Backup and install the new kernel

sudo make modules_install
sudo make install

That will actually install the compiled modules in your /lib/modules directory and the kernel file and the

INSTALL /lib/modules/5.19.0-MANJARO-ARM-RC+

The make install will build a vmlinux file that is your new kernel. In my case it is 30 MB.

Now this is an important step:
Before installing our new kernel, let’s backup the /boot directory, just in case everything stops working, and you want to come back to the old stable kernel.

cp -r /boot/* /run/media/user/your_USB_SSD_name/old_boot/

3. Generate the intra RAM filesystem

Now we will need to generate initramfs

initramfs is a root filesystem that is embedded into the kernel and loaded at an early stage of the boot process. It is the successor of initrd. It provides early userspace which can do things the kernel can’t easily do by itself during the boot process. Using initramfs is optional.

So that is an essential part (I think) since Arch based distros use mkinitcpio which is a bash script to automate the generation of the initramfs.

Running: sudo mkinitcpio -p linux-rc

Now if you execute a: uname -a

And it returns the date where you compiled the kernel then congrats! You just build your own Linux kernel. What a monumenal work, all coded in beautiful .c, with Linus Torvalds and his long wipe correcting development mistakes and merging. You just made it.

fasani-pc 6.1.0-rc1-2-MANJARO-ARM-RC #1 SMP PREEMPT Mon Oct 17 16:43:21 UTC 2022 aarch64 GNU/Linux

4. Cross your fingers and reboot your PC

If nothing happens, you’ve been warned at the beginning, not my fault!

Now if you do a: modprobe -c | less
To display the comprehensive configuration of all the modules and you find something like:

alias of:N*T*Crockchip,rk3566_vop rockchipdrm probably we are fine. I’m really not sure of this point, of course the real test is to send a frame to the EBC, check if the high voltages are there and see the epaper refresh.
Mind that you have to also explore a second repository of Samuel: who did the reverse engineering of the EBC part since the original one came with the Eink drivers compiled (Thanks Eink .com to make our lives easier)

RK3566_Module from the Quartz A Schematics showing the DRM to the 16 data plus control lines for the epaper and PMIC