Site Tools


Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
debian_uboot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
debian_uboot [2012/01/15 12:34] – created paulfdebian_uboot [2016/10/24 15:59] (current) – [Installation and initial configuration story] fix s/set/setenv/ typo paulf
Line 1: Line 1:
 +====== Debian hardfloat with upstream U-Boot ======
 +
 Here I'm documenting my progress on using my ac100-116 "the right way". Feel free to reach me on [[help#irc]], my nick is PaulFertser. Here I'm documenting my progress on using my ac100-116 "the right way". Feel free to reach me on [[help#irc]], my nick is PaulFertser.
  
-First things first: for now the serial console is needed because the kernel doesn't yet initialise the display properly.+**UPDATE 24 Oct 2016**migrated the system to current upstream U-boot and Linux. Everything seems to be nice and reliable. The limitations section still applies. 
 +Some notes on update: 
 +  * Needs the latest (from firmware git) ''rt2870.bin'' for stable wifi 
 +  * Missing ''nvec_event'' so lid open/close events are not generated 
 +  * To be able to use ''synaptics'' X.org driver the ''elantech'' protocol needs to be forced for ''psmouse'' kernel driver 
 +  * ''mpv'' works nicely for unaccelerated video playback, including streaming from Youtube and other popular hostings (''ytdl-format=18'' is usually needed
 +===== Status ===== 
 +==== What works ==== 
 +  * Booting (currently fetching kernel+rootfs is a bit slow due to u-boot bug, ~15s) 
 +  * Display (both text console and X.org fbdev), keyboard, touchpad 
 +  * Wifi 
 +  * Bluetooth 
 +  * GSM/UMTS data transfer 
 +  * Stereo sound both on internal speakers and the headphones 
 +  * Webcam 
 +  * Integrated digital microphone 
 +  * External stereo headset with microphone
  
-I use a toolchain compiled by Gentoo crossdev[[putusb]][[uboot]].+==== What doesn't ==== 
 +  * LCD and keyboard in u-boot (pending upstream patches and paz00 integrationhttp://news.gmane.org/group/gmane.comp.boot-loaders.u-boot/thread=122864for keyboard NVEC support would be needed) 
 +  * Boot from USB in u-boot (http://news.gmane.org/group/gmane.comp.boot-loaders.u-boot/thread=122484) 
 +  * Resume from suspend-to-ram (pending u-boot warmboot patches, see http://news.gmane.org/group/gmane.comp.boot-loaders.u-boot/thread=122760) 
 +  * Suspend-to-disk/hibernation (not anytime soon, no upstream support for ARMs) 
 +  * tegra_wdt watchdog resets the system but it doesn't boot after that for the reasons unknown 
 +  * Proprietary drivers for X and OMX-accelerated sound/video decoding (never tried, see https://build.pub.meego.com/package/files?package=nvidia-tegra2&project=home%3Acxl000%3Atrimslice%3AMer%3Atesting , http://ppa.launchpad.net/ac100/ppa/ubuntu/pool/restricted/n/nvidia-graphics-drivers-tegra/ , mplayer-omx, gst-omx etc)
  
-Configure u-boot with "make paz00_config" and build it with your toolchain.+===== Installation and initial configuration story ===== 
 +U-boot doesn't support the display yet. Kernel initialises and uses the integrated panel and the backlight properly. It's possible that you'll manage this with a specially prepared bootloader that will boot from external SD automatically without a serial console.
  
-Kernel should have all tegrapart-related options disabled, as tegrapart oopses when there's no corresponding option on the command line. Also minor kernel patch seem to be needed for now. +I use toolchain compiled by Gentoo crossdev, [[putusb]][[uboot]], Marvin's 3.0.8 kernel.
-<code> +
-diff --git a/arch/arm/mach-tegra/board-paz00-panel.c b/arch/arm/mach-tegra/board-paz00-panel.c +
-index e65488d..f8cf7d4 100644 +
---- a/arch/arm/mach-tegra/board-paz00-panel.c +
-+++ b/arch/arm/mach-tegra/board-paz00-panel.c +
-@@ -346,9 +346,11 @@ int __init paz00_panel_init(size_t fb_addr) +
-        gpio_request_one(TEGRA_HDMI_HPD, GPIOF_IN, "hdmi_hpd"); +
-        gpio_export(TEGRA_LVDS_SHUTDOWN, 0); +
-  +
--       paz00_disp1_resources[2].start = fb_addr; +
--       /* 2.4 MB framebuffer should be enough */ +
--       paz00_disp1_resources[2].end =   fb_addr + 0x26B000 - 1; +
-+       if (fb_addr) { +
-+               paz00_disp1_resources[2].start = fb_addr; +
-+               /* 2.4 MB framebuffer should be enough */ +
-+               paz00_disp1_resources[2].end =   fb_addr + 0x26B000 - 1; +
-+       } +
-  +
-        err = platform_add_devices(paz00_gfx_devices, +
-                                   ARRAY_SIZE(paz00_gfx_devices)); +
-diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.+
-index 9e06a21..65c1137 100644 +
---- a/arch/arm/mach-tegra/clock.c +
-+++ b/arch/arm/mach-tegra/clock.c +
-@@ -339,9 +339,14 @@ int clk_set_rate_locked(struct clk *c, unsigned long rate) +
-                        return ret; +
-        } +
-  +
--       ret = c->ops->set_rate(c, rate); +
--       if (ret) +
--               return ret; +
-+       if (c->ops && c->ops->set_rate) { +
-+               ret = c->ops->set_rate(c, rate); +
-+               if (ret) +
-+                       return ret; +
-+       } else { +
-+               pr_warn("set_rate() for %s is needed but not available\n", +
-+                       c->name); +
-+       } +
-  +
-        if (clk_is_auto_dvfs(c) && rate < old_rate && c->refcnt > 0) +
-                ret = tegra_dvfs_set_rate(c, rate); +
-</code>+
  
-I then used my laptop and an SD card, created a single ext2 partition there and unpacked the preinstalled ubuntu rootfs. Copied the uImage to root and the created modules to /lib/modules. Erased unneeded boot scripts (including network-manager) from /etc/init/. Created there a file to start getty on ttyS0, 115200 baud. Placed a suitable wpa_supplicant.conf somewhere on the card. Removed password from /etc/shadow to give me root login.+Configure u-boot with ''make paz00_config'' and build it with your toolchain.
  
-boot the u-boot.bin via putusb, then <code>mmc dev 1; ext2load mmc 1 0x408000 uImage; set bootargs "mem=448M@0M console=ttyS0,115200n8 root=/dev/mmcblk1p1"; bootm</code>+then used my laptop and an SD card, created a single ext2 partition there and unpacked the preinstalled ubuntu rootfsCopied the ''uImage'' to root and the created modules to ''/lib/modules''. Erased unneeded boot scripts (including ''network-manager'') from ''/etc/init/''. Created there a file to start ''getty'' on ''ttyS0'', 115200 baud. Placed a suitable ''wpa_supplicant.conf'' somewhere on the card. Removed password from ''/etc/shadow'' to give me root login.
  
-Logged inset password to 1, start "wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &", then dhclient eth0. Installed openssh-server and switched to that (because the serial console sometimes stops to function).+I boot the u-boot.bin via putusbthen <code>mmc dev 1; ext2load mmc 1 0x408000 uImage; setenv bootargs "mem=509M@0M console=tty1 console=ttyS0,115200n8 root=/dev/mmcblk1p1"; bootm</code>
  
-Installed gdisk and repartitioned from scratch /dev/mmcblk0creating two partitions there (one for /boot32M should be enough), another for LVM pv. Created LVM there, with two (for now) volumes: 1G for swap, and everything else for the rootfs. mkfs.nilfs /dev/emmc-lvm/rootfsMounted it, and started to Debootstrap debian armhf according to the official manual (you'll need to read both installing debian and armhf chroot).+Logged inset password to 1start ''wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &''then ''dhclient eth0''. Installed ''openssh-server'' and switched to that (because the serial console sometimes stops to function).
  
-Copied /lib/firmware/rt2870.bin to the newly established systemconfigured /etc/network/interfaces to bring up wlan0 for my home wlan automatically. Created a symlink from /bin/true to /usr/sbin/mkfs.nilfs2 to make the boot happy.+Installed ''gdisk'' and repartitioned from scratch ''/dev/mmcblk0''creating two partitions there (one for /boot, 32M should be enough), another for LVM pv. Created LVM there, with two (for now) volumes: 1G for swap, and everything else for the rootfs. ''mkfs.nilfs /dev/emmc-lvm/rootfs''Mounted it, and started to Debootstrap debian armhf according to the official manual (you'll need to read both installing debian and armhf chroot, though debian-ports.org repositories are not needed).
  
-Initramfs is a bit tricky: a workaround from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649288 is needed (it has a typo where .. is used instead of . and also the script should be made +x), and also i had to add lvm vgchange -aly --ignorelockingfailure to the end of /usr/share/initramfs-tools/scripts/local-top/lvm2. Add nilfs2 to /etc/initramfs-tools/modules. Make a symlink from initrd-3.0.8 to ``initramfs'' in /boot.+Copied ''/lib/firmware/rt2870.bin'' to the newly established system, configured ''/etc/network/interfaces'' to bring up wlan0 for my home wlan automatically. Created a symlink from ''/bin/true'' to ''/usr/sbin/mkfs.nilfs2'' to make the boot happy. 
 + 
 +Initramfs is a bit tricky: a workaround from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649288 is needed (it has a typo where .. is used instead of . and also the script should be made +x), and also you need to pay attention to using ''/dev/mapper/emmc%%--%%lvm-rootfs'' and not ''/dev/emmc-lvm/rootfs'' for the ''root='' kernel command line argument (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612402) or else initramfs won't call ''vgchange -ay automatically''. Add ''nilfs2'' to ''/etc/initramfs-tools/modules'' (if you're using ''MODULES=most''). Make a symlink from ''initrd-3.0.8'' to ''initramfs'' in ''/boot''. You'll also need a custom initramfs-tools addon script to add nilfs_cleanerd to the initramfs or you'll need to start it later from e.g. /etc/rc.local.
  
 The resulting system should be bootable with The resulting system should be bootable with
 <code> <code>
-mmc dev 0; ext2load mmc 0 0x408000 uImage; ext2load mmc 0 0x1408000 initramfs; set bootargs "mem=448M@0M console=ttyS0,115200n8 root=/dev/emmc-lvm/rootfs initrd=0x1408000,0x${filesize}"; bootm 0x408000+mmc dev 0; ext2load mmc 0 0x408000 uImage; ext2load mmc 0 0x1408000 initramfs; setenv bootargs "mem=509M@0M console=tty1 console=ttyS0,115200n8 root=/dev/mapper/emmc--lvm-rootfs zcache initrd=0x1408000,0x${filesize}"; bootm 0x408000
 </code> </code>
  
 +You can hardcode this command line by adding
 +<code>
 +#define CONFIG_BOOTCOMMAND     \
 +       "mmc dev 0; ext2load mmc 0 0x408000 uImage; ext2load mmc 0 0x1408000 initramfs; setenv bootargs \"mem=509M@0M console=tty1 console=ttyS0,115200n8 root=/dev/mapper/emmc--lvm-rootfs zcache initrd=0x1408000,0x${filesize}\"; bootm 0x408000"
 +</code>
 +to ''include/configs/paz00.h'' and recompiling u-boot.
 +
 +If you want to flash uboot as your main bootloader, get the dump of your part2 (DCT) with [[putusb]], use ''bct_dump'' to dump the current config to file, add <code>BootLoader    = u-boot.bin,0x00108000,0x00108000,Complete;</code> in there and create a new image with ''cbootimage''. Then either flash it with ''putusb'' or from a running system by ''echo 0 > /sys/block/mmcblk0boot0/force_ro; dd if=newdct.bin of=/dev/mmcblk0boot0''.
 +
 +I managed to successfully recompile u-boot on the device itself using the Debian hardfloat native toolchain, but i needed this patch to bct_dump:
 +<code>
 +diff --git a/parse.c b/parse.c
 +index 1005ebc..c9153a1 100644
 +--- a/parse.c
 ++++ b/parse.c
 +@@ -913,7 +913,7 @@ void process_config_file(build_image_context *context)
 + {
 +        char buffer[MAX_BUFFER];
 +        int  space = 0;
 +-       char current;
 ++       int current;
 +        u_int8_t c_eol_comment_start = 0; // True after first slash
 +        u_int8_t comment = 0;
 +        u_int8_t string = 0;
 +</code>
  
 +And then be sure to read suckless [[tips_and_tricks]].
debian_uboot.1326627241.txt.gz · Last modified: 2012/01/15 12:34 by paulf