Zombah chromebook sandbox

Материал из Toshiba AC100 wiki
Версия от 00:58, 21 августа 2017; Zombah (обсуждение | вклад) (add u-boot compile script)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)
Перейти к навигации Перейти к поиску

snow install nv-u-boot 3704 with serial console debug to ro&rw firmware

Backup original firmware as it contain unique device data otherwise chromeos is lost forever for device

flashrom -p linux_spi:dev=/dev/spidev1.0 -r original_image.bin
  • Device hwid will be DAISY TEST A-A 9382 after firmware update, which is treated as dev board by google. Factory hwid something like SNOW KULA A-E 4640
    • Chromeos cant be installed or updated on device with this test hwid.
    • Crucial data lives in VPD (Virtual Private Data) and GBB (Google Binary Block) partitions.
wget https://www.dropbox.com/s/6pzvraf3ko14sz9/nv_image-snow.bin.gz
gunzip nv_image-snow.bin.gz
flashrom -p linux_spi:dev=/dev/spidev1.0 -w nv_image-snow.bin

found here https://wiki.archlinux.org/index.php/Samsung_Chromebook_(ARM)#How_to_flash_U-Boot

snow check/disable write protect status

crosh->shell->sudo -s

flashrom --wp-status
flashrom --wp-disable

snow/daisy revert firmware to factory default from chrome os

crosh->shell->sudo -s

crossystem |fgrep fwid
chromeos-firmwareupdate --factory

found here https://code.google.com/p/chromium/issues/detail?id=221828

use linux-stable exynos_defconfig kernel

make exynos_defconfig
make menuconfig

set mwifiex and mwifiex_sdio as modules

make modules_prepare
make -j4 2>1& | tee ../current.log
make kernelrelease

sudo make modules_install
sudo cp arch/arm/boot/zImage /boot/zImage-kernelrelease
sudo cp System.map /boot/System.map-kernelrelease
sudo cp .config /boot/config-kernelrelease
cd /boot
sudo mkinitrd -k zImage-kernelrelease -i initrd-kernelrelease

linux-stable multi_v7_defconfig missing modules for screen

ptn3460
pwm-samsung
platform_lcd
i2c-arb-gpio-challenge
cros_ec_devs

openSUSE notes

Remove armsoc driver, its very slow with current upstream kernels, use modesettings or fbdev

sudo zypper rm xf86-video-armsoc

firefox soft webgl

gfx.xrender.enabled=false
webgl.force-enable=true

now got 1fps in fishgl demo 8)


Add/update chainloding u-boot on sdcard

it requires vboot-utils which contain vbutil and cgpt

#!/bin/bash

diskname=/dev/sde
uboot=u-boot.img

mkimage -A arm -O linux -T kernel -C none -a 0x43e00000 -e 0x43e00000 -n uboot -d u-boot-dtb.bin u-boot.img

echo "console=tty1 debug verbose" > /tmp/config
vbutil_kernel --pack /tmp/newkern \
        --keyblock /usr/share/vboot/devkeys/kernel.keyblock \
        --version 1 \
        --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
        --config=/tmp/config --vmlinuz $uboot --arch arm
kpartx -av $diskname
dd if=/tmp/newkern of=$diskname\1
kpartx -d $diskname
cgpt add -t kernel -i 1 -S 1 -T 5 -P 10 -l U-BOOT $diskname

Snow motherboard info

Motherboard design probably own from Samsung as there is BA41-02110A ident on board, revision 1.1 and Model:Lucas

Manualy load kernel from u-boot

setenv bootargs 'loglevel=8 plymouth.enable=0 rootflags=size=100% console=ttySAC3,115200n8 console=tty earlyprintk showopts ${append}'
setenv initrd_high ''
setenv fdt_high ''
ext2load mmc 1:2 0x40007000 /boot/linux.vmx
ext2load mmc 1:2 0x44000000 /boot/initrd.uboot
ext2load mmc 1:2 0x42000000 /dtb/exynos5250-snow.dtb
bootz 0x40007000 0x44000000 0x42000000

