From patchwork Fri Apr 15 15:56:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 611025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 3qmhxL232nz9sBc for ; Sat, 16 Apr 2016 01:56:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vanguardiasur-com-ar.20150623.gappssmtp.com header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.b=wH6wb6Ul; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6BFC791B97; Fri, 15 Apr 2016 15:56:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S4ka0sq1YCpG; Fri, 15 Apr 2016 15:56:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 9FD7491AE6; Fri, 15 Apr 2016 15:56:38 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 954911C12CE for ; Fri, 15 Apr 2016 15:56:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 89DA691B1D for ; Fri, 15 Apr 2016 15:56:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pFD78jKBvP4Q for ; Fri, 15 Apr 2016 15:56:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qg0-f46.google.com (mail-qg0-f46.google.com [209.85.192.46]) by whitealder.osuosl.org (Postfix) with ESMTPS id 30BC591651 for ; Fri, 15 Apr 2016 15:56:31 +0000 (UTC) Received: by mail-qg0-f46.google.com with SMTP id f52so83371097qga.3 for ; Fri, 15 Apr 2016 08:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JJPdJQw8zLjcKoqXNqphK5r4p40m9Ql0O1faDHI9vBI=; b=wH6wb6UlSyVaMAYZ6MGHWfrTp+B1oMGY1ISkzbt+y+0925CwUTUD/Pndk3dI6tN5Y3 o5esINklewIlXYJV42b8AxqjVEA+xmNXXll7Cb/Ts5B7Ho+su4uHOfidu966Ofu8nnh4 g7NXp3d0E7YqBuKSy7nejvFsgJYYXD31uFGfM5BYUWhmfCaolR4RTIPSGOV+TLmWZ6my Tp+Uh0kwih1l7cUDdFU5TiiGLtU/dCshEM4HvtGN7Ydv2bvI2sAgpeACkfAp0xta0Trr eNtP6j+3bquDAFOszMN2famXE7rj7KgpSdZM+3m+X9DnIA5tRJHaf8/WGohuz3HLc2a8 W2pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JJPdJQw8zLjcKoqXNqphK5r4p40m9Ql0O1faDHI9vBI=; b=GYRAE6WsB8TFw5cJy4x5QUOnM7aBtGGCnxnG00hGMvibvM92r5bFRBmz0H9LI4sSsR 83mRi5yOzNTrRzmW4nniP5dhVxcSPNdtexkRDczrFEjHdWxk8FrlgflBkJlBa8Ttab4f L2QZhRWXjNEvmOC841qBfgIi1NPC4rXJXnTr4bECsTLw78VJSEGSPVNTiX7q4KdqnaF3 tv9jvmSuccO04r2h7o++69ux5OF3swkkHWn4mSbh1tbEyzJu9S4k4GsRklKYKMWCZ79f fIpYY7SPF6EU50OhG9Xr+oL/q8/lKbqZea4w4XtS7WEAnn+GU46/6CPR5QRU4mFf/wJp HG7Q== X-Gm-Message-State: AOPr4FXjldnqElYsmQQ4nOI5Mcxosz7dAdQp2+gwuRfxp67genE7SLmlGtfW7t0ILmqStA== X-Received: by 10.140.89.178 with SMTP id v47mr25876574qgd.11.1460735790247; Fri, 15 Apr 2016 08:56:30 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id 131sm19110630qhk.15.2016.04.15.08.56.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 08:56:29 -0700 (PDT) From: Ezequiel Garcia To: Date: Fri, 15 Apr 2016 12:56:07 -0300 Message-Id: <1460735767-2577-5-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1460735767-2577-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1460735767-2577-1-git-send-email-ezequiel@vanguardiasur.com.ar> Subject: [Buildroot] [PATCH v2 4/4] board/minnowboard-max: Add a X-based graphical defconfig X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This commit adds a new defconfig to build a X-based graphical system for the Minnowboard MAX board. * The 'openbox' windows manager is chosen because it's simple and lightweigth. * Basic X apps are enabled (such as xrandr, xterm), so we can at least get a console and change video mode. * ALSA default configuration is provided, so HDMI audio works out-of-the-box. * OpenGL is supported. Tested on Minnoboard Turot (which is Minnowboard Max compatible). Signed-off-by: Ezequiel Garcia --- Changes from v1: * Use an overlay instead of post-build.sh to customize the rootfs. * Remove systemd usage, so we provide a minimum "audio and graphics" setup. --- .../fs-overlay-graphical/etc/asound.conf | 4 + .../minnowboard/fs-overlay-graphical/root/.xinitrc | 1 + .../fs-overlay-graphical/usr/bin/startx | 248 +++++++++++++++++++++ configs/minnowboard_max-graphical_defconfig | 79 +++++++ 4 files changed, 332 insertions(+) create mode 100644 board/minnowboard/fs-overlay-graphical/etc/asound.conf create mode 100644 board/minnowboard/fs-overlay-graphical/root/.xinitrc create mode 100755 board/minnowboard/fs-overlay-graphical/usr/bin/startx create mode 100644 configs/minnowboard_max-graphical_defconfig diff --git a/board/minnowboard/fs-overlay-graphical/etc/asound.conf b/board/minnowboard/fs-overlay-graphical/etc/asound.conf new file mode 100644 index 000000000000..b75b2383647b --- /dev/null +++ b/board/minnowboard/fs-overlay-graphical/etc/asound.conf @@ -0,0 +1,4 @@ +# Customize ALSA: +# the HDMI PCM is at card=0, device=3 (i.e. hw:0,3) +defaults.pcm.card 0 +defaults.pcm.device 3 diff --git a/board/minnowboard/fs-overlay-graphical/root/.xinitrc b/board/minnowboard/fs-overlay-graphical/root/.xinitrc new file mode 100644 index 000000000000..4274b24df1bc --- /dev/null +++ b/board/minnowboard/fs-overlay-graphical/root/.xinitrc @@ -0,0 +1 @@ +exec /usr/bin/openbox-session diff --git a/board/minnowboard/fs-overlay-graphical/usr/bin/startx b/board/minnowboard/fs-overlay-graphical/usr/bin/startx new file mode 100755 index 000000000000..a600348e317f --- /dev/null +++ b/board/minnowboard/fs-overlay-graphical/usr/bin/startx @@ -0,0 +1,248 @@ +#!/bin/sh + +# Fixup startx so it doesn't start X on the controlling +# virtual console. Apparently, this is a bug and we are +# affected for our lack of a Display Manager. +# See https://bugs.freedesktop.org/show_bug.cgi?id=87762 +# +# I haven't found a way to do this without hacking startx +# itself. The only change we are doing here is setting +# serverargs to "vt1", see below. + +# +# This is just a sample implementation of a slightly less primitive +# interface than xinit. It looks for user .xinitrc and .xserverrc +# files, then system xinitrc and xserverrc files, else lets xinit choose +# its default. The system xinitrc should probably do things like check +# for .Xresources files and merge them in, start up a window manager, +# and pop a clock and several xterms. +# +# Site administrators are STRONGLY urged to write nicer versions. +# + +unset DBUS_SESSION_BUS_ADDRESS +unset SESSION_MANAGER +userclientrc=$HOME/.xinitrc +sysclientrc=/etc/X11/xinit/xinitrc + +userserverrc=$HOME/.xserverrc +sysserverrc=/etc/X11/xinit/xserverrc +defaultclient=xterm +defaultserver=/usr/bin/X +defaultclientargs="" +defaultserverargs="" +defaultdisplay=":0" +clientargs="" +serverargs="vt1" +vtarg="" +enable_xauth=1 + + +# Automatically determine an unused $DISPLAY +d=0 +while true ; do + [ -e /tmp/.X$d-lock ] || break + d=$(($d + 1)) +done +defaultdisplay=":$d" +unset d + +whoseargs="client" +while [ x"$1" != x ]; do + case "$1" in + # '' required to prevent cpp from treating "/*" as a C comment. + /''*|\./''*) + if [ "$whoseargs" = "client" ]; then + if [ x"$client" = x ] && [ x"$clientargs" = x ]; then + client="$1" + else + clientargs="$clientargs $1" + fi + else + if [ x"$server" = x ] && [ x"$serverargs" = x ]; then + server="$1" + else + serverargs="$serverargs $1" + fi + fi + ;; + --) + whoseargs="server" + ;; + *) + if [ "$whoseargs" = "client" ]; then + clientargs="$clientargs $1" + else + # display must be the FIRST server argument + if [ x"$serverargs" = x ] && \ + expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then + display="$1" + else + serverargs="$serverargs $1" + fi + fi + ;; + esac + shift +done + +# process client arguments +if [ x"$client" = x ]; then + client=$defaultclient + + # For compatibility reasons, only use startxrc if there were no client command line arguments + if [ x"$clientargs" = x ]; then + if [ -f "$userclientrc" ]; then + client=$userclientrc + elif [ -f "$sysclientrc" ]; then + client=$sysclientrc + fi + fi +fi + +# if no client arguments, use defaults +if [ x"$clientargs" = x ]; then + clientargs=$defaultclientargs +fi + +# process server arguments +if [ x"$server" = x ]; then + server=$defaultserver + + + # When starting the defaultserver start X on the current tty to avoid + # the startx session being seen as inactive: + # "https://bugzilla.redhat.com/show_bug.cgi?id=806491" + tty=$(tty) + if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then + tty_num=$(echo "$tty" | grep -oE '[0-9]+$') + vtarg="vt$tty_num" + fi + + + # For compatibility reasons, only use xserverrc if there were no server command line arguments + if [ x"$serverargs" = x -a x"$display" = x ]; then + if [ -f "$userserverrc" ]; then + server=$userserverrc + elif [ -f "$sysserverrc" ]; then + server=$sysserverrc + fi + fi +fi + +# if no server arguments, use defaults +if [ x"$serverargs" = x ]; then + serverargs=$defaultserverargs +fi + +# if no vt is specified add vtarg (which may be empty) +have_vtarg="no" +for i in $serverargs; do + if expr match "$i" '^vt[0-9]\+$' > /dev/null; then + have_vtarg="yes" + fi +done +if [ "$have_vtarg" = "no" ]; then + serverargs="$serverargs $vtarg" +fi + +# if no display, use default +if [ x"$display" = x ]; then + display=$defaultdisplay +fi + +if [ x"$enable_xauth" = x1 ] ; then + if [ x"$XAUTHORITY" = x ]; then + XAUTHORITY=$HOME/.Xauthority + export XAUTHORITY + fi + + removelist= + + # set up default Xauth info for this machine + case `uname` in + Linux*) + if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then + hostname=`hostname -f` + else + hostname=`hostname` + fi + ;; + *) + hostname=`hostname` + ;; + esac + + authdisplay=${display:-:0} + + mcookie=`/usr/bin/mcookie` + + + + + + + + if test x"$mcookie" = x; then + echo "Couldn't create cookie" + exit 1 + fi + dummy=0 + + # create a file with auth information for the server. ':0' is a dummy. + xserverauthfile=$HOME/.serverauth.$$ + trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM + xauth -q -f "$xserverauthfile" << EOF +add :$dummy . $mcookie +EOF + + + + + serverargs=${serverargs}" -auth "${xserverauthfile} + + + # now add the same credentials to the client authority file + # if '$displayname' already exists do not overwrite it as another + # server man need it. Add them to the '$xserverauthfile' instead. + for displayname in $authdisplay $hostname$authdisplay; do + authcookie=`xauth list "$displayname" \ + | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null; + if [ "z${authcookie}" = "z" ] ; then + xauth -q << EOF +add $displayname . $mcookie +EOF + removelist="$displayname $removelist" + else + dummy=$(($dummy+1)); + xauth -q -f "$xserverauthfile" << EOF +add :$dummy . $authcookie +EOF + fi + done +fi + + + + +xinit "$client" $clientargs -- "$server" $display $serverargs + +retval=$? + +if [ x"$enable_xauth" = x1 ] ; then + if [ x"$removelist" != x ]; then + xauth remove $removelist + fi + if [ x"$xserverauthfile" != x ]; then + rm -f "$xserverauthfile" + fi +fi + + + + + +if command -v deallocvt > /dev/null 2>&1; then + deallocvt +fi +exit $retval diff --git a/configs/minnowboard_max-graphical_defconfig b/configs/minnowboard_max-graphical_defconfig new file mode 100644 index 000000000000..5397720d7c91 --- /dev/null +++ b/configs/minnowboard_max-graphical_defconfig @@ -0,0 +1,79 @@ +# Architecture +BR2_x86_64=y +BR2_x86_atom=y + +# Toolchain +BR2_OPTIMIZE_2=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_GLIBC_VERSION_2_23=y +BR2_BINUTILS_VERSION_2_26_X=y +BR2_GCC_VERSION_5_X=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y + +# System configuration +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y +BR2_TARGET_GENERIC_GETTY_PORT="tty0" +BR2_ROOTFS_OVERLAY="board/minnowboard/fs-overlay-graphical" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/minnowboard/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/minnowboard/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="minnowboard-max" + +# Host packages +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y + +# Linux +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.4" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/minnowboard/linux-4.4.config" + +# Bootloader +BR2_TARGET_GRUB2=y +BR2_TARGET_GRUB2_X86_64_EFI=y + +# ALSA +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y + +# OpenGL +BR2_PACKAGE_GLMARK2=y +BR2_PACKAGE_MESA3D_DEMOS=y +BR2_PACKAGE_MESA3D=y +BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST=y +BR2_PACKAGE_MESA3D_DRI_DRIVER_I965=y + +# Framebuffer (just for testing purposes) +BR2_PACKAGE_FB_TEST_APP=y + +# X +BR2_PACKAGE_XORG7=y +BR2_PACKAGE_XSERVER_XORG_SERVER=y +BR2_PACKAGE_XSERVER_XORG_SERVER_AIGLX=y +BR2_PACKAGE_XAPP_XINIT=y +BR2_PACKAGE_XAPP_XRANDR=y +BR2_PACKAGE_XDRIVER_XF86_INPUT_EVDEV=y +BR2_PACKAGE_XDRIVER_XF86_INPUT_KEYBOARD=y +BR2_PACKAGE_XDRIVER_XF86_INPUT_MOUSE=y +BR2_PACKAGE_XDRIVER_XF86_VIDEO_INTEL=y +BR2_PACKAGE_XTERM=y +BR2_PACKAGE_OPENBOX=y + +# Firmware +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y + +# Libraries +BR2_PACKAGE_IMLIB2=y +BR2_PACKAGE_IMLIB2_JPEG=y +BR2_PACKAGE_IMLIB2_PNG=y +BR2_PACKAGE_STARTUP_NOTIFICATION=y + +# Filesystem image +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +# BR2_TARGET_ROOTFS_TAR is not set +