Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: sbp on July 19, 2015, 01:32:33 AM

Title: Build a new version based on raspberry kernel 4
Post by: sbp on July 19, 2015, 01:32:33 AM
Hi

I'm trying to build a new version build on the now default kernel from raspberry (at the moment 4.0.8). I will report my findings and the problems I have so far:

At first it would not allow the use of zram. Therefore piCore froze during boot. This could be overcome by inclusion of the bootcode "nozswap".
However, by adding this to the .config file before building the kernel also fixed the problem:
CONFIG_ZSMALLOC=y
CONFIG_ZCACHE=y
CONFIG_ZRAM=y

Next, I now have a problem with mounting the loop devices.
I have enabled it in menuconfig. If I test it with:
ls -l /dev/loop*

I get
crw--------    1 root    root     10    237   jan 1  1970     /dev/loop-control
brw-rw------ 1 root    staff     7,        0   jul  19 08:03   /dev/loop0
brw-rw------ 1 root    staff     7,        1   jan 1  1970     /dev/loop1
brw-rw------ 1 root    staff     7,        2   jan 1  1970     /dev/loop2
brw-rw------ 1 root    staff     7,        3   jan 1  1970     /dev/loop3
brw-rw------ 1 root    staff     7,        4   jan 1  1970     /dev/loop4
brw-rw------ 1 root    staff     7,        5   jan 1  1970     /dev/loop5
brw-rw------ 1 root    staff     7,        6   jan 1  1970     /dev/loop6
brw-rw------ 1 root    staff     7,        7   jan 1  1970     /dev/loop7

However during boot it will not mount the loop devices so I get the following errors:
mount: mounting /dev/loop0 on /tmp/tcloop/dropbear failed: no such device
mount: mounting /dev/loop0 on /tmp/tcloop/busybox-htpd failed: no such device
mount: mounting /dev/loop0 on /tmp/tcloop/libfaad failed: no such device


So if anyone have a good idea on how to overcome this problem with mounting of the loop devices - please help.

Otherwise it seems to boot fine, I can use the "tce" command, and it can get the wanted tcz packages, but it still cant mount the loop devices

Regards
Steen

I can provide the .config file and the kernel and initrd if anyone want to have a look.




Title: Re: Build a new version based on raspberry kernel 4
Post by: bmarkus on July 19, 2015, 01:44:15 AM
Steen

I'm using piCore 7.0 alpha on my RPi2 with kernel 4.0.8, GLIBC-2.21, GCC-5.2.0, .... I'm planning to release for public testing in 1-2 weeks.

Regards... Béla
Title: Re: Build a new version based on raspberry kernel 4
Post by: sbp on July 19, 2015, 01:48:25 AM
Hi Belá

This is good news.

For my own education - do you have an idea what is wrong since I have this problem with mounting of the loop devices?
Where should I look?

Steen
Title: Re: Build a new version based on raspberry kernel 4
Post by: sbp on July 19, 2015, 01:58:52 AM
Further info.

If I manually try to mount dropbear like:

sudo mount /dev/loop0 /tmp/tcloop/dropbear

The result is:
mount: mounting /dev/loop0 on /tmp/tcloop/dropbear failed: Input/output error

Steen
Title: Re: Build a new version based on raspberry kernel 4
Post by: curaga on July 19, 2015, 02:09:05 AM
Please start from a known working config, trying to enable things one by one from the rpi default config will take you long.
Title: Re: Build a new version based on raspberry kernel 4
Post by: sbp on July 19, 2015, 03:03:03 AM
Please start from a known working config, trying to enable things one by one from the rpi default config will take you long.

Thanks. I agree and that is what I have been doing before.
Usually I extracted a .config from a piCore that Belá produced. However, I think the jump from 3.18.y to 4.0.y is too large for that to work.
At least this time I couldn't build a working version on 4.0 from a config from a 3.18 piCore.

I therefore think it would be a benefit for us all if we could define the piCore needed options so that they could be added to the config that is used for building the raspberry images from the Raspberry foundation.
The bcm2709_defconfig is used for that purpose (on a RPI2) and if we could figure out which options we need to add to this we would be able to benefit from the rapid development of the raspberry kernel in the piCore community as well.

Thus, For the moment I have these options added to the end of the bcm2709_defconfig file:

#START PICORE SPECIFIC SETTINGS:
CONFIG_CROSS_COMPILE="/cross/tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-"
CONFIG_LOCALVERSION="-piCore-v7"
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_GZIP=y
CONFIG_ZSMALLOC=y
CONFIG_ZCACHE=y
CONFIG_ZRAM=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
#STOP PICORE SPECIFIC SETTINGS:

Then I rename this file to .config , use "make ARCH=arm menuconfig" save the .config and start building the kernel and modules.

But obviously I still need to enable a few important options in the config file before a working version of piCore can be build. I don't think I'm missing much as all other things seems to work if only the loop devices could be mounted.

Steen

My proposal for defining piCore specific options in the config file is well in line with this proposal in the github https://github.com/raspberrypi/linux/issues/1065 and especially if you look at this post here where specific options for making a working Gentoo kernel is discussed: https://github.com/gtgt/gt-overlay/blob/master/patches/sys-kernel/pf-sources/3.11.1-4567_distro-Gentoo-Kconfig.patch

 
Title: Re: Build a new version based on raspberry kernel 4
Post by: Paul_123 on July 19, 2015, 05:58:08 AM
Have you tried the 3.18 config,   And run "make oldconfig"
Title: Re: Build a new version based on raspberry kernel 4
Post by: bmarkus on July 19, 2015, 10:05:25 AM
My experience is that after defconfig it requires lot of changes in config to get it working and trial and failure cycles, better to forget.

Using .config from a different main kernel version is also problematic, I had many head aches in the past.

The best way is to take a Raspbian kernel config as bases for the same kernel version and make changes on it. For sure it work and can be trusted for common stuff like SD card, USB, Ethernet, etc. What piCore (TC) need is the squashf fs module mandatory to mount TCZ's and optionally zram/zswap for compressed RAM blocks and compressed swap. Good point with Raspbian 4.0.8 is except zswap all necessary moduels enabled, you must enable only zswap to get it working on TC way.

There are smaller issues, that various new hw modules (RTC, USB devices, etc.) are not enabled in the Raspbian config, but it is easy to fix. Also, you may move some modules to the kernel, but all of these are not necessary to have it working.
Title: Re: Build a new version based on raspberry kernel 4
Post by: sbp on July 19, 2015, 11:07:32 AM
Thanks

So no easy path!

I'm a little confused about the development at raspberry, there seems to be a move from using spi-bcm2708 towards spi-bcm2835.
This has the consequence that different config files are used.

So what do you build piCore on the 2708 path or have you moved to 2835?

Regards
Steen
Title: Re: Build a new version based on raspberry kernel 4
Post by: bmarkus on July 19, 2015, 02:36:21 PM

So no easy path!


Why? It is easy to rebuild kernel based on Raspbian, only one setting must be changed. After updating firmware from GITHUB it works. I have done it for armv6 and it was working at first.

There is only one more easier way, to use piCore's boot :)
Title: Re: Build a new version based on raspberry kernel 4
Post by: Paul_123 on July 19, 2015, 05:17:52 PM
Getting it working is normally fast... Working the way you want it.....lol.    Hard to count how many times I had to compile when making major rev changes.

On the odroid,  all I had to add was.

Squashfs
Zram
Title: Re: Build a new version based on raspberry kernel 4
Post by: jgrulich on August 19, 2015, 12:04:51 AM
Please share the working config for 4.1.x. kernel build. I need to make the kernel modules and I'm not lucky yet.
I've tried the Raspbian config, but it's not working for TC.
Title: Re: Build a new version based on raspberry kernel 4
Post by: bmarkus on August 19, 2015, 01:22:25 AM
Just use

zcat /proc/config.gz

On 4.x it is in a kernel module, you need

sudo modprobe configs

before.


Title: Re: Build a new version based on raspberry kernel 4
Post by: jgrulich on August 19, 2015, 05:24:09 AM
That was the issue, the config is in the kernel module. Therefor I was not ale to find it.
Now it moved a step and get error in the scripts/basic/fixdep: gcc: error trying to exec 'as' : execvp: No such a file of directory.
Title: Re: Build a new version based on raspberry kernel 4
Post by: Rich on August 19, 2015, 07:24:25 AM
Hi jgrulich
Quote
... gcc: error trying to exec 'as' : execvp: No such a file of directory.
That means it can't find the assembler which is in binutils.tcz. Is  compile-essentials.tcz  installed?
Title: Re: Build a new version based on raspberry kernel 4
Post by: jgrulich on August 19, 2015, 09:05:49 AM
Hi Rich,

Thank's a lot. You're right. I've overseen that binutils.tcz is not included in the compile-essentials.tcz.dep and therefor is not automatically installed. Now it works.
Title: Re: Build a new version based on raspberry kernel 4
Post by: Rich on August 19, 2015, 09:37:39 AM
Hi jgrulich
Quote
I've overseen that binutils.tcz is not included in the compile-essentials.tcz.dep ...
True, but  gcc.tcz  is listed and it depends on  binutils.tcz  as shown in the  compile-essentials.tcz..tree  file:
Code: [Select]
compile-essentials.tcz
   autoconf.tcz
      perl5.tcz
   automake.tcz
      autoconf.tcz
         perl5.tcz
   glibc_base-dev.tcz
   glibc_apps.tcz
   glibc_add_lib.tcz
   glibc_gconv.tcz
   file.tcz
   gcc.tcz
      gcc_base-dev.tcz
      gcc_libs-dev.tcz
         gcc_libs.tcz
      binutils.tcz
      cloog.tcz
         isl.tcz
            gmp.tcz
      mpc.tcz
         mpfr.tcz
            gmp.tcz
   libtool.tcz
      libltdl.tcz
   m4.tcz
   make.tcz
   patch.tcz
Title: Re: Build a new version based on raspberry kernel 4
Post by: jgrulich on August 19, 2015, 12:37:27 PM
Apparently i have different dependeny tree for gcc and the binutils and some other are not listed there.
I'm using gcc.tcz Rev. 5.2.0 which is dated 2015/08/13. It's dependent only on isl.tcz and mpc.tcz.
Title: Re: Build a new version based on raspberry kernel 4
Post by: Rich on August 19, 2015, 02:11:16 PM
Hi jgrulich
The tree file I post was from TC6, I guess you're using TC7. I'm not sure why that was left out. I was under the impression that
gcc converts code to assembly and then assembles it.
Title: Re: Build a new version based on raspberry kernel 4
Post by: jgrulich on August 20, 2015, 02:47:24 AM
Yes, I'm using TC7.0 4.1.6-piCore_v7+.

Béla, please be so kind and update the dep for gcc.

Regards,

Jan
Title: Re: Build a new version based on raspberry kernel 4
Post by: sbp on September 06, 2015, 03:29:06 AM
Hi just for your info. I analyzed the differences between a default raspbian .config and the .config that Bela is using for building piCore for RPI2 (kernel 4.1.6).
So the following is what needs to be changed in a default .config:
Code: [Select]
CONFIG_LOCALVERSION="-piCore_v7"
CONFIG_ZSWAP=y
CONFIG_ZPOOL=y
CONFIG_ZSMALLOC=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
CONFIG_ZRAM=y
CONFIG_BLK_DEV_PMEM=m
# CONFIG_SND_SOC_ADAU1701 is not set
CONFIG_RTC_DRV_ABB5ZES3=m
CONFIG_RTC_DRV_ABX80X=m
CONFIG_RTC_DRV_HYM8563=m
CONFIG_RTC_DRV_PCF85063=m
CONFIG_RTC_DRV_DS1343=m
CONFIG_RTC_DRV_DS1347=m
CONFIG_RTC_DRV_MCP795=m
CONFIG_EXT4_ENCRYPTION=y
CONFIG_EXT4_FS_ENCRYPTION=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
CONFIG_ENCRYPTED_KEYS=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_XTS=y
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_LZO=y
CONFIG_LZ4_COMPRESS=y
CONFIG_SND_SOC_SIGMADSP=m

CONFIG_SND_SOC_SIGMADSP_I2C=m

For my own purpose I will add:
CONFIG_CROSS_COMPILE="/cross/tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-"
CONFIG_SND_USB_HIFACE=m

Regards
Steen