Script to create chainloading kernel partition from openSUSE JeOS

#==========================================
# install Arndale SPL & U-Boot as raw
#------------------------------------------
if [[ -f "boot/smdk5250-spl.bin" || -f "boot/arndale-spl.bin" ]];then
    echo "Installing BL1..."
    if ! dd if=boot/arndale-bl1.img of=$diskname seek=1 conv=notrunc; then
        echo "Couldn't install BL1 on $diskname"
        exit 1
    fi
    echo "Installing SPL..."
    # Get SPL name (depends on U-Boot version)
    SPL_FILE=$(ls boot/*-spl.bin);
    if ! dd if=$SPL_FILE of=$diskname seek=17 conv=notrunc; then
        echo "Couldn't install SPL ($SPL_FILE) on $diskname"
        exit 1
    fi
    echo "Installing U-Boot..."
    if ! dd if=boot/u-boot.bin of=$diskname seek=49 conv=notrunc; then
        echo "Couldn't install u-boot on $diskname"
        exit 1
    fi
fi

#==========================================
# install Chromebook u-boot as boot kernel
# And do the required magic!
#------------------------------------------
if [ "$flavor" = "chromebook" ]; then
    if [ ! "$is_firstboot" ]; then
        pushd /usr/src/packages/KIWIROOT-oem/
        echo "console=tty1 debug verbose" > /tmp/config
        ./usr/bin/vbutil_kernel --pack /tmp/newkern \
            --keyblock ./usr/share/vboot/devkeys/kernel.keyblock \
            --version 1 \
            --signprivate ./usr/share/vboot/devkeys/kernel_data_key.vbprivk \
            --config=/tmp/config --vmlinuz boot/u-boot.img --arch arm
        LINE=$(kpartx -asv $diskname | head -n1)
        PART=$(echo "$LINE" | awk '{print $3}')
        dd if=/tmp/newkern of=/dev/mapper/$PART
        # "kpartx -dv $diskname" does not work if $diskname is longer than 64 characters
        LOOPDEV=$(echo "/dev/$PART" | sed 's/p[0-9][0-9]*$//')
        kpartx -dv $LOOPDEV
        losetup -d $LOOPDEV
    fi
    # For build and after reaprtition occured on 1st boot:
    # Enable bootflag on partition 2 (u-boot now looks for bootscripts on bootable partitions only)
    parted $diskname set 2 boot on
    # CGPT magic
    ./usr/bin/cgpt add -t kernel -i 1 -S 1 -T 5 -P 10 -l U-BOOT $diskname
    popd
fi

Script to compile U-Boot from openSUSE U-Boot spec

%build
export SOURCE_DATE_EPOCH=$(date -d "$(head -n 2 %{_sourcedir}/%{name}.changes | tail -n 1 | cut -d- -f1 )" +%s)
make %{?_smp_mflags} CROSS_COMPILE= HOSTCFLAGS="$RPM_OPT_FLAGS" snow_defconfig
echo "Attempting to enable fdt apply command (.dtbo) support."
echo "CONFIG_OF_LIBFDT_OVERLAY=y" >> .config
make %{?_smp_mflags} CROSS_COMPILE= HOSTCFLAGS="$RPM_OPT_FLAGS" USE_PRIVATE_LIBGG=yes

%if "%{name}" == "u-boot-snow" || "%{name}" == "u-boot-spring"
# Chromebook ARM (snow) and HP Chromebook 11 (spring) need a uImage format
export TEXT_START=$(awk '$NF == "_start" { printf "0x"$1 }' System.map)
./tools/mkimage -A arm -O linux -T kernel -C none -a $TEXT_START -e $TEXT_START -n uboot -d u-boot-dtb.bin u-boot.img
%endif