Author Topic: A20 (A10?) Temperature logging script  (Read 23533 times)

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #15 on: April 06, 2014, 11:52:12 am »
Hi ssvb,

Thanks a lot for that description  :D ! I will give it a try and report my experiances.

About the issues:
ok, understood. I think for me it will be ok anyway. Thats why I asked for the more preferable way: applying the patch or backport the main driver with sensor support to the 3.4  kernel. What is neccessary for such a backport?
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #16 on: April 22, 2014, 03:11:33 pm »
Hi ssvb,

I tried to follow your instructions. I think I succsessfully cloned the kernel source and applied the patch.

Then I tried to configure and compile the kernel. I followed the tutorial in your link. I think this was not successful, but I don't know why and how to fix it. Can you help me?

Configuring gives this output:
Code: [Select]
linaro@linaro-ubuntu-desktop:/media/Toshiba_1000GB/Jojo/Rumpel/Projekte/Cubieboard/Kernel_3.4.75+/linux-sunxi$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
drivers/net/wireless/bcmdhd/Kconfig:42:warning: defaults for choice values not supported
#
# configuration written to .config
#

Compiling gives this output:
Code: [Select]
linaro@linaro-ubuntu-desktop:/media/Toshiba_1000GB/Jojo/Rumpel/Projekte/Cubieboard/Kernel_3.4.75+/linux-sunxi$ make -j2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
  CHK     include/linux/version.h
  CC      scripts/mod/empty.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/utsrelease.h
make[1]: »include/generated/mach-types.h« is up to date.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  AS      usr/initramfs_data.o
  LD      usr/built-in.o
/bin/sh: 1: arm-linux-gnueabihf-ld: not found
make[1]: *** [usr/built-in.o] Error 127
make: *** [usr] Fehler 2
make: *** Warte auf noch nicht beendete Prozesse...
  CC      init/main.o
  CHK     include/generated/compile.h
  SKIPPED include/generated/compile.h
  CC      init/do_mounts.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  CC      init/do_mounts_rd.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  CC      init/do_mounts_initrd.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  CC      init/initramfs.o
  CC      init/calibrate.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  CC      init/version.o
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
  LD      init/mounts.o
/bin/sh: 1: arm-linux-gnueabihf-ld: not found
make[1]: *** [init/mounts.o] Error 127
make[1]: *** Waiting for processes to be finished...
/bin/sh: 1: arm-linux-gnueabihf-objdump: not found
make: *** [init] Error 2

Thanks a lot in advance,
Jojo
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline ssvb

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +5/-0
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #17 on: April 22, 2014, 03:32:53 pm »

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #18 on: April 23, 2014, 07:06:46 am »
Maybe you have skipped the http://linux-sunxi.org/Linux_Kernel#Get_a_toolchain step?

Hm, I am not sure if I did it right. I was on the toolchain site. I did the first steps (for Ubuntu 10.04) successfully. But the link for the linaro thing was dead yesterday. I will try again today (the link seems to work now).
Does something on my terminal output indicate a toolchain error? I want to learn to help myself ;) .

Greetings
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline ssvb

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +5/-0
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #19 on: April 23, 2014, 07:19:57 am »
Does something on my terminal output indicate a toolchain error? I want to learn to help myself ;)
The "arm-linux-gnueabihf-objdump: not found" message implies that you apparently don't have the arm-linux-gnueabihf-objdump program, which is a part of toolchain.

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #20 on: April 23, 2014, 07:59:56 am »
Ok, thank you!

I hope my process so far was really correct. But I will see and let you know :) !
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #21 on: April 30, 2014, 04:27:46 am »
Hi again,

until now I have not been able to successfully recompile my kernel with the applied patch  :'( . I am right before the point to bury this whole idea deep deep inside an internal abyss of neverending darkness  >:( ! But I will give it one more try. Please have a look at my procedure to see what might be wrong.

These will be my steps:
1. downloading the kernel source from https://github.com/patrickhwood/linux-sunxi

2. "cd" into the linux-sunxi directory

3. download and apply the patch with
Code: [Select]
wget -O cpu-thermal-sensor.path https://groups.google.com/forum/message/raw?msg=linux-sunxi/2zoxTcepPVo/q4f3D1ZEm8cJ
git am cpu-thermal-sensor.path
(using exactly these commands when inside my kernel directory)

4. download the 4.7-toolchain from https://launchpad.net/linaro-toolchain-binaries/+download

5. add the toolchain to my environment with
Code: [Select]
export PATH="$PATH":/path_to_my_toolchain/gcc-linaro-arm-linux-gnueabihf-*_linux/bin/
(I will insert the exact version number instead of the *. So export PATH="$PATH": will stay as it is, right?)

6. "cd" into the linux-sunxi directory (kernel)

7. do this:
Code: [Select]
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
(do I have to deactivate the TP driver at/before this point?)

8. do this:
Code: [Select]
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 uImage
(using -j2 because of two CPU cores)

These are the internet references I am using:

Note: I am compiling directly on my CB2.

Where might be some kind of traps? Are there any errors or critical steps?

Thanks and greetings!
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline lampra

  • Newbie
  • *
  • Posts: 43
  • Karma: +2/-2
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #22 on: April 30, 2014, 07:16:41 am »
Hi, i am not an expert but if you compile the kernel on CB2 or CT, then i believe you do not need a toolchain for cross compilation. Just compile the kernel without cross compilation.
You would need toolchain for cross compilation if you were to compile the kernel on another machine using another arch (eg. x86_64)

