Full Code of commaai/eon-neos for AI

master 8f12ec711688 cached
5 files
5.6 KB
1.6k tokens
3 symbols
1 requests
Download .txt
Repository: commaai/eon-neos
Branch: master
Commit: 8f12ec711688
Files: 5
Total size: 5.6 KB

Directory structure:
gitextract_xc9gh4jz/

├── .gitignore
├── README.md
├── download.py
├── flash.ps1
└── flash.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.*.swp
files
META-INF
system.simg
ota-signed-*
recovery*
platform-tools-latest-windows.zip
platform-tools-latest-linux.zip
platform-tools-latest-darwin.zip
platform-tools/


================================================
FILE: README.md
================================================
NEOS
======

NEOS is the operating system for your [comma two](https://comma.ai/shop/products/comma-two-devkit) and [EON Gold Dashcam Development Kit](https://comma.ai/shop/products/eon-gold-dashcam-devkit).

Updates
------

When openpilot requires a NEOS update, you won't have to do anything. NEOS updates download in the background auotmatically, just like normal openpilot updates. This repo is for restoring or recovering your device.

Restoring on macOS & Linux
------

1. Connect your comma two (via a USB-C to USB-A cable) or EON Gold (via a USB-mini-B to USB-A cable) to your computer
2. Open a terminal
3. Clone this repo `git clone https://github.com/commaai/eon-neos.git`, then `cd eon-neos`
4. Run `./download.py`
5. Put your device into fastboot mode by turning off your device, then holding volume down + power.
6. Run `./flash.sh` DO NOT DISCONNECT THE DEVICE!

Restoring on Windows
------
1. Install the Google USB driver for ADB (Android Debug Bridge)... https://developer.android.com/studio/run/win-usb
2. Connect your comma two (via a USB-C to USB-A cable) or EON Gold (via a USB-mini-B to USB-A cable) to your computer
3. Download and extract this repository
4. Download & install Python 3
5. Run download.py to download NEOS and flashing tools
6. Put your device into fastboot mode by turning off your device, then holding volume down + power.
7. Run flash.ps1 (right click, run with powershell). DO NOT DISCONNECT THE DEVICE!


================================================
FILE: download.py
================================================
#!/usr/bin/env python
import os
import sys
import json
import hashlib
import argparse
import zipfile

try:
  # Python 3
  from urllib.request import urlopen, urlretrieve
except ImportError:
  # Python 2
  from urllib import urlopen, urlretrieve

MASTER_MANIFEST = "https://raw.githubusercontent.com/commaai/openpilot/commatwo_master/selfdrive/hardware/eon/neos.json"
RELEASE_MANIFEST = "https://raw.githubusercontent.com/commaai/openpilot/release2/selfdrive/hardware/eon/neos.json"

def download_progress(count, blockSize, totalSize):
    if count % 1000 == 0:
      sys.stdout.write('.')
      sys.stdout.flush()


def sha256_checksum(filename, block_size=65536):
  sha256 = hashlib.sha256()
  with open(filename, 'rb') as f:
    for block in iter(lambda: f.read(block_size), b''):
      sha256.update(block)
  return sha256.hexdigest()


def download(url, fhash, finalname):
  if os.path.isfile(finalname) and sha256_checksum(finalname).lower() == fhash.lower():
    print("already downloaded %s" % url)
    return

  print("downloading %s with hash %s" % (url, fhash))
  fn = url.split("/")[-1]
  urlretrieve(url, fn, download_progress)
  assert sha256_checksum(fn).lower() == fhash.lower()

  print("hash check pass")
  os.rename(fn, finalname)


if __name__ == "__main__":
  parser = argparse.ArgumentParser(description='Download NEOS')
  parser.add_argument('--master', action='store_true',
                      help='Download NEOS version used on the master branch')

  args = parser.parse_args()

  manifest = MASTER_MANIFEST if args.master else RELEASE_MANIFEST

  r = urlopen(manifest)

  up = json.loads(r.read().decode())
  download(up['recovery_url'], up['recovery_hash'], "recovery.img")
  download(up['ota_url'], up['ota_hash'], "ota-signed-latest.zip")

  with zipfile.ZipFile("ota-signed-latest.zip", 'r') as z:
    z.extractall()


================================================
FILE: flash.ps1
================================================

$fastboot = "platform-tools/fastboot.exe"
if (Test-Path -path $fastboot) {
    Write-Host 'Platform tools found';
} else {
    Write-Host 'Downloading platform tools';

    $client = new-object System.Net.WebClient
    $client.DownloadFile("https://dl.google.com/android/repository/platform-tools_r28.0.2-windows.zip", "platform-tools.zip")

    Write-Host 'Extracting platform tools';
    Expand-Archive -Path "platform-tools.zip" -DestinationPath "." -Force

    Remove-Item "platform-tools.zip"
}

if (Test-Path -path "files/system.img") {
    $zip_file = Get-Item "ota-signed-latest.zip"
    $system_img = Get-Item "files/system.img"

    if ($zip_file.CreationTime -gt $system_img.CreationTime){
        Write-Host 'Newer version found. Extracting...';
        Expand-Archive -Path "ota-signed-latest.zip" -DestinationPath "." -Force
    }

} else {
    Write-Host 'Extracting NEOS...';
    Expand-Archive -Path "ota-signed-latest.zip" -DestinationPath "." -Force
}


Invoke-Expression "$($fastboot) flash recovery recovery.img"
Invoke-Expression "$($fastboot) flash boot files/boot.img"
Invoke-Expression "$($fastboot) flash system files/system.img"

Invoke-Expression "$($fastboot) erase userdata"
Invoke-Expression "$($fastboot) format cache"
Invoke-Expression "$($fastboot) reboot"


Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');

================================================
FILE: flash.sh
================================================
#!/bin/bash -e

FASTBOOT=platform-tools/fastboot

VERSION="r28.0.2"
PLATFORM="$(uname -s | tr '[:upper:]' '[:lower:]')"

if [ ! -f $FASTBOOT ]; then
  rm -rf platform-tools
  rm -f platform-tools-latest-$PLATFORM.zip

  curl -L https://dl.google.com/android/repository/platform-tools_$VERSION-$PLATFORM.zip --output platform-tools.zip
  unzip platform-tools.zip
  rm -f platform-tools.zip
fi

echo "Please enter your computer password if prompted"

sudo $FASTBOOT oem 4F500301 || true
sudo $FASTBOOT flash recovery recovery.img

# from OTA
[ -f files/logo.bin ] && $FASTBOOT flash LOGO files/logo.bin
sudo $FASTBOOT flash boot files/boot.img
sudo $FASTBOOT flash system files/system.img

# clear userdata
sudo $FASTBOOT erase userdata
sudo $FASTBOOT format cache
sudo $FASTBOOT reboot
Download .txt
gitextract_xc9gh4jz/

├── .gitignore
├── README.md
├── download.py
├── flash.ps1
└── flash.sh
Download .txt
SYMBOL INDEX (3 symbols across 1 files)

FILE: download.py
  function download_progress (line 19) | def download_progress(count, blockSize, totalSize):
  function sha256_checksum (line 25) | def sha256_checksum(filename, block_size=65536):
  function download (line 33) | def download(url, fhash, finalname):
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (6K chars).
[
  {
    "path": ".gitignore",
    "chars": 172,
    "preview": ".*.swp\nfiles\nMETA-INF\nsystem.simg\nota-signed-*\nrecovery*\nplatform-tools-latest-windows.zip\nplatform-tools-latest-linux.z"
  },
  {
    "path": "README.md",
    "chars": 1449,
    "preview": "NEOS\n======\n\nNEOS is the operating system for your [comma two](https://comma.ai/shop/products/comma-two-devkit) and [EON"
  },
  {
    "path": "download.py",
    "chars": 1849,
    "preview": "#!/usr/bin/env python\nimport os\nimport sys\nimport json\nimport hashlib\nimport argparse\nimport zipfile\n\ntry:\n  # Python 3\n"
  },
  {
    "path": "flash.ps1",
    "chars": 1445,
    "preview": "\r\n$fastboot = \"platform-tools/fastboot.exe\"\r\nif (Test-Path -path $fastboot) {\r\n    Write-Host 'Platform tools found';\r\n}"
  },
  {
    "path": "flash.sh",
    "chars": 785,
    "preview": "#!/bin/bash -e\n\nFASTBOOT=platform-tools/fastboot\n\nVERSION=\"r28.0.2\"\nPLATFORM=\"$(uname -s | tr '[:upper:]' '[:lower:]')\"\n"
  }
]

About this extraction

This page contains the full source code of the commaai/eon-neos GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (5.6 KB), approximately 1.6k tokens, and a symbol index with 3 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!