This is a cache of https://discuss.96boards.org/t/debian-deploying-kernel-modules-to-emmc/456. It is a snapshot of the page at 2024-11-01T03:19:00.633+0000.
[Debian] Deploying Kernel modules to eMMC - DragonBoard410c - 96Boards Forum

[Debian] Deploying Kernel modules to eMMC

Hello, I can build and deploy my custom kernel (using dtbTool, mkbootimg, and fastboot).
However I haven’t yet figured out a way to deploy the Kernel modules to the eMMC.
Do I need to scp my archived modules into eMMC? Or is there a tool (such as fastboot) that can do this?

Thanks!

Adam

Hi Adam,

Nice to here that you can make you own customized kernel. Could you give me some hints or instruction about how to make it? At least I want to know where I can get the source for kernel image.

Thanks

@yuefan See the instructions in the Release Notes of https://builds.96boards.org/releases/dragonboard410c/linaro/ubuntu/latest

I have been building new kernels right on the 410c board (no need for a workstation). You will need to install a SDCard, then partition it and format it for a small swap partition (2GB is enough, I used 8GB of a 64GB card in the example).

sudo gdisk /dev/mmcblk1
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-123764702, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-123764702, default = 123764702) or {+-}size{KMGTP}: 8G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number (1-128, default 2): 
First sector (34-123764702, default = 16779264) or {+-}size{KMGTP}: 
Last sector (2048-123764702, default = 123764702) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):

Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y

Format the partitions and mount them:

#Reboot and run the following command
sudo mkswap /dev/mmcblk1p1
#edit /etc/fstab and add the following line
sudo vi /etc/fstab
    /dev/mmcblk1p1 none swap sw 0 0
<esc>:wq
# Reboot and ensure swap is mounted
free

Next you need to install the appropriate development tools:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install man-db
sudo apt-get install manpages manpages-dev
sudo apt-get install autoconf automake libtool
sudo apt-get install libpython-dev libpython3-dev
sudo apt-get install libncurses-dev
sudo apt-get install libfdt-dev
git clone https://github.com/jackmitch/libsoc.git
cd libsoc
./autogen.sh
./configure –-enable-board=dragonboard410c –enable-python3
make V=1
sudo make install
sudo ldconfig –v -N

After this you follow the instructions in the release notes with a few (very minor) changes. No need to install a cross-compiler, the native compiler is perfect. To install the final image in eMMC just use dd

sudo dd if=boot-410c.img of=/dev/mmcblk0p8
sudo reboot now

Full Disclosure: I am an employee of Qualcomm Canada, any opinions expressed in this or any other post may not reflect the opinions of my employer.

@adam.yh.lee
For a better answer, you might want to look into building your own rootfs later.

The quickest/hack’est answer is a combo of scp and building the kernel with the KERNELRELEASE=${release} passed to the make command. Unless you match the kernel release on the board, the kernel will not load it when you modprobe the new module. Common error messages are ‘incorrect format’ or ‘unexpected version’ among other issues this method sometimes employs.

*** big note ***
You should probably backup the modules before you consider overwriting them, unless you plan on flashing a new image from sd to recover if something doesn’t work. (which is always an option)

uname -r is your friend. This should give you the release tag of the board kernel. This is also how the kernel knows where to look for what to load.

You will find the modules in:
/lib/modules/$(uname -r)/kernel/${path_to_module_src}

The process is pretty simple:
lsmod will list the modules names currently loaded. The module’s short name (in lsmod output) can be passed to modprobe to install or remove it. If the module is not loaded, you can provide the full path to it. Use modprobe -r to remove a module from the loaded modules. modprobe ${module} will insert the module into the kernel and check dependencies… where as insmod will likely do a trivial insert.

If you reboot the old module will be there. You will likely have to replace the module, in order for your new module to be loaded after each boot cycle. Hence, you should probably use modprobe to see if there are any dependency issues before you start overwriting files.

Hi all

Could someone point out how to make a rootfs on our own? I need to make a ubuntu 14.04 fs. Any idea will be great.

Thanks

@yuefan
You can start here:
https://ci.linaro.org/view/engineering-builds/job/ubuntu-arm64-rootfs/configure

Keep in mind, that linaro migrated to debian in the latest release (Dec 05).

See engineering-builds (in ci above) for the debian rootfs…

Cheers!