From owner-freebsd-questions@freebsd.org Sat Jun 11 06:21:26 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C349CAEFC9E for ; Sat, 11 Jun 2016 06:21:26 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68D012E23 for ; Sat, 11 Jun 2016 06:21:25 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [88.217.99.69] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1bBcIM-00077o-83; Sat, 11 Jun 2016 08:21:22 +0200 Received: from localhost.my.domain (c720-r292778-amd64 [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id u5B6LL7P001960 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 11 Jun 2016 08:21:22 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id u5B6LLpL001959; Sat, 11 Jun 2016 08:21:21 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Sat, 11 Jun 2016 08:21:21 +0200 From: Matthias Apitz To: Don Harper Cc: Byung-Hee HWANG =?utf-8?B?KO2Zqeuzke2drCk=?= , freebsd-questions@freebsd.org Subject: Re: advice for buying a laptop Message-ID: <20160611062121.GA1904@c720-r292778-amd64> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , Don Harper , Byung-Hee HWANG =?utf-8?B?KO2Zqeuzke2drCk=?= , freebsd-questions@freebsd.org References: <4BC7E222-EC18-46AB-BF94-DF06AF70A28E@doraji.xyz> <1EDE9C05-0E09-4BFB-80EB-DFCF7F521711@doraji.xyz> <20160610182551.GB1869@c720-r292778-amd64> <20160611000913.xug7mjpszwz5wcsk@duckland.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160611000913.xug7mjpszwz5wcsk@duckland.org> X-Operating-System: FreeBSD 11.0-CURRENT r292778 (amd64) User-Agent: Mutt/1.5.24 (2015-08-30) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 88.217.99.69 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2016 06:21:26 -0000 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit El día Friday, June 10, 2016 a las 07:09:13PM -0500, Don Harper escribió: > Matthias, > I am not sure of the other poster has a question, but I was wondering if > you ever got suspend/resume working on your C720? If so, can you point > me to some docs or give a quick write-up on where to go look? As I said to Byung-Hee HWANG (황병희), I own two of these devices and support one more used by some customer. All of them run a r292778 and ports compiled with poudriere. I started in January 2015 with this and followed Michael's blog post here: https://blog.grem.de/pages/c720.html I think, he was the first making patches (now in head) to support this device and he gave me a lot of help too. I'm attaching my step-by-step guide which explains how to tweak the Chromebook to support FreeBSD boot, how to make a USB key etc. Suspend until now is not working, at least not in the kernel I'm using. I will update it soon to a today's head to see how far the support for Haswell chips is. matthias -- Matthias Apitz, ✉ guru@unixarea.de, ⌂ http://www.unixarea.de/ ☎ +49-176-38902045 "Die Verkaufsschlager des Buchmarkts geben Auskunft über den Zustand einer Gesellschaft bzw. sind, was diese Zeiten angeht, Gradmesser fortschreitenden Schwachsinns. ..." (jW 19.05.2016) --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="install-acer-c720-amd64.txt" Content-Transfer-Encoding: 8bit $Id: install-acer-c720-amd64.txt,v 1.6 2015/08/02 06:35:53 guru Exp $ Preparing an USB boot key for AMD64 Installation of the Acer C720 Chromebook Matthias Apitz Version for r285885, August 2015 (20150805) 1. Prepare a bootable USB key from a recent CURRENT, mine was r285885 (July 26) # mkdir -p /usr/local/r285885/ # cd /usr/local/r285885/ # svn co svn://svn.freebsd.org/base/head src (r285885) Btw: Using before /home/guru/r... was a big mistake, because this way the compiled .depend files contain references to /usr/home/... and to /home/... files, which will not work if /home does not exist as a sym link to usr/home. Better is using some top level dir belwow /usr/local/.... to avoid this problem. # cd /usr/local/r285885/src # mkdir /usr/local/r285885/obj # MAKEOBJDIRPREFIX=/usr/local/r285885/obj # export MAKEOBJDIRPREFIX # make buildworld # make buildkernel Install world and kernel into a directory /usr/local/r285885/root.r285885: # MAKEOBJDIRPREFIX=/usr/local/r285885/obj # export MAKEOBJDIRPREFIX # cd /usr/local/r285885 # test -d root.r285885 && chflags -R noschg root.r285885 # rm -rf root.r285885 memstick.img # mkdir -p /usr/local/r285885/root.r285885 # cd /usr/local/r285885/src # make installworld DESTDIR=/usr/local/r285885/root.r285885 # make installkernel DESTDIR=/usr/local/r285885/root.r285885 # make distrib-dirs DESTDIR=/usr/local/r285885/root.r285885 # make distribution DESTDIR=/usr/local/r285885/root.r285885 We now have in /usr/local/r285885 the following files/dirs: make-memstick-amd64.sh src obj root.r285885 We populate the root.r285885 'file system' with: # cd /usr/local/r285885 # mkdir -p root.r285885/usr/local/r285885 # cp -Rp src root.r285885/usr/local/r285885 # cp -Rp obj root.r285885/usr/local/r285885 # cp -p ~guru/c720/rc.conf root.r285885/etc # cp -p ~guru/c720/c720.kbd root.r285885/etc # cp -p ~guru/c720/sysctl.conf root.r285885/etc # cp -p ~guru/c720/loader.conf root.r285885/boot # mkdir -p root.r285885/usr/local/sbin # cp -p /usr/local/sbin/pkg-static root.r285885/usr/local/sbin/pkg-static # cat <> root.r285885/boot/device.hints hint.hdaa.1.nid20.config="as=3 seq=0" hint.hdaa.1.nid25.config="as=2 seq=10" hint.hdaa.1.nid26.config="as=2 seq=11" hint.hdaa.1.nid33.config="as=3 seq=15" EOF Now we create an image of the new root in /usr/local/r285885/root.r285885; I used a modified version of /usr/src/release/amd64/make-memstick.sh which allows me to specify the size of the resulting image to be able to adjust this to the number of 512 byte blocks of the USB stick; the modifications are: size=14680064b # fits into 7 GByte stick ... makefs -B little -M ${size} -m ${size} -f 400000 -o label=FreeBSD_Install ${2}.part ${1} We run the script to build the image: # cd /usr/local/r285885 # rm memstick.img # ./make-memstick.sh /usr/local/r285885/root.r285885 /usr/local/r285885/memstick.img ... Populating `/usr/local/r285885/memstick.img' Image `/usr/local/r285885/memstick.img' complete md1 created bootcode written to ... ... This gives us the image 'memstick.img' as less then 8 GByte: $ ls -l memstick.img -rw-r--r-- 1 root wheel 7518079488 02 ago 20:57 memstick.img Note: In contrast to the i386/make-memstick.sh, this script produces four partitions in the image, p3 contains the system and we can re-mount and check what is in there (or add more stuff) with: # unit=$(mdconfig -a -t vnode -f /usr/local/r285885/memstick.img) # mount /dev/${unit}p3 /mnt ... # umount /mnt We must set the partition 'active' (without this it did not boot in Dell Latitude E6330, see freebsd-current@ May 7, 2016): # gpart set -a active ${unit} Detach the virtual device # mdconfig -d -u ${unit} Finally, dd the memstick.img file to an USB key with: # dd if=memstick.img of=/dev/da0 bs=8m 2. Installation of the base system on the C720 You should for Wifi at least copy your working /etc/wpa_supplicant.conf into the stick (and later into the new system): # mount /dev/da0p3 /mnt # cp -p /etc/wpa_supplicant.conf /mnt/etc # umount /mnt The installation of the base system into the C720 goes like this: Boot from the USB stick. TEST If you want to do a test to check if the USB stick is fine, you can mount the old system to the USB stick, create some dummy directory and install into this, like: # mount /dev/ada0p2 /mnt # mkdir /mnt/r285885 # sh # cd /usr/local/r285885/src # MAKEOBJDIRPREFIX=/usr/local/r285885/obj export MAKEOBJDIRPREFIX # make installworld DESTDIR=/mnt/r285885 # make installkernel DESTDIR=/mnt/r285885 # make distrib-dirs DESTDIR=/mnt/r285885 # make distribution DESTDIR=/mnt/r285885 This would not overwrite your existing system, but just (test-) install into /mnt/r285885. If there is any error on this, your old system is still untouched. WARNING: From here the procedure is now destructive to your old installation. AFTER making an external COPY of your HOME, re-partition the entire disk (I have a 256 GByte SSD) with 'bsdinstall' # umount /mnt # in case it is still mounted from the test # bsdinstall your keyboard input >>> Continue with /etc/c720.kbd keymap --> Select (just press ENTER) Please choose a hostname... --> dummy-host-name ENTER (*) Please select the site ... --> Ok ENTER How would you like to partition your disk? --> Auto (UFS) ENTER ada0 --> ENTER Entire Disk --> ENTER GPT --> ENTER ada0 238 GB GPT ada0p1 512 KB freebsd-boot ada0p2 234 GB freebsd-ufs ada0p3 4.0 GB freebsd-swap --> Finish ENTER --> Commit ENTER After this just use the proposed layout, let bsdinstall write the partition table to the disk and when it starts installing from network, cancel this with Ctrl-C; (*) Note: bsdinstall can't write the host name into /etc/rc.conf; we will do this later; just put any string here as dummy-host-name; The partitions created by bsdinstall should now be visible as the following devices: # ls -C1 /dev/ada0p* /dev/ada0p1 -- will be used for 512 KByte freebsd-boot /dev/ada0p2 -- will be used for 115 GByte freebsd-ufs /dev/ada0p3 -- will be used for 4 GByte freebsd-swap Mount the future root device /dev/ada0p2 as /mnt: # mount /dev/ada0p2 /mnt and install from the USB system into the mounted /mnt, use a shell 'sh' and the the default csh of user root: # sh # cd /usr/local/r285885/src # MAKEOBJDIRPREFIX=/usr/local/r285885/obj export MAKEOBJDIRPREFIX double check the definition of MAKEOBJDIRPREFIX with: # env | fgrep MAKEOBJDIRPREFIX # ls $MAKEOBJDIRPREFIX if all is fine, we are ready to go: # make installworld DESTDIR=/mnt # make installkernel DESTDIR=/mnt # make distrib-dirs DESTDIR=/mnt # make distribution DESTDIR=/mnt To be able to compile the system on the C720 itself, we copy the sources to the correct places: # cp -Rp /usr/local/r285885/src /mnt/usr Create a correct /etc/fstab for the new system: # vi /mnt/etc/fstab /dev/ada0p2 / ufs rw,noatime 1 1 /dev/ada0p3 none swap sw 0 0 Copy some files from the USB system into place and reboot: # cp -p /etc/rc.conf /mnt/etc # cp -p /etc/c720.kbd /mnt/etc # cp -p /etc/sysctl.conf /mnt/etc # cp -p /etc/motd /mnt/etc # cp -p /boot/loader.conf /mnt/boot # cp -p /boot/device.hints /mnt/boot Configure Wifi for the new system: # cp -p /etc/wpa_supplicant.conf /mnt/etc or # vi /mnt/etc/wpa_supplicant.conf # add your Wifi secrets in this file We need a static version of pkg(8) to install later from our local repository without any connection to Internet: # mkdir -p /mnt/usr/local/sbin # cp -p /usr/local/sbin/pkg-static /mnt/usr/local/sbin/pkg-static # umount /mnt # reboot When the system is up again, run: # tzsetup # passwd root 3. Installation of the package repository on the C720 I have compiled around 1600 packages with the engine poudriere on an amd64 host Dell M4400. The system on this host was setup as described above. The packages are not part of the above mentioned USB stick, just for the reason that they have been created later on the Dell M4400 and to keep the USB stick below the size of 8 marketing-GByte. The packages are in /usr/PKGDIR.20150726, around 1660, the last ones from March 14 this year. Best is to copy them from the 2nd USB stick to the installed system exactly on the same place: # mount -o ro /dev/da0s1a /mnt # cp -Rp /mnt/PKGDIR.20150726 /usr Create from this directory the package repository and install whatever you like. We define the repository with creating a file myrepo.conf as: # mkdir -p /usr/local/etc/pkg/repos # cp /usr/PKGDIR.20150726/myrepo.conf /usr/local/etc/pkg/repos Just for info: # cat /usr/local/etc/pkg/repos/myrepo.conf FreeBSD: { url: "file:///usr/PKGDIR.20150726", enabled: true, } Now we create the repository and install packages: # pkg-static repo /usr/PKGDIR.20150726 Creating repository in /usr/PKGDIR: 83% ... Packing files for repository: 100% Time to to install any stuff (and its dependencies): # pkg-static -R /usr/local/etc/pkg/repos/ install xorg # pkg-static -R /usr/local/etc/pkg/repos/ install kde-4.14.3 # pkg-static -R /usr/local/etc/pkg/repos/ install xbindkeys # pkg-static -R /usr/local/etc/pkg/repos/ install hal # maybe installed by kde already # pkg-static -R /usr/local/etc/pkg/repos/ install dbus # maybe installed by kde already # pkg-static -R /usr/local/etc/pkg/repos/ install mutt # pkg-static -R /usr/local/etc/pkg/repos/ install muttprint ... restart the daemons with: # reboot there is a bug and we must rename /usr/local/bin/akonadiserver to /usr/local/bin/akonadiserver.away 4. Userland and some special tweakings on the C720 After the above installation you should add a normal user with: # adduser login as this and populate its HOME with at least the followin files: $ vi ~/.xinitrc: setxkbmap -option terminate:ctrl_alt_bksp xrandr --output default --mode 1366x768 xset dpms 50 /usr/local/bin/xbindkeys exec /usr/local/bin/startkde $ vi ~/.xserverrc exec X -nolisten tcp -retro -logverbose 6 $ mkdir -p ~/.kde4/Autostart ~/.kde4/Autostart/xmod.sh fetch it from http://www.unixarea.de/c720/xmod.sh IMPORTANT Note: There is a bug in KDE; the session will be completely unsuable if the file is not executeable; run: $ chmod 0755 ~/.kde4/Autostart/xmod.sh ~/.xbindkeysrc fetch it from http://www.unixarea.de/c720/xbindkeysrc (but note it should be named as ~/.xbindkeysrc with the dot '.') After this KDE4 should come up with simple: $ startx The Xorg server will use the Vesa driver and the moused, i.e. does not need any sofisticated xorg.conf file for this. Vesa is poor on a Haswell CPU/GPU, but you will not note it. Hints about keyboard related changes: The C720 has a very limited keyboard (no Windows key, no hardware power-off key, ...); we have to tweak the keyboard a bit: in console mode: hw.acpi.power_button_state=NONE in /etc/sysctl.conf to avoid the shutdown via the ACPI power-off key, but we need 'power-down' and reallow 'pdwn' with Shift-ALt-(ACPI)-powerdown key; see /etc/c720.kbd and /etc/rc.conf In X11 / KDE4 mode: general layout see ~/.kde4/Autostart/xmod.sh: which does: - it swaps Alt_l with Windows-key - it uses (old) CapsLock as ALt-l - it uses (new) Win-key as Mode_switch - it configures Prior and Next keys as Mode_switch+Up/Down - it configures Spanish tilded chars: áíóéñ... In addition we start xbindkeys (see ~/.xbindkeysrc) to configure - Alt+F6: "intel_backlight decr" - Alt+F7: "intel_backlight incr" to control the display brightness and we configure in KDE System Settings --> ShortCuts --> Global --> KMix: - Alt+F8 Mute - Alt+F9 Decrease Volume - Alt+F10 Increase Volume - page up/down, i.e. 'Prior' and 'Next': the mapping is defined in 'xmod.sh' as Mode_switch+Up/Down which works fine in all X11 clients, but not in 'xterm'; for this bug(?) I defined in a file ~/.Xdefaults-c720-r285885: *VT100.translations: #override \ ShiftUp: scroll-back(1,page) \n\ ShiftDown: scroll-forw(1,page) \n\ ShiftF10: string("hola") (put a TAB before the lines with Shift....) and with this you can now use Shift+Mode_switch+Up/Down to get what you expect. Touchpad layout/functions: (stolen from http://blog.grem.de/pages/c720.html) 2/3 1/3 +--------------------+------------+ | | Middle | | | Button | | Left | | | Button +------------+ | | Right | | | Button | +--------------------+............| | Thumb/Button Area | 15% +---------------------------------+ Two finger scrolling - Use two fingers for Z axis scrolling. Button down/2nd finger - While one finger clicks and holds down the touchpad, the second one can be used to move the mouse cursor. Useful for drawing or selecting text. Thumb/Button Area - The lower 15%* of the trackpad will not affect the mouse cursor position. This allows for high precision clicking, by controlling the cursor with the index finger and pushing/holding the pad down with the thumb. * can be changed using sysctl Track-pad button - Push physical button. Left 2/3rds of the pad will issue a LEFT button event, upper right corner will issue a MIDDLE button event, lower right corner will issue a RIGHT button event. Optionally tap to click can be enabled (check *cyapa(4)* for details). my values in /etc/sysctl.conf are: debug.cyapa_enable_tapclick=3 debug.cyapa_tapclick_max_ticks=20 see also man cyapa(4) --WIyZ46R2i8wDzkSu--