Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google-blueline: init #361

wants to merge 55 commits into from


Copy link

@samueldr samueldr commented Jun 4, 2021

Early WIP, basically first hour of work, not finished cleaning-up the history yet, but I don't want to flatten the config commits. To show how I ended up making it work.

Current status is:

  • Target Disk Mode (with appropriate changes not shared here) works.
  • Boots to stage-2, but lacking display with the demo image (obviously, no fb0)

It is likely that the device needs to have had an upgrade to Android 11 before this works. Just in case, download the factory image and reset to a clean Android 11 from Google.

This will not relock the bootloader.

Tested against Nixpkgs 6933d068c5d2fcff398e802f7c4e271bbdab6705

Will obsolete #191. Also ran: #44.

cc @colemickens @craigem


  • Rebase on master (has changes with dtbo.img)
  • Finish thinking about mainline/vendor split.
  • Look for the missing firmware bits for mainline

Current state

Not sure there's really anything to do, the vendor port is about as good as other devices of the same vintage... and really mainline is a further improvement type of thing.

And I'm happy with the provenance option to allow multiple kernel sources to be defined.


  • Touch screen driver patch set "forward" port from vendor driver, from Vinod, (temporarily) bricks the touch panel. Recover from this by building a vendor-flavoured image with the firmware files; the driver will flash the firmware again.
  • There's weirdness on mainline I have to look into... Looks like my last trip to stock android and back did something that now means there's huge delays on what was previously working quickly :/. The only big change I can see is going from rq2a to rq3a bootloaders and partitions on the device.

Doing the userspace stuff listed here is likely the only thing left for WLAN, and maybe even other things like cellular radio and GPS to work.

@samueldr samueldr added the 4. type: port New device port label Jun 4, 2021
@samueldr samueldr marked this pull request as draft June 4, 2021 06:51
@samueldr samueldr force-pushed the device/google-blueline/init branch 2 times, most recently from 0bc15fc to 972165d Compare June 21, 2021 04:08
Copy link
Member Author

I want all the FIXME I added to be taken care of before merging this.

Mainly they're generic helpful changes for a vendor/mainline split device.

I have thought about it... and I think the best way forward is to add a "provenance" option that allows a device to define multiple "provenances" for the sources. I'm open for other suggestions for wording.

It could also have some values for a totally-vendor-based workflow. E.g. there's the official vendor sources, which have some compatibility issues, and an alternative community effort that has better compatibility.

