Jump to content

[Odroid XU4] Patching the Kernel


Gronfir

Recommended Posts

Hi all

 

I'm currently using armbian on a Odroid-XU4 and to use a peripheral I need to patch the kernel.

So to start that process i run: 

apt-get source linux-image-$(uname -r)

which failed:

Unable to find a source package for linux-image-3.10.102-odroidxu4
I tried adding adding the sources by adding 
deb-src http://apt.armbian.com jessie main
to the armbian.list but this is aparently not a thing.
 
Do any of you have any idea where i can find a souce repository.
Thanks in advance.

 

edit: on a sidenote is 3.10.102 really the newest kernel available for this board using armbian?

Link to comment
Share on other sites

Currently we don't provide packaged source and we rather focus to provide best possible cross compilation environment. Even with sources, you need to use a right compiler, so it wont be just apt-get source & make.

 

Latest kernel is 3.10.103 so don't worry about. If you seek for a modern kernel - it exists (4.4+ accessible within our build tools) but it's immature and we don't provide it yet.

Link to comment
Share on other sites

@Gronfir

if you have a patch for kernel 3.10.x, try the Armbian tool is to build an image (and/or build the debian packages to replace the current kernel)

 

note: if you wanna compile your XU4 image with kernel 4.4+ it is only working on SD card (not on eMMC) => uboot version 2012.07 usable with XU4 is limited for recent kernels

Link to comment
Share on other sites

@Gronfir

 

put the .patch file(s) into the folder

userpatches/kernel/odroidxu4-default (or odroidxu4-next)

 

then there is an option to configure the kernel KERNEL_CONFIGURE="yes"

once you are ok with your kernel config

copy the .config in userpatches/linux-odroidxu4-default.config (or next)

(so you don't need to do config anymore)

Link to comment
Share on other sites

I still seem to be doing something wrong: After I build the kernel (patched next) I moved the generated .deb files to the odroid and tried to install them

devbox@odroidxu4:~$ sudo dpkg -i linux-*.deb
(Reading database ... 175817 files and directories currently installed.)
Preparing to unpack linux-dtb-next-odroidxu4_5.17_armhf.deb ...
Unpacking linux-dtb-next-odroidxu4 (5.17) over (5.17) ...
Preparing to unpack linux-headers-next-odroidxu4_5.17_armhf.deb ...
Unpacking linux-headers-next-odroidxu4 (5.17) over (5.17) ...
Preparing to unpack linux-image-next-odroidxu4_5.17_armhf.deb ...
Removing obsolete file initrd.img-3.10.103-odroidxu4
Unpacking linux-image-next-odroidxu4 (5.17) over (5.17) ...
Preparing to unpack linux-u-boot-next-odroidxu4_5.17_armhf.deb ...
Unpacking linux-u-boot-odroidxu4-next (5.17) over (5.17) ...
Setting up linux-dtb-next-odroidxu4 (5.17) ...
Setting up linux-headers-next-odroidxu4 (5.17) ...
Compiling headers - please wait ...
Setting up linux-image-next-odroidxu4 (5.17) ...
update-initramfs: Generating /boot/initrd.img-4.7.3-odroidxu4
Setting up linux-u-boot-odroidxu4-next (5.17) ...

but after a reboot the start info and uname still shows that I'm using the old kernel. (the console output above is from my 2 try)

I'm running it off a sd card btw.

Link to comment
Share on other sites

@gronfir

 

I forgot about that. You are booting the wrong kernel :)

 

with the old uboot and the vilain blobs, you have to deal with 2 partitions /boot and / (root)

 

problem: when dpkg -i runs -- the files are written on /boot but on the root system

 

so you have to move the files from /boot (root) to /boot (partition)

=> make sure to check the dates of the files first (and don't forget about the dtb folder... for recent kernel)

 

(make a backup if needed)

 

it is partly an Armbian issue (**) but mostly an Odroid issue (not pushing Samsung to provide opensource dev ressources for working with newer uboot (***))

 

(**) Armbian team has more important tasks than dealing with antic uboot 2012.07

(***) Let's blame Google as well, I got a Android Marshmallow for a Phablet, image build on July 2016, with linux kernel 3.18

Link to comment
Share on other sites

@goldfish_paris

The boot partition seems to be mountet at /boot by default. If I open the sd on another machine (sadly windows) the boot partition contains the same files as /boot while running:

boot.bmp                    dtb-4.7.3-odroidxu4.old
boot.ini                    System.map-3.10.103-odroidxu4
config-3.10.103-odroidxu4   uInitrd
dtb-3.10.103-odroidxu4      vmlinuz-3.10.103-odroidxu4
dtb-3.10.103-odroidxu4.old  zImage
dtb-4.7.3-odroidxu4

dpkg has aparently created the new dtb folders but not copied the kernel files. That kinda wierd but manualy extracting the deb files and moving the files to there places should have the same effect (or am I missing something)

Link to comment
Share on other sites

yes, what if you look in the /boot folder of the root device (edit : the second partition) ?

 

you can "umount /boot" then see the content of /boot (edit: the second partition) ;)

 