This might help you a bit:
Code: [Select]
https://github.com/igorpecovnik/Cubietruck-Debian/blob/master/build.sh
« Last Edit: April 30, 2014, 07:40:21 am by lampra »

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #23 on: April 30, 2014, 10:07:42 am »
Hi,

ok, thanks for the answer  :) ! But then I think the compilation on the CB2 should have worked w/o any changes in the toolchain  :o ?!

Anyway, I will try my steps from above on another Linux machine at home. This should also be much faster ;) ...

Any hints about doing that on the CB directly?

Cheers
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline lampra

  • Newbie
  • *
  • Posts: 43
  • Karma: +2/-2
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #24 on: April 30, 2014, 06:27:00 pm »
Well, I didn't compile any kernel on CB directly so no hints.
I expect that general compilation instructions would apply.
Code: [Select]
http://www.linux.org/threads/the-linux-kernel-compiling-and-installing.5208/

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #25 on: May 05, 2014, 03:49:54 am »
Hi,
thanks for the link. I will read it carefully and maybe I will try it once more next week, when I am sober again  ;D .
About my previous try: I epically failed  :'( >:( :'( !!!

I still think the better soöution would be to backport the original and full-functional TP driver to our kernel. Then we have access to the sensor and can still use the TP...

Greetings
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline hds

  • Newbie
  • *
  • Posts: 7
  • Karma: +2/-0
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #26 on: May 15, 2014, 03:59:31 am »
you may check the sunxi_dbgreg.ko module and how to use it.

http://www.cubieforums.com/index.php?topic=2493.0

Regards
Heiko
« Last Edit: May 15, 2014, 04:04:24 am by hds »

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #27 on: June 26, 2014, 04:30:07 am »
Hello again,

I want to give an update/feedback about the last tests.

@Heiko:
thank you for that link. I like the idea to have direct access to processor registers. Even if that requires a lot of reading datasheets, to be sure about what you are doind :) .

About the patch: I have been able to apply the stand-alone patch to some of my test-kernels. It worked like a charm! The previous problems were somewhere deep inside my old Linux Mint OS. I reinstalled it and compilation worked without any problems.

I have also found an updated version of the TP driver, which adds support for the temperature sensor. Found here:
https://groups.google.com/forum/#!searchin/linux-sunxi/touch/linux-sunxi/296dOr2MWM4/SIr2JijWhjUJ
 I tried to apply that patch in the same way as SSVB has described it a few posts ago, but that did not work. Sadly, I can not remember the error messages from the terminal at the moment. And the were in german  :-\ .
I think the problem could be, that the driver seems to be written for A10 devices. But how does the patch know, that I am running an A20  :o ?! Or is there another way to get the updated version of the driver working?

Greetings
Don't think that anyone will take more pains for his answer, as you took for your question.

Offline cabji

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #28 on: January 08, 2015, 02:20:13 pm »
Hi Jojo,

When I run this script it gives me this output:

catfish@cubie:~/incoming$ ./templog.sh
Temperature logging started in file "Temp_log_05:13:35.txt"...
./templog.sh: line 29: ./Temp_log_05:13:35.txt: Invalid argument
./templog.sh: line 29: ./Temp_log_05:13:35.txt: Invalid argument
./templog.sh: line 29: ./Temp_log_05:13:35.txt: Invalid argument

I'm not very good with bash scripts but I had a look and couldn't really find anything I thought is wrong. Am I missing a package that is used by the script perhaps? (Checked and I have: dirname tput, cat, bc so I can't see it being that either.)

Edit: I found the problem was with the colons in the log filename. I changed lines 18 and 29 to get the following (strips colons from filename)

Code: [Select]
#!/bin/bash
 
 
logging_start_time=$(date +%T)
script_dir=$(dirname $0)
delay=$1
 
if [ "$delay" = "0" ]
then
        delay=1
fi
 
if [ "$delay" = "" ]
then
        delay=1
fi
 
echo "Temperature logging started in file \"Temp_log_"${logging_start_time//:}".txt\"..."
 
tput civis
read -n 1 -t 1 -s
 
while [ $? -ne 0 ]
do
        T_actual=$(cat /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input)
        T_actual=`echo "scale=1 ; ${T_actual}/1000" | bc`
        time_stamp=$(date +%T)
        echo -n $time_stamp$'\t'$T_actual"°C "$'\r'
        echo $time_stamp$'\t'$T_actual >> "$script_dir/Temp_log_"${logging_start_time//:}".txt"
        read -n 1 -t $delay -s
done
 
echo $'\n'
 
tput cnorm
 
echo "Logging stopped at $(date +%T)"
 
« Last Edit: January 10, 2015, 06:51:18 pm by cabji »

Offline Jojo

  • Developer
  • Full Member
  • ***
  • Posts: 190
  • Karma: +13/-0
  • Cubieboard 2 - A20, aRUNTU v1.666
    • View Profile
Re: A20 (A10?) Temperature logging script
« Reply #29 on: January 15, 2015, 10:20:06 am »
Hi and sorry for my late response!

Glad to hear that you have managed to fix it :) . I am wondering, why this problem did not occure during my tests. You know... I would not have released it, if the fundamental functionality would not have worked :P ;) !

If other problems occury: don't hesitate to ask.

Cheers!
Don't think that anyone will take more pains for his answer, as you took for your question.