# FIXME: apply patchsets directly on top of mainline
src = fetchFromGitHub {
# Mirror of
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why mirror? To use fetchFromGitHub rather than a lengthy clone.

And anyway the goal is to just use the mainline kernel and add patches... So this will not stay... Though maybe the patch will come from that mirror as a span of commits.


# FIXME: generic mainline build; append per-device...
Copy link
Member Author

@samueldr samueldr Jun 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably want to look at asus-dumo and pine64-pinephone (and pinetab by extension) at the same time. To figure out a good pattern for a generic mainline builder?

@samueldr samueldr mentioned this pull request Jun 30, 2021
@samueldr samueldr force-pushed the device/google-blueline/init branch 6 times, most recently from b600134 to 71d6a65 Compare July 2, 2021 01:40
Copy link
Member Author

samueldr commented Jul 2, 2021

(edited the main body with the current status...)

@samueldr samueldr marked this pull request as ready for review July 2, 2021 01:54
@samueldr samueldr mentioned this pull request Aug 31, 2021
Copy link

Finally circling back to this. Getting errors building with mainline selected:

linux> Compile the kernel with frame pointers (FRAME_POINTER) [Y/?] y
linux> Generate file when linking (VMLINUX_MAP) [N/y/?] n
linux> Force weak per-cpu definitions (DEBUG_FORCE_WEAK_PER_CPU) [N/y/?] n
linux> #
linux> # configuration written to .config
linux> #
linux> make[1]: Leaving directory '/build/linux-5.13/build'
linux> removed '/build/linux-5.13/build/.tmp.config.old'
linux> removed '/build/linux-5.13/build/.tmp.config'
linux> :: Validating required and suggested kernel config options
linux> :: Validating kernel configuration
linux> ERROR: CONFIG_FHANDLE not set to «CONFIG_FHANDLE=y»... set to: «# CONFIG_FHANDLE is not set».
linux> ERROR: CONFIG_PID_NS not set to «CONFIG_PID_NS=y»... set to: «# CONFIG_PID_NS is not set».
linux> ERROR: CONFIG_UEVENT_HELPER_PATH is expected to be set to «CONFIG_UEVENT_HELPER_PATH=», but is not present in config file.
linux> ERROR: CONFIG_USER_NS not set to «CONFIG_USER_NS=y»... set to: «# CONFIG_USER_NS is not set».
linux> Finished validating...
linux>    Errors: 5
linux>    Warnings: 1
linux> => Kernel configuration validation failed...
linux> ... aborting.
builder for '/nix/store/li7jcj9bh025pqgvrmhbdjx9r2hjdrmf-linux-5.13.0.drv' failed with exit code 1; last 10 log lines:
  ERROR: CONFIG_PID_NS not set to «CONFIG_PID_NS=y»... set to: «# CONFIG_PID_NS is not set».
  ERROR: CONFIG_UEVENT_HELPER_PATH is expected to be set to «CONFIG_UEVENT_HELPER_PATH=», but is not present in config file.
  ERROR: CONFIG_USER_NS not set to «CONFIG_USER_NS=y»... set to: «# CONFIG_USER_NS is not set».
  Finished validating...
     Errors: 5
     Warnings: 1
  => Kernel configuration validation failed...
  ... aborting.

Copy link
Member Author

Oops, didn't comment on this port:


We just had some major~ish changes, at least one affecting new ports. I would heavily suggest rebasing on top of the latest master update.

The main change affecting ports is that we now have required kernel configuration options, which set known good values to a lot of "difficult to guess" options. A simple bin/kernel-normalize-config should be all that is needed.

Hope this helps!

In theory you just need to normalize. IIRC normalizing automatically handles setting the right values for that new correctness harness.

Copy link

colemickens commented Oct 8, 2021

❯ ./bin/kernel-normalize-config google-blueline
Could not find kernel configuration file for google-blueline.
Usage: bin/kernel-normalize-config <device_name>

This is after I even copied the kernel-mainline/config.aarch64 file up a directory into the google-blueline dir. I tried reading the ruby briefly but...

Copy link

so this script reaches into the device dir for the config, but goes back up and out through the entire default/release mechanisms just to get to the config via nix?

Copy link

I hacked something together for the normalize script to support variants: colemickens@5405095

:: Validating kernel configuration

ERROR: CONFIG_UEVENT_HELPER_PATH is expected to be set to «CONFIG_UEVENT_HELPER_PATH=», but is not present in config file.

Finished validating...
   Errors: 1
   Warnings: 0

=> Kernel configuration validation failed...

is where I'm at now.

samueldr and others added 4 commits October 8, 2021 15:03
This scheme has to be implemented by any device implementation that
wants to use the scheme.

`grep` for `provenance` under the devices folder to get an idea as to
how this can be used.
Co-authored-by: Cole Mickens <>
Copy link
Member Author

samueldr commented Oct 8, 2021

@colemickens updated the normalization script to:

  • work with variants
  • work without variants

It ended up sharing less than I'd hoped with your initial try.

This was verified to boot the mainline-based boot.img with the pinne Nixpkgs.

Forgot I had temporarily committed changes not to include... Undoing!

Next step: update to latest release!


This comment has been minimized.


This comment has been minimized.

Copy link
Member Author

Updated to 5.15-rc4... but lost fbcon console.

Having fbdev emulation enabled completely broke the display.

Though it's not like everything's all peachy. It might be that the moment the DRM display is closed, or once it's tried to be opened back after having been closed, the kernel unceremoniously crashes with a null pointer dereference.

[   71.373241] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   71.382121] Mem abort info:                                                                                                                 
[   71.384954]   ESR = 0x96000005                                                                                                              
[   71.388032]   EC = 0x25: DABT (current EL), IL = 32 bits
[   71.393393]   SET = 0, FnV = 0                                                                                                              
[   71.396481]   EA = 0, S1PTW = 0                                     
[   71.399652]   FSC = 0x05: level 1 translation fault
[   71.404573] Data abort info:                                                                                                                
[   71.407478]   ISV = 0, ISS = 0x00000005                                                                                                     
[   71.407481]   CM = 0, WnR = 0                                       
[   71.407484] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000109a69000                        
[   71.407490] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000                                             
[   71.407505] Internal error: Oops: 96000005 [#1] PREEMPT SMP         
[   71.407514] CPU: 4 PID: 314 Comm: loader Tainted: G        W         5.15.0-rc4 #1-mobile-nixos                                             
[   71.407523] Hardware name: Google Pixel 3 (DT)                                                                                              
[   71.407527] pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)    
[   71.407534] pc : msm_submitqueue_close+0x28/0x108 
[   71.407549] lr : msm_postclose+0x48/0xd8                                                                                                    
[   71.407557] sp : ffffffc0105d3af0                               
[   71.407560] x29: ffffffc0105d3af0 x28: 0000007fafe6f12c x27: ffffff8080fd10e8                                                               
[   71.407570] x26: 0000007fafe6f128 x25: ffffff8080fd10f8 x24: 0000000000000000                                                               
[   71.407580] x23: ffffff808874b960 x22: ffffff8089b57008 x21: ffffff8088753000                
[   71.407589] x20: ffffff808874b878 x19: 0000000000000000 x18: 000000000000c000  
[   71.407598] x17: 000000040044ffff x16: 004000b4b5593519 x15: 0000000000000040           
[   71.407607] x14: ffffff8080cfeb70 x13: 0000000000000228 x12: 0000000000000000                                                               
[   71.407616] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000   
[   71.407624] x8 : 0000000000000000 x7 : ffffffe0519c8768 x6 : 0000000000000001                                                               
[   71.407633] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffffff808b51aac0                                                               
[   71.407641] x2 : 0000000000000000 x1 : ffffff808b51aac0 x0 : 0000000000000000                                                               
[   71.407651] Call trace:                                             
[   71.407654]  msm_submitqueue_close+0x28/0x108                                                                                               
[   71.407661]  msm_postclose+0x48/0xd8                            
[   71.407668]  drm_file_free.part.0+0x194/0x250                                                                                               
[   71.554335]  drm_close_helper.isra.0+0x6c/0x80                                                                                              
[   71.554342]  drm_release+0x68/0x108                                                                                                         
[   71.554349]  __fput+0x70/0x208                                      
[   71.554359]  ____fput+0x10/0x20                                     
[   71.554366]  task_work_run+0x80/0xb8            
[   71.554375]  do_exit+0x374/0xb28                                                                                                            
[   71.554382]  do_group_exit+0x44/0xa0                                
[   71.554388]  get_signal+0x18c/0x8a8                        
[   71.554396]  do_notify_resume+0x14c/0x6e8         
[   71.554406]  el0_svc+0x4c/0x60                                      
[   71.554414]  el0t_64_sync_handler+0xb0/0xb8                                                                                                 
[   71.554420]  el0t_64_sync+0x1a4/0x1a8
[   71.554430] Code: a90153f3 f8408ed3 aa1303e0 eb16027f (f85e8674)                                                                            
[   71.554436] ---[ end trace 87ef9f7de2152552 ]---
[   71.554441] Kernel panic - not syncing: Oops: Fatal exception       
[   71.554444] SMP: stopping secondary CPUs                           
[   71.554773] Kernel Offset: 0x203f480000 from 0xffffffc010000000     
[   71.554777] PHYS_OFFSET: 0x80000000                                 
[   71.554779] CPU features: 0x00000211,23100e42      
[   71.554784] Memory Limit: none                                      

@samueldr samueldr mentioned this pull request Sep 14, 2022
8 tasks
Copy link
Member Author

Dead-end; see #511.

@samueldr samueldr closed this Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants