Nook Touch kernel hacking

Search This thread

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
rc.pvr, the module loader, is called in the init script:
Code:
/data/local/tmp/init.rc


Code:
service pvrsrv /system/bin/sh /system/bin/sgx/rc.pvr start
 

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
OK from what I understand, init and the init script are both rolled into the uImage, since they aren't part of any other partition. To change the init script we would then need to create a new uImage somehow, or we would need to make UBoot pass an argument to the kernel to use a different init script. I can figure out how to do the second one pretty easily but it's super hacky and I'm a bit burnt-out with this right now. Y'all are welcome to try it, though.

EDIT: I forgot the reason I made this post in the first place;

Does anyone have a list of differences between the stock 2.1 kernel and userland and the Nook 2.1 kernel and userland, or is this something to look into?

(I mean things other than the obvious, like different APKs)
 
Last edited:

corge

Member
Apr 15, 2012
25
7
Hi all.
Please correct me where I'm wrong in current situation.

1. It is impossible to even get a complete working system built from B&N sources because of no GPU and WLAN drivers there (even as a just binaries).

2. Possible solutions are:
a) Use binary kernel modules. Extract them from system installed at (rooted) stock NST. Limits you to use the exact kernel version (2.6.29) and a few tuning is possible.
b) Build modules from sources:
-- Video drivers (omaplfb and pvrsrvkm): TI SDK (http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html). More info: http://processors.wiki.ti.com/index...nts_that_require_installation_onto_the_target
-- WLAN (tiwlan_drv): ? All I've found for now is following, but I'm not sure it is helpful:
http://www.jorjin.com/WG7310-20.html (chip manufacturer)
http://omappedia.org/wiki/Porting_WLAN_to_Android (maybe the best, note omapzoom.org reference. However, it isn't easy to pick an alive branch there)
http://omappedia.org/wiki/WiLink_Connectivity_Project (just firmware by the link at gforge.ti.com, no kernel modules?)
http://www.omappedia.org/wiki/Porting_MCP_WLAN_to_Android (almost same page as previous)
http://omappedia.org/wiki/Getting_TI_MCP_drivers_working_on_Android (however, related to omap4 / blaze)
http://e2e.ti.com/support/low_power_rf/f/307/t/33000.aspx#275259 (there is even a possibility to got WLAN working at 2.6.32, not .29)
 
Last edited:

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
I notice I'm a bit late to the party on this but holy mackerel what is the purpose of all these kernel configs in the B&N source???? (distro/kernel/arch/arm/configs)
There are even six targeted towards the OMAP 3621. Y'all used `omap3621_gossamer_defconfig` and `omap3621_gossamer_evt1c_defconfig` but do any of the others work? (boot)

I guess I will compile one for all six and stick them on Dropbox...
 

corge

Member
Apr 15, 2012
25
7
Y'all used `omap3621_gossamer_defconfig` and `omap3621_gossamer_evt1c_defconfig` but do any of the others work? (boot)
Also it may be a question what is right from this two cases. Could anyone please show the `cat /proc/cpuinfo` output? "Revision" there is indicating a needed config.
 

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
I'll run that and paste the output once I get my nook back from having left it at the YMCA :eek:

In the meantime I have been fooling with the Cyanogenmod source and from what I understand, it's just a userland with no hard requirement on what kernel it runs on (??? You would think it to be more standardized...) Despite this, there appears to be some 'correct' kernel described in: http://wiki.cyanogenmod.com/wiki/Integrated_kernel_building and http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source

I'm building the B&N Nook Color kernel under the provided omap3621 config just to see what happens, although I don't think it will do much as it appears that the config is generic.

---

Kallooks! Kallooks! It boots, it boots!!!! I've finally gotten to the point where the OP was; I was able to compile the kernel provided by nook source and run it off of the SD card. I'll document how to do it on the NookDevs wiki.

Also, here is the code you requested:

Code:
# cat /proc/cpuinfo
Processor		: ARMv7 Processor rev 2 (v71_
BogoMIPS		: 597.64
Features		: swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer		: 0x41
CPU architecture	: 7
CPU variant		: 0x3
CPU part		: 0xc08
CPU revision		: 2

Hardware		: OMAP3621 GOSSAMER board
Revision		: 0005
Serial 		: 3014430162723006
 
Last edited:
  • Like
Reactions: corge

corge

Member
Apr 15, 2012
25
7
I've finally gotten to the point where the OP was; I was able to compile the kernel provided by nook source and run it off of the SD card.
Could you please describe more exactly whan you've done with GPU and WiFi modules?
And just to be sure: to be able to boot from SD the device must be rooted before, is it so?

Code:
Revision		: 0005

Thanks! I spent some time wondering how it can be, but then noticed you used Nook Color, not ST ;)
I meant look at this with rooted NST to define a best config to it. Seems like revision is really read from HW, not defined by config you choose (at least in u-boot, but let's trust them a bit;)
Possible values (just copy-paste from arch/arm/plat-omap/include/mach/board-boxer.h):
Code:
BOARD_ENCORE_REV_EVT1A      0x1
BOARD_ENCORE_REV_EVT1B      0x2
BOARD_ENCORE_REV_EVT2       0x3
BOARD_ENCORE_REV_DVT        0x4
BOARD_ENCORE_REV_PVT        0x5

BOARD_ENCORE_PROD_3G        0x8

BOARD_ENCORE_REV_UNKNOWN    0x6

BOARD_GOSSAMER_REV_EVT1A    0x1
BOARD_GOSSAMER_REV_EVTPRE1C    0x2
BOARD_GOSSAMER_REV_EVT1C    0x3

And some tips:

Code:
encore_board_evt2:                   revision >= BOARD_ENCORE_REV_EVT2

gossamer_board_compatible_evt_pre1c: revision <= BOARD_GOSSAMER_REV_EVTPRE1C

I'll document how to do it on the NookDevs wiki.
Please post here a link then.

Finally, some more good news: it might be possible to use upstream wl12xx WiFi driver instead of closed-source tiwlan.

Also, a kernel here contains come code related to our GPU (drivers/gpu/pvr/): git://git.omapzoom.org/kernel/omap.git
 
Last edited:

cceerrtt

Senior Member
Sep 14, 2010
147
24
> And just to be sure: to be able to boot from SD the device must be rooted before, is it so?

No, it is not needed.
 
  • Like
Reactions: corge

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
You don't have to modify the provided source to get it to boot. At any rate, here is the guide:

http://nookdevs.com/Building_the_Nook_Touch_stock_kernel#Step_3:_Configure_and_Compile_the_Source

Like the OP I am really not sure where to go here, although it is my intuition to get the latest and greatest Linux kernel to boot on it, then later try to get working whatever is the latest CyanogenMod 9 userland.

Somewhat blindly, I decided to just try and compile Linux 3.3.2 under omap3621_gossamer_evt1c_defconfig, and use `make oldconfig` with all the defaults. Unfortunately, the uImage it produces does not load the kernel the right memory address (0x80008000 instead of 0x20008000) and I suspect the issues go much deeper than this. Needless to say it doesn't work...


For what it's worth, and slightly unrelated, here is a diff of Linux 2.6.29 and the Nook kernel (based on 2.6.29): http://dl.dropbox.com/u/1494123/Access/LinuxToNook.diff
 
Last edited:
  • Like
Reactions: corge

darkguy2008

Senior Member
Apr 30, 2011
672
240
Heredia
I haven't investigated much on the recent posts, but I would strongly suggest compiling CM6 (or even Eclair or Froyo) since it's what the device currently runs, and then try CM7 and then CM9. CM9 isn't even ready for devices better than the NST (Defy?), it's buggy and HWA doesn't work very well, it would cause too much problems I think, rather than using a stable base.
 

corge

Member
Apr 15, 2012
25
7
You don't have to modify the provided source to get it to boot. At any rate, here is the guide:
http://nookdevs.com/Building_the_Nook_Touch_stock_kernel#Step_3:_Configure_and_Compile_the_Source
Thank you!
You say it boots, but what do you mean exactly? It works just like stock NST (excluding maybe some lack of speed because of SD card), or it is related to kernel only (say, before the init spawning point)?
In case of former I don't fully understand how it is possible without at least gpu modules.

EDIT: but maybe I understand ;) Produced uImage seems like only kernel proper, so needed modules may be still loaded from stock userspace FS.
If so, it will be a problem even for using Gingerbread (2.6.35 kernel).

Like the OP I am really not sure where to go here, although it is my intuition to get the latest and greatest Linux kernel to boot on it, then later try to get working whatever is the latest CyanogenMod 9 userland.
I haven't investigated much on the recent posts, but I would strongly suggest compiling CM6 (or even Eclair or Froyo) since it's what the device currently runs, and then try CM7 and then CM9.
As for me, the point is also a HW requirements. NST has 800MHz single-core ARM and 256MB of RAM. Since the requirements of Android are a kind of secret, it is hard to guess, but ICS might be unsuccessful here, I think.
Anyway, the easiest and quite useful case may be a launching 2.1 Eclair because it is closest to stock. Next I am voting for CM7 (Gingerbread) :)
More contemporary Android versions might have bad performance for this case, I'm not sure 256MB RAM is enough.

ADD: some remarks to the new wiki page:
1) CROSS_COMPILE must be a arm-linux-androideabi-, not an arm-eabi- for that google toolchain, isn't it?
2) I was asked for some config options about MMC cards and FAT filenames with that config. Has anybody the same experience?
 
Last edited:
  • Like
Reactions: mrWax

mali100

Senior Member
Jun 3, 2007
209
140
BN released a new kernel source. http://images.barnesandnoble.com/PResources/download/Nook/source-code/nook2_1-1-5.tgz

The main difference seems to be the support for the backlight, but there are also some changes in the usb and touchscreen drivers.

I compiled the kernel without changes http://code.google.com/p/nst-recovery/downloads/detail?name=uImage_1_1_5_stock.zip and one with multitouchsupport http://code.google.com/p/nst-recovery/downloads/detail?name=uImage1_1_5_multitouch

Had no time to try to integrate usb-host. Source can be found at https://github.com/mali1/NST-kernel_115
 
  • Like
Reactions: mrWax

corge

Member
Apr 15, 2012
25
7
1.1.5 doesn't build for me with omap3621_gossamer_defconfig. Can it be a pre-release version (sw update and TOS pages at B&N still contain 1.1.2)?

omap3621_gossamer_evt1c_defconfig builds fine.

Also, after configuration like `make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- omap3621_gossamer_evt1c_defconfig` additional questions don't appear.


ADD: no success with booting custom kernel. Nook still works fine even with "while (true) {ssleep(1);}" in rest_init() in init/main.c.

Has anyone any ideas? Shall uImage be written by cp, not by dd, for example?


ADD2: it may be related to SD card formatting, I'll check it.
Besides that, could anyone please tell what is a correct load address and entry point for uImage?
 
Last edited:
  • Like
Reactions: mrWax

corge

Member
Apr 15, 2012
25
7
I still can't get a success with boot from SD.

Could anyone please show the following output for working card and confirm that valid load address and entry point is 0x80008000?

/dev/sdb should be replaced to your device (no trailing number):

Code:
# parted /dev/sdb print
Model: SanDisk uSD SDDR-289 (scsi)
Disk /dev/sdb: 1948MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      66.0kB  1948MB  1948MB  primary  fat32        boot, lba
 
  • Like
Reactions: mrWax

klausef

Senior Member
Jul 17, 2011
57
31
Raleigh
Wassup corge,

Yeah, 0x80008000 is where you should make the uImage load and execute. When you put in the SD card, does it bootloop, or does it just continue to the internal uImage?

It sounds like it's just going to the internal storage and ignoring the SD card's kernel outright. If that is the case, I am guessing it is a problem with uBoot. Try recompiling it from the B&N source (using the omap_gossamer config IIRC), then stick the produced files in the SD card's boot partition. If you don't want to do that you could try taking all of the files ending in .bin from mali100's Nooter image and putting them in the boot partition.

Also, do you have a Nook Touch Old or a Nook Touch GlowWorm?
 
Last edited:
  • Like
Reactions: mrWax and corge

corge

Member
Apr 15, 2012
25
7
Yeah, 0x80008000 is where you should make the uImage load and execute. When you put in the SD card, does it bootloop, or does it just continue to the internal uImage?

It sounds like it's just going to the internal storage and ignoring the SD card's kernel outright.
Thanks!
You are right, I think—seems like it just ignores SD card and boots from internal uImage.
However it should be noticed that I have unrooted NST (old, without glow), so I've added an infinite loops to rest_init() in init/main.c and sys_open() in fs/open.c just to detect what kernel is loaded. I may be wrong here with detection method ;)

I've tried 1.1.2 sources with both arm-eabi-4.4.3 and arm-linux-androideabi-4.4.x toolchains from here: https://android.googlesource.com/platform/prebuilt

If that is the case, I am guessing it is a problem with uBoot. Try recompiling it from the B&N source (using the omap_gossamer config IIRC), then stick the produced files in the SD card's boot partition. If you don't want to do that you could try taking all of the files ending in .bin from mali100's Nooter image and putting them in the boot partition.
Hm, I didn't suspect that there is a possibility to boot from SD not just kernel but uboot too. Will it leave the internal uboot untouched? If so, I'll try it.

Finally, the partitioning at my SD card may be wrong (partition offset, flags, maybe something else), so I'd like to verify that too with somebody's listing.

ADD: it may be some watchdog there which reboots to internal uImage..

ADD2: no, it doesn't seems like device is rebooted by itself. I've changed also USB product and manufacturer names in board-3621_gossamer.c, but these changes are not shown while connecting Nook to PC.
 
Last edited:

corge

Member
Apr 15, 2012
25
7
Thanks! It is useful too, but I've asked for SD card partitioning, not internal storage ;)
Just a same thing, but for card which is successfully booting with custom uImage on it.
 

mali100

Senior Member
Jun 3, 2007
209
140
Thanks! It is useful too, but I've asked for SD card partitioning, not internal storage ;)
Just a same thing, but for card which is successfully booting with custom uImage on it.

It's the same, because we just write a identical image from the internal storage to the SD-Card.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    So i have downloaded the nook touch kernel source and have gotten it to build using the gossamer defconfig. (as described somewhere by jesusfreke)

    then as a test i enabled ext4 support and recompiled
    then converted my system partition to ext4 while booted into noogie on the sdcard.
    i also edited the init.rc to mount /system as ext4 and enable adb over usb support
    and it seems like it works as shown in the code below.

    Code:
    drew@master: nook_touch$ adb shell cat /proc/version
    Linux version 2.6.29-omap1 (drew@master) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #3 PREEMPT Tue Oct 4 14:37:59 CDT 2011
    
    drew@master: nook_touch$ adb shell cat /proc/mounts
    rootfs / rootfs ro 0 0
    tmpfs /dev tmpfs rw,mode=755 0 0
    devpts /dev/pts devpts rw,mode=600 0 0
    proc /proc proc rw 0 0
    sysfs /sys sysfs rw 0 0
    tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
    /dev/block/mmcblk0p2 /rom vfat rw,sync,noatime,nodiratime,uid=1000,gid=1000,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,errors=remount-ro 0 0
    /dev/block/mmcblk0p5 /system ext4 ro,barrier=1,data=writeback 0 0
    /dev/block/mmcblk0p8 /data ext3 rw,nosuid,nodev,noatime,nodiratime,errors=continue,data=ordered 0 0
    /dev/block/mmcblk0p7 /cache ext3 rw,nosuid,nodev,noatime,nodiratime,errors=continue,data=ordered 0 0

    so where do i go from here? how do i start forward porting the kernel to .32 or .35 or do i even need to do that? in general what needs to change to get a cyanogenmod compatible kernel?

    also how can we get a serial or UART output from the nook touch. I have been testing some cm builds from the nook color but it doesnt boot far enough for abd to give any output. ive looked at the back of the board but there doesnt seem to be any blatantly obvious serial port connections on it like the nook color has.

    ps. uImage and uRamdisk are attached for reference. i try them if you want. but backup yours first!
    3
    It seems I was unpacking the wrong files which were so hard to unpack I couldn't unpack them. I guess the uImage is a binary kernel not able to be unpacked? I tried lots of cpio/gunzip commands and scripts online to unpack u-boot files but they didn't work :(.
    Correct, the kernel is a compiled binary and not packed, so no way to unpack it.
    If you want to unpack the uRamdisk, you can use the attached scripts.

    I have a question now though: In order to get the uRamdisk, I need to build an android system. The thing is... B&N didn't give sources for an android version, it seems. They only gave sources for a kernel, which is okay but it isn't enough (I think??) to build an android filesystem from the ground zero, right?

    I'm wondering, if I want to build Eclair (for example, which is the current working version in the NST), which config should I use? I've seen I could use something like "encore" or "zoom2" (as the same build.prop in the NST states, "zoom2") to build /system and mix it with B&N's kernel? or am I wrong?
    I also think hhe sourcecode released by BN isn't enough to build android, and there is no configuration that you could use, so you have to start from scratch.
    I think it would be a lot easier to take CM7, checkout the branch for the Nook Color (encore) and customize it to run with the NST.
    my objective is to build, aside from a kernel, a pure android ROM too.Hm, but that would still run /system from the nook. My idea was to make a SD that would boot -and- use the files from itself instead of touching the NST's files. That way, I could happily work on a custom android version without having to mess with my NST's filesystem and risk messing it up and having to restore it again with dd.
    It should be possible, but I never tried it:
    -partition and format the sd in a similiar way like the nook,
    -unpack the uRamdisk and edit the mountpoints in the init.rc from mmcblk0 to mmcblk1

    Again, I'm not sure if it works, thats what I read somewhere. And even if it works, it will be slow if you don't use a really fast sd-card.
    3
    Here's what I managed to find out about kernel source so far :

    Ros87 was right about SGX source code - it seems to be missing. Without it there's not much you can display bar the bootup logo. I wasn't able to recompile the official TI one the way it works with provided sources. Anybody have any results in this ?

    tiwlan_drv.ko WLAN module acts funny as well, seems to hang as soon as you disable kernel debug.

    I managed to change a lot in kernel config, and I noticed that are two sections that you can't just touch without breaking either WLAN of SGX modules :
    - Kernel profiling must remain on in order for tiwlan_drv.ko module to be able to work. Otherwise it wouldn't turn off.
    - without recompiling sgx modules, you need to leave preemt debug, mutex debug and soft locks detection on, otherwise SGX PVR modules are failing to initialize, and the whole lot stays at the boot screen forever

    Positive side effect of all of this is that now I've quite rich kernel with :
    - CFQ iosched
    - reiserfs/ext4/ntfs enabled
    - DroidWall support (iptables match target)
    - Group process scheduling
    - UTF8 enabled (can't switch to it entirely cause B&N stuff uses non utf all around the place)
    - half of kernel debugging off
    - PM debug off
    - fastfpe works quite fine
    - ondemand cpu governor

    If anybody was interested in config or binaries then give me a shout please. I really need somebody to give me a hand with SGX and WLAN sources in order to push it forward.
    2
    A lot of information about the sgx kernel-modules can be found on http://omapedia.org/wiki/Graphics

    Omappedia is a really great source for us. There is also a git repo for the dsp-bridge.

    Well, yes I've already tracked down the SGX SDK for Omap35x and I know the km sources are in there, just hoping they will work on the 36x aswell :)

    I guess I'll find out a little later today, setting up the build environment to use the kernel sources from B&N is a bit of a pita...
    2
    thx and where to read

    Hi!
    I really appreciate you excitement into this thread. I had atleast send some thx here for now.
    I'll try to find some good source of knowleadge to read on this (dont know where yet) to educate mysefl.