Skip to contentSkip to conversation

Add ARM chromebook support to buildroot

PATCH New Lahoudere Fabien 2 participants 2 messages Mar 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ARM chromebook support to buildroot

From: Lahoudere Fabien <[email protected]>

I build a custom image for my cortex-a15 based laptop using buildroot.
I don't know if it is usefull but if it can helps (for arndale for example) it's free.

---
 board/samsung/chromebook-xe303c/bootscript.txt     |    8 +
 board/samsung/chromebook-xe303c/create-boot-sd.sh  |   92 +
 board/samsung/chromebook-xe303c/env.txt            |   50 +
 .../chromebook-xe303c/linux-3.8.11-defconfig       | 3551 ++++++++++++++++++++
 ...not-create-AP-and-P2P-interfaces-upon-dri.patch |   74 +
 board/samsung/chromebook-xe303c/readme.txt         |   75 +
 configs/chromebook_defconfig                       |   34 +
 7 files changed, 3884 insertions(+)
 create mode 100644 board/samsung/chromebook-xe303c/bootscript.txt
 create mode 100644 board/samsung/chromebook-xe303c/create-boot-sd.sh
 create mode 100644 board/samsung/chromebook-xe303c/env.txt
 create mode 100644 board/samsung/chromebook-xe303c/linux-3.8.11-defconfig
 create mode 100644 board/samsung/chromebook-xe303c/patches/0001-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch
 create mode 100644 board/samsung/chromebook-xe303c/readme.txt
 create mode 100644 configs/chromebook_defconfig
board/samsung/chromebook-xe303c/bootscript.txt new file +8 -0
new file mode 100644
index 0000000..4167884
@@ -0,0 +1,8 @@
+#setenv bootpart 2
+#setenv rootpart 3
+#setenv regen_ext2_bootargs 'setenv bootdev_bootargs root=/dev/${devname}${rootpart} rootwait rw; run regen_all'
+#setenv ext2_boot 'run regen_ext2_bootargs; ext2load ${devtype} ${devnum}:${bootpart} ${loadaddr} ${cros_bootfile}; echo ${bootargs}'
+#setenv ext2_boot 'run regen_ext2_bootargs; ext2load ${devtype} ${devnum}:${bootpart} ${loadaddr} ${cros_bootfile}; bootm ${loadaddr}'
+#setenv cros_bootfile /vmlinux.uimg
+#setenv extra_bootargs console=tty1
+setenv mmc0_boot 'echo ERROR: Could not boot from USB or SD'
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +92 -0

92 lines not on this page · raw message

board/samsung/chromebook-xe303c/env.txt new file +50 -0

50 lines not on this page · raw message

board/samsung/chromebook-xe303c/linux-3.8.11-defconfig new file +3551 -0

2,850 lines not on this page · raw message

board/samsung/chromebook-xe303c/patches/0001-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch new file +74 -0

74 lines not on this page · raw message

board/samsung/chromebook-xe303c/readme.txt new file +75 -0

75 lines not on this page · raw message

configs/chromebook_defconfig new file +34 -0
new file mode 100644
index 0000000..4a5c21f

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.1.4

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 1/1 Add ARM chromebook support to buildroot

Dear Lahoudere Fabien,

Quoted 4 lines · Lahoudere Fabien

From: Lahoudere Fabien <[email protected]>

I build a custom image for my cortex-a15 based laptop using buildroot.
I don't know if it is usefull but if it can helps (for arndale for example) it's free.

Don't include "personal" messages in the commit log. The commit log stays around forever. If you want to put personal messages, put them....

Quoted 3 lines

---

... here, i.e below the "---" sign.

See some more comments below.

Quoted 22 lines
 board/samsung/chromebook-xe303c/bootscript.txt     |    8 +
 board/samsung/chromebook-xe303c/create-boot-sd.sh  |   92 +
 board/samsung/chromebook-xe303c/env.txt            |   50 +
 .../chromebook-xe303c/linux-3.8.11-defconfig       | 3551 ++++++++++++++++++++
 ...not-create-AP-and-P2P-interfaces-upon-dri.patch |   74 +
 board/samsung/chromebook-xe303c/readme.txt         |   75 +
 configs/chromebook_defconfig                       |   34 +
 7 files changed, 3884 insertions(+)
 create mode 100644 board/samsung/chromebook-xe303c/bootscript.txt
 create mode 100644 board/samsung/chromebook-xe303c/create-boot-sd.sh
 create mode 100644 board/samsung/chromebook-xe303c/env.txt
 create mode 100644 board/samsung/chromebook-xe303c/linux-3.8.11-defconfig
 create mode 100644 board/samsung/chromebook-xe303c/patches/0001-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch
 create mode 100644 board/samsung/chromebook-xe303c/readme.txt
 create mode 100644 configs/chromebook_defconfig
board/samsung/chromebook-xe303c/bootscript.txt new file +0 -0
new file mode 100644
index 0000000..4167884

board/samsung/chromebook-xe303c/bootscript.txt line 8

Quoted 8 lines
board/samsung/chromebook-xe303c/bootscript.txt new file +8 -0
@@ -0,0 +1,8 @@
+#setenv bootpart 2
+#setenv rootpart 3
+#setenv regen_ext2_bootargs 'setenv bootdev_bootargs root=/dev/${devname}${rootpart} rootwait rw; run regen_all'
+#setenv ext2_boot 'run regen_ext2_bootargs; ext2load ${devtype} ${devnum}:${bootpart} ${loadaddr} ${cros_bootfile}; echo ${bootargs}'
+#setenv ext2_boot 'run regen_ext2_bootargs; ext2load ${devtype} ${devnum}:${bootpart} ${loadaddr} ${cros_bootfile}; bootm ${loadaddr}'
+#setenv cros_bootfile /vmlinux.uimg
+#setenv extra_bootargs console=tty1
+setenv mmc0_boot 'echo ERROR: Could not boot from USB or SD'

So everything is commented out except a line echoing some text? This doesn't seem to be very useful.

Quoted 22 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +16 -0
new file mode 100644
index 0000000..1606577
@@ -0,0 +1,92 @@
+!/bin/sh
+
+set -u
+set -e
+
+PROGNAME=$(basename $0)
+
+usage()
+{
+    echo "Create an SD card that boots on chromebook board."
+    echo
+    echo "Note: all data on the the card will be completely deleted!"
+    echo "Use with care!"
+    echo "Superuser permissions may be required to write to the device."
+    echo
+    echo "Usage: ${PROGNAME} <sd_block_device>"

board/samsung/chromebook-xe303c/create-boot-sd.sh line 26

Quoted 10 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +10 -0
+    echo "Arguments:"
+    echo "  <sd_block_device>     The device to be written to"
+    echo
+    echo "Example: ${PROGNAME} /dev/mmcblk0"
+    echo
+}
+
+if [ $# -eq 0 ]
+then
+read -p "Please enter device name : /dev/" DEVICE

Do we do this for other scripts? Reading things on the standard input is quite weird. I think the script argument should be mandatory, and that's it.

Quoted 18 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +18 -0
+echo
+else
+DEVICE=$1
+fi
+
+echo "You are going to install the system on device /dev/${DEVICE}\n"
+
+echo -n "Check if /dev/${DEVICE} is really a block device ... "
+if [ ! -b /dev/${DEVICE} ] 
+then echo "KO\n"
+exit 1
+else
+echo "OK\n"
+fi
+
+# Unmount device if mounted
+umount /dev/${DEVICE}*
+

board/samsung/chromebook-xe303c/create-boot-sd.sh line 54

Quoted 10 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +10 -0
+# create cgpt partition table
+parted /dev/${DEVICE} mklabel gpt
+
+cgpt create -z /dev/${DEVICE}
+cgpt create /dev/${DEVICE}
+cgpt add -i 1 -t kernel -b 8192 -s 32768 -l U-Boot -S 1 -T 5 -P 10 /dev/${DEVICE}
+cgpt add -i 2 -t data -b 40960 -s 32768 -l Kernel /dev/${DEVICE}
+cgpt add -i 12 -t data -b 73728 -s 32768 -l Script /dev/${DEVICE}
+RSZ=`cgpt show /dev/sde | grep "GPT table" | awk '{printf $1}'`
+cgpt add -i 3 -t data -b 106496 -s `expr ${RSZ} - 106496` -l Root /dev/${DEVICE}

Where is this cgpt tool coming from? Is it built by Buildroot ?

board/samsung/chromebook-xe303c/create-boot-sd.sh line 80

Quoted 4 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +4 -0
+# Create boot script
+mount /dev/${DEVICE}12 ${TMPDIR}
+cp board/samsung/chromebook-xe303c/bootscript.txt board/samsung/chromebook-xe303c/env.txt ${TMPDIR}
+mkimage -A arm -C none -T script -d 

There seems to be an issue here.

board/samsung/chromebook-xe303c/create-boot-sd.sh line 84

Quoted 4 lines
board/samsung/chromebook-xe303c/create-boot-sd.sh new file +4 -0
+umount ${TMPDIR}
+
+# Download booltoader nv-uboot for chromebook
+wget -O - http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/nv_uboot-snow.kpart.bz2 | bunzip2 > ${TMPDIR}/nv_uboot-snow.kpart

No, such scripts should not download stuff. Instead, please create a package that downloads this binary, and installs it uncompressed in $(BINARIES_DIR).

board/samsung/chromebook-xe303c/linux-3.8.11-defconfig

Quoted 5 lines
board/samsung/chromebook-xe303c/linux-3.8.11-defconfig new file +0 -0
new file mode 100644
index 0000000..cf6c164

Please use 'make linux-savedefconfig' to reduce the size of this defconfig.

Quoted 6 lines
board/samsung/chromebook-xe303c/readme.txt new file +0 -0
new file mode 100644
index 0000000..2cb0845

board/samsung/chromebook-xe303c/readme.txt line 10

Quoted 10 lines
board/samsung/chromebook-xe303c/readme.txt new file +10 -0
@@ -0,0 +1,75 @@
+*******************************************************
+Samsung Chromebook based on Exynos 5520 (Cortex a15)
+*******************************************************
+
+Build
+=====
+
+First, configure Buildroot for your chromebook.
+
+  make chromebook_defconfig

I think there are many chromebooks around. Maybe the defconfig name should use a more specific name.

Quoted 46 lines
board/samsung/chromebook-xe303c/readme.txt new file +46 -0
+
+Build all components:
+
+  make
+
+You will find in ./output/images/ the following files:
+  - imx6dl-sabresd.dtb or imx6q-sabresd.dtb
+  - rootfs.ext2
+  - rootfs.tar
+  - u-boot.imx
+  - uImage
+
+Create a bootable SD card
+=========================
+
+To determine the device associated to the SD card have a look in the
+/proc/partitions file:
+
+  cat /proc/partitions
+
+Run the following script as root on your SD card. This will partition the card
+and copy the bootloader, kernel, DTBs and root filesystem as needed.
+
+*** WARNING! The script will destroy all the card content. Use with care! ***
+  ./board/samsung/chromebook-xe303c/create-boot-sd.sh <your-sd-device>
+
+Boot the laptop on sdcard 
+=========================
+
+* Switch to developer mode
+
+    Turn off the laptop.
+    To invoke Recovery mode, you hold down the ESC and Refresh keys and poke the Power button.
+    At the Recovery screen press Ctrl-D (there's no prompt - you have to know to do it).
+    Confirm switching to developer mode by pressing enter, and the laptop will reboot and reset the system. This takes about 15-20 minutes. 
+
+Note: After enabling developer mode, you will need to press Ctrl-D each time you boot, or wait 30 seconds to continue booting.
+
+* Enable USB booting
+
+    After booting into developer mode, hold Ctrl and Alt and poke the T key. This will open up the crosh shell.
+    Type shell to get into a bash shell.
+    Type sudo su to become root.
+    Then type this to enable USB booting:
+    	 crossystem dev_boot_usb=1 dev_boot_signed_only=0
+    Reboot the system to allow the change to take effect.

board/samsung/chromebook-xe303c/readme.txt line 66

Quoted 10 lines
board/samsung/chromebook-xe303c/readme.txt new file +10 -0
+    Hold Ctrl and U to boot on usb or sd
+
+* Configure nv-uboot
+    mmc dev 1
+    mmc rescan
+    ext2load mmc 1:c ${loadaddr} /env.txt
+    env import -t ${loadaddr} ${filesize}
+    saveenv
+
+Now the laptop will reboot on your sd card system every time you hold Ctrl and U

This is great, good to have basic instructions to get started.

Quoted 30 lines
configs/chromebook_defconfig new file +24 -0
new file mode 100644
index 0000000..4a5c21f
@@ -0,0 +1,34 @@
+# architecture
+BR2_arm=y
+BR2_cortex_a15=y
+
+# system
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+
+# Kernel Header Options
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.8.11"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_8=y
+BR2_DEFAULT_KERNEL_HEADERS="3.8.11"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://chromium.googlesource.com/chromiumos/third_party/kernel"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="chromeos-3.8"
+BR2_LINUX_KERNEL_VERSION="chromeos-3.8"
+BR2_LINUX_KERNEL_PATCH="board/samsung/chromebook-xe303c/patches/"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/samsung/chromebook-xe303c/linux-3.8.11-defconfig"
+BR2_LINUX_KERNEL_UBOOT_IMAGE=y

configs/chromebook_defconfig line 34

Quoted 10 lines
configs/chromebook_defconfig new file +10 -0
+BR2_LINUX_KERNEL_UIMAGE=y
+BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x40008000"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5250-snow-rev4"
+
+# Filesystem images
+BR2_TARGET_ROOTFS_TAR=y
+BR2_TARGET_ROOTFS_TAR_NONE=y
+BR2_TARGET_ROOTFS_TAR_OPTIONS=""

Those last two options look weird. Are they really present when you run "make savedefconfig" ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com