this is tricky, mounting a partition over a folder that is not empty (GNU/Linux issues no warning AFAIK) (**).

 

edit #2

if case you have no gnu/linux machine

there is a driver for ext2+ filesystems over Windows

https://github.com/matt-wu/Ext3Fsd

https://sourceforge.net/projects/ext2fsd/files/Ext2fsd/0.69/

 

edit #3

in fact you may have (almost) done faster with

dpkg -x

or dpkg -X

& mv

 

(**) unsure if there is a problem in the deb script used by Armbian for (old) dual partition (fat/ext4) where old uboot cannot handle ext4 (only fat)

Link to comment
Share on other sites

The /boot (on the second partition after I unmounted the other partition) contained the other kernel files. I tried to copy them but 2 of them are symlinks and the /boot patition is a FAT partition (zImage and dtb).

Without those symlinks the system does not reboot and making a normal copy and rename does not work either.

Link to comment
Share on other sites

ok, I see

 

here is an example



-rwxr-xr-x 1 root root    6944 juin  30 00:59 boot.bmp
-rwxr-xr-x 1 root root    8719 juin  30 00:55 boot.ini
-rwxr-xr-x 1 root root  112004 juil. 17 00:46 config-4.6.4-odroidxu4
drwxr-xr-x 2 root root    2048 juil. 17 00:45 dtb
drwxr-xr-x 2 root root    4096 juil. 17 00:39 dtb-4.6.4-odroidxu4
-rwxr-xr-x 1 root root 3164228 juil. 17 00:46 initrd.img-4.6.4-odroidxu4
-rwxr-xr-x 1 root root 1819916 juil. 17 00:46 System.map-4.6.4-odroidxu4
-rwxr-xr-x 1 root root 3164292 juil. 17 00:46 uInitrd
-rwxr-xr-x 1 root root 4453704 juil. 17 00:46 vmlinuz-4.6.4-odroidxu4
-rwxr-xr-x 1 root root 4453704 juil. 17 00:47 zImage

just duplicate the dtb-xxxxxxxx-odroidxu4 folder into dtb

and cp vmlinuz-xxxxxxxx-odroidxu4 zImage

(instead of a link, as you write, no link with FAT system)

 

edit: just check the size of the files vmlinuz-4.6.4-odroidxu4 & zImage should match

 

probably then you are done. Tell us, please :)

 

edit:

 

as a quick check look at boot.ini

 

in my example



setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 dtb/exynos5422-odroidxu4.dtb; bootz 0x40008000 0x42000000 0x44000000"

I need the following files: zImage & uInitrd & dtb/exynos5422-odroidxu4.dtb

Link to comment
Share on other sites

That is what i was doing before. I tried it again just to make sure but it's leads to at not booting system. The line in my bbot.ini is sligtly different btw:

setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x44000000 dtb/exynos5422-odroidxu3.dtb; bootz 0x40008000 0x44000000"

One of the numbers at the end is missing.

I just tried to compile a complitly new image with the current kernel and that image file can't be booted either.

Link to comment
Share on other sites

you are using a legacy 3.X kernel, so I guess the bootcmd is ok, it only needs the zImage and odroid xu3 dtb file

 

I am out of options because I only tested on vanilla kernels && SD cards

 

The only test I could propose you: create the whole image with Armbian and burn the SD card (to avoid the issue of installing the new kernel packages and dual partition issue).

 

** side note (I guess it is only for vanilla kernel -- uboot 2012.07 doesn't handle things nicely)

 

 

the boot.ini I had to change: root=/dev/mmcblk1p2 (0=>1) uboot is confusing SD & eMMC (the workaround for vanilla kernel would be to use UUID in /etc/fstab and not /dev/mmcblk)



#setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 loglevel=1 root=/dev/mmcblk0p2 rootwait ro fsck.repair=yes"
setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 loglevel=1 root=/dev/mmcblk1p2 rootwait ro fsck.repair=yes"

=> So now I think: do you have the (expensive) Odroid 1.8V serial console plug? so you may see more piece of info

Link to comment
Share on other sites

I allready tried a new image and that didn't boot, but I should have a uard to usb here somewere.

I try loading a new image file and see were it stops

 

edit: It starts to boot with a fresh image, but than goes into emergency mode asking for the root paswort.

I can use the board then but the openssh-server is dead and can't be startet and I don't get the normal login screen or first time setup

 

edit2: It goes into emergency mode after using 1:30m on A start hob is running fir dev-mmcblk0p1.device

 

edit3: and before that "Failed to start Load Kernel Modules"

and directly after: [DEPEND] Dependency failed for /boot.

[DEPEND] Dependency failed for Local File Systems.
[DEPEND] Dependency failed for File System Check on /dev/mmcblk0p1.
 
edit4: The entire uart output during boot:



U-Boot 2012.07 (Sep 14 2016 - 13:41:16) for Exynos5422

CPU: Exynos5422 Rev0.1 [Samsung SOC on SMP Platform Base on ARM CortexA7]
APLL = 800MHz, KPLL = 800MHz
MPLL = 532MHz, BPLL = 825MHz

Board: HardKernel ODROID
DRAM:  2 GiB
WARNING: Caches not enabled

TrustZone Enabled BSP
BL1 version: â–’/â–’â–’â–’
VDD_KFC: 0x44
LDO19: 0xf2

Checking Boot Mode ... SDMMC
MMC:   S5P_MSHC2: 0, S5P_MSHC0: 1
MMC Device 0: 29 GiB
MMC Device 1: [ERROR] response timeout error : 00000104 cmd 1
Card did not respond to voltage select!
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Press quickly 'Enter' twice to stop autoboot:  0
there are pending interrupts 0x00000001
reading boot.ini

8719 bytes read
Loading boot.ini from FAT
Find boot.ini file from FAT/Ext4 Area!!
boot.ini command = setenv initrd_high "0xffffffff"
boot.ini command = setenv fdt_high "0xffffffff"
boot.ini command = setenv macaddr "00:1e:06:61:7a:55
boot.ini command = setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 logl                                                                             evel=1 root=/dev/mmcblk1p2 rootwait ro fsck.repair=yes"
boot.ini command = setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mm                                                                             c 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 dtb/exynos5422-odroidxu4.dt                                                                             b; bootz 0x40008000 0x42000000 0x44000000"
boot.ini command = setenv vout "hdmi"
boot.ini command = setenv governor "conservative"
boot.ini command = setenv HPD "true"
boot.ini command = setenv hdmi_tx_amp_lvl  "31"
boot.ini command = setenv hdmi_tx_lvl_ch0      "3"
boot.ini command = setenv hdmi_tx_lvl_ch1      "3"
boot.ini command = setenv hdmi_tx_lvl_ch2      "3"
boot.ini command = setenv hdmi_tx_emp_lvl      "6"
boot.ini command = setenv hdmi_clk_amp_lvl     "31"
boot.ini command = setenv hdmi_tx_res      "0"
boot.ini command = setenv hdmi_phy_control "hdmi_tx_amp_lvl=${hdmi_tx_amp_lvl} h                                                                             dmi_tx_lvl_ch0=${hdmi_tx_lvl_ch0} hdmi_tx_lvl_ch1=${hdmi_tx_lvl_ch1} hdmi_tx_lvl                                                                             _ch2=${hdmi_tx_lvl_ch2} hdmi_tx_emp_lvl=${hdmi_tx_emp_lvl} hdmi_clk_amp_lvl=${hd                                                                             mi_clk_amp_lvl} hdmi_tx_res=${hdmi_tx_res} HPD=${HPD} vout=${vout}"
boot.ini command = setenv bootargs "${bootrootfs} ${videoconfig} smsc95xx.macadd                                                                             r=${macaddr} governor=${governor} ${hdmi_phy_control}"
boot.ini command = boot
reading zImage

4480856 bytes read
reading uInitrd

3161075 bytes read
reading dtb/exynos5422-odroidxu4.dtb

54314 bytes read
## Loading init Ramdisk from Legacy Image at 42000000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    3161011 Bytes = 3 MiB
   Load Address: 00000000
   Entry Point:  00000000
## Flattened Device Tree blob at 44000000
   Booting using the fdt blob at 0x44000000
   Using Device Tree in place at 44000000, end 44010429

Starting kernel ...

Loading, please wait...
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Will now check root file system ... fsck from util-linux 2.25.2
[/sbin/fsck.ext4 (1) -- /dev/mmcblk1p2] fsck.ext4 -y -C0 /dev/mmcblk1p2
e2fsck 1.42.12 (29-Aug-2014)
/dev/mmcblk1p2: clean, 164234/170016 files, 666215/678912 blocks
done.
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.

Welcome to Debian GNU/Linux 8 (jessie)!

         Expecting device dev-ttySAC2.device...
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Paths.
[  OK  ] Reached target Encrypted Volumes.
[  OK  ] Reached target Swap.
         Expecting device dev-mmcblk0p1.device...
[  OK  ] Created slice Root Slice.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on udev Control Socket.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Listening on Journal Socket.
[  OK  ] Created slice System Slice.
[  OK  ] Created slice system-systemd\x2dfsck.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-getty.slice.
         Starting Increase datagram queue length...
         Starting Restore / save the current clock...
         Starting Load Kernel Modules...
         Starting Create list of required static device nodes...rrent kernel...
         Mounting POSIX Message Queue File System...
         Starting udev Coldplug all Devices...
         Mounting Debug File System...
         Starting LSB: Set keymap...
[  OK  ] Reached target Slices.
[  OK  ] Mounted Debug File System.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Started Increase datagram queue length.
[  OK  ] Started Restore / save the current clock.
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
[  OK  ] Started Create list of required static device nodes ...current kernel.
[  OK  ] Started LSB: Set keymap.
         Starting Create Static Device Nodes in /dev...
         Mounting Configuration File System...
         Starting Apply Kernel Variables...
[  OK  ] Listening on Syslog Socket.
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Mounted Configuration File System.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Started Create Static Device Nodes in /dev.
[  OK  ] Started Apply Kernel Variables.
         Starting udev Kernel Device Manager...
[  OK  ] Started udev Kernel Device Manager.
         Starting Copy rules generated while the root was ro...
         Starting LSB: Set preliminary keymap...
         Starting LSB: Tune IDE hard disks...
[  OK  ] Started Copy rules generated while the root was ro.
[  OK  ] Started LSB: Tune IDE hard disks.
[  OK  ] Found device /dev/ttySAC2.
[  OK  ] Started LSB: Set preliminary keymap.
[  OK  ] Created slice system-ifup.slice.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /tmp...
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Mounted /tmp.
[ TIME ] Timed out waiting for device dev-mmcblk0p1.device.
[DEPEND] Dependency failed for /boot.
[DEPEND] Dependency failed for Local File Systems.
[DEPEND] Dependency failed for File System Check on /dev/mmcblk0p1.
[  OK  ] Stopped Serial Getty on ttySAC2.
[  OK  ] Stopped Getty on tty1.
[  OK  ] Stopped getty on tty2-tty6 if dbus and logind are not available.
[  OK  ] Stopped target Graphical Interface.
[  OK  ] Stopped Entropy daemon using the HAVEGE algorithm.
[  OK  ] Stopped target Multi-User System.
[  OK  ] Stopped Network Manager.
[  OK  ] Stopped Regular background program processing daemon.
[  OK  ] Stopped OpenBSD Secure Shell server.
[  OK  ] Stopped /etc/rc.local Compatibility.
[  OK  ] Stopped Login Service.
[  OK  ] Reached target Login Prompts.
[  OK  ] Stopped LSB: PLEASE DO NOT INTERRUPT THE FIRST BOOT.
[  OK  ] Stopped LSB: Starts LIRC daemon..
[  OK  ] Stopped LSB: Start NTP daemon.
[  OK  ] Stopped LSB: Armbian gathering hardware information.
[  OK  ] Stopped LSB: Start/stop sysstat's sadc.
[  OK  ] Stopped LSB: Advanced IEEE 802.11 management daemon.
[  OK  ] Stopped LSB: Set sysfs variables from /etc/sysfs.conf.
[  OK  ] Stopped LSB: set CPUFreq kernel parameters.
[  OK  ] Stopped LSB: disk temperature monitoring daemon.
[  OK  ] Stopped LSB: Load kernel modules needed to enable cpufreq scaling.
[  OK  ] Stopped LSB: No Display Manager.
[  OK  ] Stopped Avahi mDNS/DNS-SD Stack.
[  OK  ] Closed Avahi mDNS/DNS-SD Stack Activation Socket.
[  OK  ] Stopped D-Bus System Message Bus.
[  OK  ] Closed D-Bus System Message Bus Socket.
[  OK  ] Stopped Permit User Sessions.
[  OK  ] Reached target Remote File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
[  OK  ] Stopped System Logging Service.
[  OK  ] Stopped target Basic System.
[  OK  ] Reached target Timers.
[  OK  ] Stopped target System Initialization.
         Starting Create Volatile Files and Directories...
         Starting LSB: Prepare console...
         Starting LSB: Raise network interfaces....
[  OK  ] Closed Syslog Socket.
[  OK  ] Reached target Sockets.
         Starting Emergency Shell...
[  OK  ] Started Emergency Shell.
[  OK  ] Reached target Emergency Mode.
[  OK  ] Started Create Volatile Files and Directories.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started LSB: Prepare console.
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
         Starting Update UTMP about System Runlevel Changes...
         Starting LSB: Set console font and keymap...
[  OK  ] Started Update UTMP about System Runlevel Changes.
[  OK  ] Started LSB: Raise network interfaces..
         Starting ifup for eth0...
[  OK  ] Started ifup for eth0.
[  OK  ] Reached target Network.
[  OK  ] Reached target Network is Online.
[  OK  ] Started LSB: Set console font and keymap.
Welcome to emergGive root password for maintenance
(or type Control-D to continue):

 

 

 

 

I do not understand why it's trying to load something from mmcblk0 wenn it's not mentions in the boot.ini file. The 2 existing partitions are mmclk1p1 and mmclk1p2

Edited by goldfish_paris
added spoiler tags
Link to comment
Share on other sites

ok, it looks better but now you are using Vanilla kernel (4.x) I guess because of the dtb name (xu4 instead of xu3)

 

fill the sdcard in another computer

edit /etc/fstab and pick /dev/mmcblk1pX





gr@gr /media/p2/etc $ cat fstab
/dev/mmcblk1p2 / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
/dev/mmcblk1p1 /boot vfat defaults 0 2

because the UUID feature is not a top priority (so far)

 

edit: UUID is a nice workaround (and likely a standard now)

anyway, if we could be using recent uboot, the kernel would handle properly the mmc0/1. the switch SD/eMMC on the XU4 should "define" the proper mmcblk0 (boot device)

so we wouldn't have this problem. We can blame Hardkernel/Odroid for this. Even Samsung Opensource DEV have to DIY when they test their work on XU4 :)

Link to comment
Share on other sites

You are welcome, thanks you for testing on your side, if you have more feedback, feel free ;)

 

until the Armbian DEV have time to deal with the kernel install issue (files put in /boot folder of root partition, not in /boot partition) and put infrastructure for UUID

=> use dpkg and move the files at the proper place (and have a backup first, you can "dd" your SD card into a file on a HDD/SSD)

 

note: excepted for legacy stuff, dual partition boot is quite obsolete because vanilla version of uboot manage ext4 properly, so I guess not a top priority.

Link to comment
Share on other sites

2 more things:

 

1) First the patch: patch-odroidxu4_tobetter_dts_2016710.patch does not work with the current version of the next kernel. I have no idea what that patch changes, but some of the changed files must have changed since the patch was made.

 

2) As feedback: The next kernel is allways the newest kernel, with means your custom patches might need regular changes. It would be nice to be able to compile the latest LTS kernel (4.4 at the moment I think)

Link to comment
Share on other sites

@Gronfir

 

1/

Honestly I (personal opinion) cannot rely on Hardkernel for providing timely and accurate kernel for Odroid XU4

 

I have greatly appreciated that during Q2 2016 Samsung Opensource DEV team made some needed updates to vanilla kernel for XU4 and that's the only reliable work I have seen so far (and to test their updates they had to tweak Hardkernel images the best they could).

 

"Jobenvil" is more following "tobetter" works he would express an opinion more accurate (less biased than me, I am annoyed by Hardkernel -- Hardkernel designs nice hardware (Orange Pi maker as well) but Hardkernel fails on software)

 

2/

 

in lib/configuration.sh



ARMBIAN_MAINLINE_KERNEL_VERSION='4.7'
MAINLINE_KERNEL_BRANCH=tag:v$(wget -qO- https://www.kernel.org/finger_banner | awk '{print $NF}' | grep -oE "^${ARMBIAN_MAINLINE_KERNEL_VERS

you can find ARMBIAN_MAINLINE_KERNEL_VERSION variable.

 

if it cannot be already overloaded by a configuration file, I may try to provide a small patch to set ARMBIAN_MAINLINE_KERNEL_VERSION='4.4' (or as you may like)

(but I am unsure it would be ever accepted in the Armbian tool mainstream)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines