Kernel Building for new Devices

Forum to discuss the new MK902II LE RK3288 Quad Core Linux Mini PC.

Moderators: KEgg, twjordo, tatubias

Kernel Building for new Devices

Postby thorkel » Sun Mar 15, 2015 8:41 am

Hi,

I've got a couple of MK902II LE's which I'd like to connect some additional USB (DVB) devices to. These devices are part of the standard linux kernel source (and have been for some time), but aren't part of the 3.10 kernel image that the MK902II LE's come with. I've had a look around online and can't see the kernel source for MK902II's available.

The Firefly kernel at http://wiki.t-firefly.com/index.php/Fir ... _kernel/en seems the closest. However, if I do a build with this kernel using the firefly_rk3288_defconfig and firefly_rk3288.dts device tree, the device doesn't seem to boot. Without a console, it's a bit difficult to diagnose why. So does anybody know if the Firefly rk3288 kernel and associated device tree should boot the MK902II?

If it should, then I'm missing something to get this to boot. The steps I'm going through (on a separate linux machine, cross-compiling for ARM) are:

1. make firefly_rk3288_deconfig,
2. make zImage,
3. make firefly_rk3288.dtb,
4. cat zImage firefly_k3288.dtb > zImage-dtb
5. mkbootimg (with the generated zImage-dtb, the ramdisk from the boot.img the device came with, and the command line that the device came with).
6. Flash that down with rkflashtool to the boot partition of the device.

On reboot, the device doesn't do anything. Flashing down the original boot.img gets the device back to normal.

If the Firefly config doesn't work, is there an accessible source tree and associated device tree files somewhere that I'm missing for the MK902II?

Also, is there a serial port on the main board somewhere? Or a way to get the console displayed on the HDMI output? I've seen this post for the 802 ( viewtopic.php?f=6&t=2488 ). There appears to be an unpopulated 3-pin header on the board, but I don't have a scope to hand and my soldering is pretty ordinary so I don't want to risk trial-and-error!

If all of the above isn't possible, is it possible to get the .config for the 3.10 kernel running on the MK902II? The LinuxDVB source is typically quite good with legacy kernels, providing the .config file for the kernel is accessible. The running kernel on the MK902II's don't appear to have the .config option in the kernel config activated though, which means the config isn't available through /proc. Can't therefore easily do a standalone build of DVB.

Thanks
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby thorkel » Sun Mar 29, 2015 6:54 am

Ok, made some progress since when I made the post above. I've now got my own 3.10.0 kernel running on a MK902II with the USB modules that I wanted. Posting what I've learnt/did here, but note there's a few caveats and issues. Specifically:

- I haven't got any graphical output over HDMI yet with anything other than the stock kernel the device comes with. For my needs, I'm happy running the box headless but I may look at this if I get time. If you need a graphical desktop, more work needs to be done.
- Wireless also doesn't appear to be working at the moment. Gigabit ethernet is fine.
- There's the problem that others have noted on this forum that the MAC addresses for ethernet get randomly assigned on boot. You need to make sure you've set the box up for a static IP and the config isn't linked to a specific MAC (i.e. check you can ping and SSH into the box after a reboot or two).
- Given all the above, you need to make sure that you can SSH into the box over ethernet before you replace the kernel, and that config survives reboots, before you start.

If you don't back up the existing images before doing this, and if you don't ensure you've got network SSH access before you start, this has got a good chance of breaking your MK902II. In addition, I've only tried this on the two boxes that I own. I'm assuming there aren't any differences in shipping MK902IIs, but if there are then that could cause problems. Proceed at your own risk!

General Notes
-----------------

I hadn't done much with device trees before. It seems as if the procedure that is used for most boxes (compile the kernel and device tree file, and cat together) isn't necessary with the MK902II. The boot loader appears to be device tree aware, and there's a dedicated partition on the eMMC (resource) that contains the compiled device tree file. This means the boot.img doesn't appear to need a device tree file included as a 'second' file. If you append a compiled device tree to the end of the kernel (zImage) as per a lot of instructions on the web, the box won't boot.

There are 5 partitions on the eMMC.

1. Addr 0x0000 - Size 0x2000 - Not sure, but I guess the boot loader.
2. Addr 0x2000 - Size 0x8000 - resource . Contains the compiled device tree file. Can be extracted and decompiled to get the device tree (dts) file using some of the tools in the firefly kernel source tree
3. Addr 0xa000 - Size 0x8000 - boot . Contains the boot.img, and what we need to replace to install a new kernel.
4. Addr 0x12000 - Size 0x2000 - misc. Not sure.
5. Addr 0x14000 - Size (the rest) - linuxroot. The linux root file system. Interested in seeing if this can be replaced with Fedora ARM at some point.

Prereqs
---------

1. A host linux box to do the kernel compiles on. I've been using a Fedora 21 install on an x86_64 host.
2. A git clone of the firefly kernel
Code: Select all
git clone https://bitbucket.org/T-Firefly/firefly-rk3288-kernel.git

3. A git clone of the rkflashtool repo
Code: Select all
git clone https://github.com/neo-technologies/rkflashtool/

4. A git clone of the rock chip tools repo
Code: Select all
git clone https://github.com/neo-technologies/rockchip-mkbootimg.git

5. A git clone of the android gcc 4.6 compiler
Code: Select all
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6


You'll need to build rkflashtool (step 3), unmkbootimg and mkbootimg (both from step 4) and put the binaries somewhere on the path (e.g. /usr/local/bin).

Backing up
-------------

1. Connect a USB cable between the host machine and the slave USB port on the MK902II (the one by the microSD slot).
2. Get a pin and use it to depress the little button by the WiFi antenna for about 5 secs.
3. On the host machine, run
Code: Select all
sudo rkflashtool v

If the command returns with a chip version number, then all is good. If you get an error saying it can't be read, try depressing the pin again.
4. Backup the existing boot partition.
Code: Select all
sudo rkflashtool r boot > boot-original.img


This should generate a 16 megabyte file.

If you need to revert back to the stock kernel at any point, repeat steps 1 to 3 above. Then do:
Code: Select all
sudo rkflashtool w boot < boot-original.img


Extracting the ramdisk
----------------------------

We need to decompile the existing boot img to get the ramdisk. So, set up an appropriate location:
Code: Select all
mkdir -p ~/mk902ii/original
cd ~/mk902ii/original


Place the boot-original.img you extracted earlier into ~/mk902ii/original . Then do:

Code: Select all
unmkbootimg -i boot-original.mg


This will create two files. The 'kernel' file is the stock 3.10.0 kernel the MK902II LE comes with. The ramdisk.cpio.gz is apparently a ramdisk file, but I haven't been able to decompress it. It may be something else, but I've always built new boot images with this file included. We'll need the ramdisk file later.

Building a new kernel
---------------------------

1. Set up the environment for cross compiling. The PATH command below assumes you checked out the android compiler into your home drive (~). If you checked it out somewhere else, adjust the PATH as appropriate:
Code: Select all
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=~/arm-eabi-4.6/bin:$PATH


2. Build the firefly kernel. I've been using the firefly-rk3288-linux_defconfig . It may be that some of the other configs are more appropriate for the MK902II - I haven't explored the differences between them yet. So, assuming you cloned the firefly repo into your home drive:

Code: Select all
cd ~/firefly-rk3288-kernel
make firefly-rk3288-linux_defconfig
make zImage


3. Copy the new zImage and the old ramdisk to a location where you can build a new boot.img.

Code: Select all
mkdir -p ~/mk902ii/new
cp arch/arm/boot/zImage ~/mk902ii/new
cd ~/mk902ii/
cp original/ramdisk.cpio.gz new
cd new


4. Build a new boot.img
Code: Select all
mkbootimg --base 60400000 --kernel zImage --ramdisk ./ramdisk.cpio.gz --pagesize 16384 -o ./boot-new.img


Flash the new boot.img
-----------------------------

1. Connect a USB cable between the host machine and the slave USB port on the MK902II (the one by the microSD slot).
2. Get a pin and use it to depress the little button by the WiFi antenna for about 5 secs.
3. On the host machine, run
Code: Select all
sudo rkflashtool v

If the command returns with a chip version number, then all is good. If you get an error saying it can't be read, try depressing the pin again.
4. Backup the existing boot partition.
Code: Select all
sudo rkflashtool w boot < boot-new.img

5. Reboot the box
Code: Select all
 sudo rkflashtool b


The blue light should come on whilst the box boots. You won't see anything over HDMI, but the box should be ping-able once it boots (providing you set up the wired networking before). Try SSH'ing in.

Final notes
--------------

Not sure what the problem is regarding HDMI output at this point. It might be the kernel config used (firefly-rk3288-linux_defconfig) doesn't have the right options switched on. It might be that some changes have been made to the kernel source for the MK902II that was used to build the stock kernel, that aren't available in the firefly source. Or it could be that HDMI can be made to work with some command line parameters included as part of the boot-new.img . Not sure - will need some investigating.

I also had a quick try with the 3.19 kernel, which appears to have support for the rk3288 in mainline. No joy so far - box didn't appear to boot. Without a serial console, it's difficult to diagnose why.

However, with the approach above I was able to include DVB support along with the modules for the DVB adapter that I wanted. I've now got that adapter up and running on one of my MK902IIs, which is ultimately what I wanted to do.

Thorkel
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby bam » Mon Mar 30, 2015 11:49 am

Thanks for this elaborate explanation.

I'm going try this myself, to add multicast support to the kernel, see this post: http://www.rikomagic.co.uk/forum/viewtopic.php?f=21&t=7606.
But as you mentioned that WiFi is broken, I'm afraid it won't help me for the gateway application that I had in mind which needs LAN + WiFi + Multicast support.
Does someone have any idea to get the WiFi working in the firefly kernel?
bam
 
Posts: 12
Joined: Mon Feb 16, 2015 1:48 pm

Re: Kernel Building for new Devices

Postby thorkel » Mon Mar 30, 2015 1:05 pm

Ok, I haven't tried this yet.

But it appears as if the Firefly kernel defaults to using an AP6335 for the WiFi chip. I've put my mk902ii back together, but looking at the image here:

http://www.arctablet.com/blog/featured/ ... ming-soon/

it seems as if the wireless chip is an AP6210 (silver chip on the bottom left). That's deactivated in the firefly config at the mo. So, as a guess, after running 'make firefly-rk3288-linux_defconfig', edit .config and look for the line:

CONFIG_AP6335=y

Change that to:

CONFIG_AP6210=y

And save. Maybe that'll work? I might give it a go over the weekend if I get time.

Thorkel
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby thorkel » Mon Apr 06, 2015 8:59 am

Ok,

Think I've made some progress. I've got HDMI working for my own built kernels. I *think* WiFi should work, but I've borked something on my test board - WiFi isn't working on that board with the original kernel either at the mo.

This is a bit hacky. Attached to this post should be a tar file with three patched files. To apply this, cd into the root of the firefly source directory and do:

tar zxvf <wherever-you-put-the-tar>/mk902ii-3.10-kernel-patched-files.tar.gz

This should unpack the 3 files in to the right locations. The only change you need to do to build a kernel from my previous post is to replace the 'make firefly-rk3288-linux_defconfig' line in the previous instructions with the following:

Code: Select all
make rikomagic-mk902ii-linux_defconfig


Follow the rest of the instructions and it should build a working kernel with HDMI output. It works for me anyway!

As before, make sure you have a working backup of the boot partition before trying this.

------------

Technical Details of the changes are as follows.

1. The firefly kernel source doesn't appear exactly the same as what was used to build the stock mk902ii kernel. When building the firefly kernel, there were two main issues on boot:

- The act8846 PMU driver was beginning to initialise, but then throwing errors. There are some GPIO calls made to detect various functions, the third of which appears to be something to do with CPU detection. This errors, and causes the rest of the act8846 driver to bomb out. The attached file just comments out the problematic call, which allows the rest of the act8846 init to complete successfully. It doesn't look like the GPIO call is needed.

My hunch is that either the act8846 driver has continued to be developed (don't know what's newer - mk902ii stock or firefly) and there are some changes with the Device Tree structure which is coupled to the driver. So either there's a newer act8846.c driver that Rockchip have developed which works with the mk902ii device tree in the resources partition, or the device tree in the resources partition will need updating to work with the latest act8846 driver. Either way, the hacked act8846.c file does enough to get the RK1000 to initialise (more on that in a sec).

- The rk3288-hdmi driver was bombing out on CEC clock initialisation. Again, I don't need CEC for what I'm doing so I've just commented the problematic section out of the driver for the time being. This allows the rest of the driver to complete its initialisation.

2. There are some differences with the mk902ii config file. The most notable one is the mk902ii appears to contain an RK1000 MFD chip, rather than the MK808 that's in the firefly. So, the attached config enables that.

Enabling this option caused quite a few issues initially. The RK1000 driver in the firefly source tree is really sensitive to the rest of the kernel config. For quite a while I couldn't get a kernel to boot with this option switched on, although it was clearly needed by looking at the debug output from the stock kernel.

I believe the change that got the RK1000 driver to init properly was the act8846 driver change described above (which allowed the act8846 to complete its init). In short, a firefly kernel which has RK1000 switched on but doesn't have the act8846 changes won't boot.

3. Regarding WiFi, my board appears to have an AP6330 chip on it, with a 26 MHz modulator (don't have a magnifying glass to hand, but I think that's what the modulator has written on it. My eyes aren't as good as they used to be....). The chip is on the other side of the board from the AP6330. So, the attached config enables that.

Given the picture on the web has an AP6210 on the main board, that means there's a possibility that different boards have different wireless chips on them. The firefly kernel config requires the specific AP chip type to be selected. So, if WiFi doesn't work, you may need to do some investigating.
Attachments
mk902ii-3.10-kernel-patched-files.tar.gz
Patched kernel files
(31.67 KiB) Downloaded 220 times
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby bam » Mon Apr 06, 2015 3:47 pm

thanks Thorkel,

I followed your post to build the kernel myself, so I could activate multicast in the process.
But I'm afraid Wifi is still not OK. The chip on my board is AP6330, but activating this in the .config is no cure. I also tried with 6335 and others but as I expected I had no luck there.
I read 26MHz on the wifi crystal and set that correctly, so that's not the problem either.
If I type ifconfig, the wlan0 is just not there. Would you have other suggestions to check what's wrong?

For the record, I had another minor struggle because I'm on a 32bit host, I had to find the 32 bit android gcc compiler. Solved by cloning with this command:
Code: Select all
git clone -b jb-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6


It may be interesting for others to share all my cmd line input:
Code: Select all
Running Ubuntu linux in Virtual Box (32-bit) on Windows (64-bit)

~/projects$ cd ~/projects/rikomagic/kernel/
~/projects/rikomagic/kernel$ git clone https://bitbucket.org/T-Firefly/firefly-rk3288-kernel.git
~/projects/rikomagic/kernel$ cd ../tools
~/projects/rikomagic/tools$ git clone https://github.com/neo-technologies/rkflashtool/
~/projects/rikomagic/tools$ git clone https://github.com/neo-technologies/rockchip-mkbootimg.git
~/projects/rikomagic/tools$ # first command is for 64 bit, second is for 32 bit
~/projects/rikomagic/tools$ #git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
~/projects/rikomagic/tools$ git clone -b jb-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6

~/projects/rikomagic/tools$ cd rkflashtool
~/projects/rikomagic/tools/rkflashtool$ sudo apt-get install libusb-1.0-0-dev
~/projects/rikomagic/tools/rkflashtool$ make
~/projects/rikomagic/tools/rkflashtool$ cd ..

~/projects/rikomagic/tools$ cd rockchip-mkbootimg
~/projects/rikomagic/tools/rockchip-mkbootimg$ sudo apt-get install libssl-dev
~/projects/rikomagic/tools/rockchip-mkbootimg$ make
~/projects/rikomagic/tools/rockchip-mkbootimg$ cd ..

Connect a USB cable between the host machine and the slave USB port on the MK902II (the one by the microSD slot).
Get a pin and use it to depress the little button by the WiFi antenna for about 5 secs.

In virtual box, click the little USB icon at the bottom and select 2207:320A [0100]

Now it works:
~/projects/rikomagic/tools$ sudo ./rkflashtool/rkflashtool v
rkflashtool: info: rkflashtool v5.2
rkflashtool: info: Detected RK3288..
rkflashtool: info: interface claimed
rkflashtool: info: chip version: 320A-2013.11.16-V100

~/projects/rikomagic/tools$ cd ../bootimg/original
~/projects/rikomagic/bootimg/original$ sudo ../../tools/rkflashtool/rkflashtool r boot > boot_orig_MK902II.img
~/projects/rikomagic/bootimg/original$ ../../tools/rockchip-mkbootimg/unmkbootimg -i boot_orig_MK902II.img

~/projects/rikomagic/bootimg/original$ cd ../../kernel/firefly-rk3288-kernel/
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ export ARCH=arm
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ export CROSS_COMPILE=arm-eabi-
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ export PATH=~/projects/rikomagic/tools/arm-eabi-4.6/bin:$PATH
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ make firefly-rk3288-linux_defconfig
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ gedit firefly-rk3288-linux_defconfig
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ make menuconfig

networking support -> networking options -> enable the following
  IP: multicasting
  IP: tunneling (required to use tunneling with mrouted)
  IP: multicast routing + its sub-options
  The IPv6 protocol

The IPv6 protocol opens an extra options screen. enable
  IPv6: multicast routing + its sub-options.

replace CONFIG_AP6335=y with CONFIG_AP6210=y

~/projects/rikomagic/kernel/firefly-rk3288-kernel$ sudo apt-get install lzop
~/projects/rikomagic/kernel/firefly-rk3288-kernel$ make zImage

if asked to confirm the wifi CONFIG change, just do so. If asked for a frequency, the wifi christal has 26MHz written on it.

~/projects/rikomagic/kernel/firefly-rk3288-kernel$ cd ../../bootimg/firefly
~/projects/rikomagic/bootimg/firefly$ cp ../../kernel/firefly-rk3288-kernel/arch/arm/boot/zImage .
~/projects/rikomagic/bootimg/firefly$ cp ../original/ramdisk.cpio.gz .
~/projects/rikomagic/bootimg/firefly$ ../../tools/rockchip-mkbootimg/mkbootimg --base 60400000 --kernel zImage --ramdisk ./ramdisk.cpio.gz --pagesize 16384 -o ./boot_20150406_firefly_mcast_wifi.img

~/projects/rikomagic/bootimg/firefly$ sudo ../../tools/rkflashtool/rkflashtool w boot < boot_20150406_firefly_mcast_wifi.img
rkflashtool: info: rkflashtool v5.2
rkflashtool: info: Detected RK3288...
rkflashtool: info: interface claimed
rkflashtool: info: working with partition: boot
rkflashtool: info: found offset: 0x0000a000
rkflashtool: info: found size: 0x00008000
rkflashtool: info: writing flash memory at offset 0x0000f520... Done!
rkflashtool: info: premature end-of-file reached.

~/projects/rikomagic/bootimg/firefly$ sudo ../../tools/rkflashtool/rkflashtool b


Edit:
I've tried with the patch you provided as well. The build fails when I try to activate multicast (still looking into that), but without multicast the build succeeds, but sadly still no wifi...
bam
 
Posts: 12
Joined: Mon Feb 16, 2015 1:48 pm

Re: Kernel Building for new Devices

Postby thorkel » Tue Apr 07, 2015 10:47 am

Ok, first things first. Try replacing the arch/arm/configs/rikomagic-mk902ii-linux_defconfig file with the one attached to this post. It won't fix WiFi, but it should actually enabled some of the stuff I mentioned in my previous post (RK1000 was deactivated in the version I posted) and it should have all the multicast stuff switched on. This kernel tree is pretty brittle. What appear to be unrelated components seem to have some sort of underlying dependency (e.g. the rockchip hsadc driver seems to build with some kernel options, and not build with others).

As for WiFi, I'm making some progress. In the kernel log from when I was using the stock kernel, there's this:

Code: Select all
Jan  1 12:00:21 localhost kernel: [   21.478059] dhd_conf_set_fw_name_by_chip: firmware_path=/system/etc/firmware/fw_RK903_ag.bin
Jan  1 12:00:21 localhost kernel: [   21.533346] Final fw_path=/system/etc/firmware/fw_RK903_ag.bin
Jan  1 12:00:21 localhost kernel: [   21.533379] Final nv_path=/system/etc/firmware/nvram_AP6330.txt
Jan  1 12:00:21 localhost kernel: [   21.533401] Final conf_path=/system/etc/firmware/config.txt
Jan  1 12:00:21 localhost kernel: [   21.602929] NVRAM version: AP6330_NVRAM_V1.0_20121130


Looking at rk_wifi_config.c in the drivers/net/wireless/rockchip_wlan/rkwifi in the firefly source, this is exactly the firmware files, in the right location, that should be loaded if CONFIG_AP6330 is selected in the kernel config. All good. However, I don't see these messages in a kernel I build.

Earlier on in the boot there's also this:

Code: Select all
Jan  1 12:00:19 localhost kernel: [   20.023579] ==== Launching Wi-Fi driver! (Powered by Rockchip) ====
Jan  1 12:00:19 localhost kernel: [   20.023601] =======================================================
Jan  1 12:00:19 localhost kernel: [   20.023624]  WiFi driver (Powered by Rockchip,Ver 4.80.WFD.OOB) init.
Jan  1 12:00:19 localhost kernel: [   20.023707] ======== PULL WL_REG_ON HIGH! ========


That version number is the same as what is in the reversion.c in the bcmdhd subdir of rkwifi. Implies the firefly source for the wireless driver is the same as that used in the stock kernel. Again, I don't see that message in a kernel I build.

The first differences related to wifi between a kernel I build and the stock kernel in the kern.log is the following which I get in stock, but not in one I build.

Code: Select all
Jan  1 12:00:18 localhost kernel: [   18.928955] wifi_power_write: poweren = 1
Jan  1 12:00:18 localhost kernel: [   18.928990] [WLAN_RFKILL]: rockchip_wifi_power: 1
Jan  1 12:00:18 localhost kernel: [   18.929015] [WLAN_RFKILL]: rockchip_wifi_ref_voltage: 1
Jan  1 12:00:18 localhost kernel: [   18.929052] [WLAN_RFKILL]: rockchip_wifi_ref_voltage: wifi io reference voltage control is disabled.
Jan  1 12:00:18 localhost kernel: [   19.034565] [WLAN_RFKILL]: wifi turn on power. 156


So, something seems to be writing a bit to power up wifi in the stock kernel which isn't happening with the firefly tree/config. wifi_power_write is in the rkwifi_sys_iface.c file, and the rkwifi sys interface does appear to be loaded as it appears earlier in the boot sequence. Seems to imply that something needs to be poked into a /sys file somewhere to switch the power on to the wifi chip, if it's built with CONFIG_AP6330.

I'll keep looking.

Thorkel
Attachments
rikomagic-mk902ii-linux_defconfig.gz
(22.81 KiB) Downloaded 178 times
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby thorkel » Tue Apr 07, 2015 10:56 am

Ok - it seems the Ubuntu install the 902 comes with activates WiFi power through a couple of commands in /etc/rc.local. Specifically:

Code: Select all
# turn on wifi
echo "Turn on wifi."
echo 1 > /sys/class/rkwifi/power
sleep 1
echo 1 > /sys/class/rkwifi/driver


If I try and repeat those commands as root with a kernel I build, I get permission denied. So, something seems up with the sysfs interface.
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby thorkel » Tue Apr 07, 2015 11:17 am

Final post of the day. The echo command into sysfs does work. I was making a mistake with sudo and redirection. If you actually su to root, and execute the

Code: Select all
echo 1 > /sys/class/rkwifi/power


Then you get the correct power messages to wifi appearing in the kernel log. These messages don't appear on boot. Hunch here is the different kernel means something isn't initialised in time, before rc.local executes. So, when they get called the files don't exist or something similar.

However, still no wifi yet though. Initialising the driver with

Code: Select all
echo 1 > /sys/class/rkwifi/driver
doesn't cause the driver to load the firmware or output any visible kernel messages. It does something, because if you execute the same command again there's an error. Hopefully can figure this out later in the week.
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Re: Kernel Building for new Devices

Postby thorkel » Wed Apr 08, 2015 1:36 pm

Ok, I may have wifi working, to some extent, I certainly now get a wlan0 device, and can associate with an ap using iwconfig. Having some problems with encrypted networks though - that's not working on my box yet. Think something is wrong with the config still. Bam - interested to know how you get on.

The problem is that the stock kernel source the 902 was built with does appear to differ from the firefly sources. In this case, the rkwifi driver is looking for a particular string in the device tree to activate a specific wlan config. The device tree on the 902 has a different string/name.

The easiest mod is to edit the file net/rfkill/rfkill-wlan.c in the firefly kernel source. Go to line 99 - they'll be the following:

Code: Select all
if (strcmp(wifi_chip_type_string, "bcmwifi") == 0) {


Replace the bcmwifi that's in quotes with rkwifi so it reads

Code: Select all
if (strcmp(wifi_chip_type_string, "rkwifi") == 0) {


Save, and rebuild the kernel.

On reboot, the device still doesn't init wlan on boot at the mo. Not sure what's changed there.

Su to root, and do:

Code: Select all
echo 1 > /sys/class/rkwifi/power
echo 1 > /sys/class/rkwifi/driver


A wlan0 device should now appear.

As I say, I don't think this is the end of it yet. Mine won't associate within encrypted wlan at the mo. If others have that problem, I'll keep looking,

Thorkel
thorkel
 
Posts: 12
Joined: Sun Jan 11, 2015 6:27 am

Next

Return to Rikomagic / Cloudsto MK902II LE RK3288 Quad Core Linux Mini PC

Who is online

Users browsing this forum: No registered users and 1 guest