2013-04-01

Want to to free your SD card? Or put u-boot.imx to the internal flash.

No problem, copy u-boot.imx into some msdosfs slice, attach it, boot up to U-Boot prompt and do that:


ide reset
fatload ide 0:1 0x91000000 u-boot.imx
sf probe
sf erase 0x00000 0x70000
sf write 0x91000000 0x400 0x60000


That one for FAT32 on first partition of internal SSD drive.

If you want to do that from usb flash stick, change ide to usb.

Every command have internal help. So if you forgot something, type
help
for full list
help cmd
for help about that cmd only.

Commands like sf have subcommand, so you can type
sf
and get list and format for subcommands.

P.S. Don't forget to switch back DIP switch (boot select) See here.

2013-02-23

"I hate to wait so much time while ports compiling" or easy Xorg on Efika MX with FreeBSD

Hope you already done everything I wrote in Easy way to do it (try FreeBSD on Efika MX), and now many lazy guys will say "How to start Xorg here without any movements?" 
Short answer will be "I'm not a Wizard and I don't have magic stick" :)
But I really have few hints for you on how to done it easy and fast.

We need to install packages and Xorg.conf.

Script for packages


#!/bin/sh

export PACKAGESITE=http://people.freebsd.org/~ray/armv6-pkgng/
export ASSUME_ALWAYS_YES=yes

# Install pkgng
pkg
# Update repo (index of packages)
pkg update -f
# Install pre-dependency (dunno why that both ordered wrong, but )
pkg install freetype2 inputproto
# Install everything we need (not we, but need)
pkg install gmake intltool libXaw libXfont libdrm libfontenc libiconv \
    libpciaccess libpthread-stubs libxcb libxkbfile pixman twm xauth \
    xcb-proto xclock xf86-input-keyboard xf86-input-mouse \
    xf86-video-fbdev xf86-video-scfb xinit xorg-fonts xterm

Now run it
sh script_name.sh


Xorg.conf

Location /etc/X11/xorg.conf
------------------------------------------------------------------------------------------------------------------
Section "Files"
EndSection

Section "Module"
    Load        "dbe"
    # We can't do that yet, so disable for now.
    Disable    "dri"
    Disable    "dri2"
    Disable    "glx"
    SubSection  "extmod"
        Option  "omit xfree86-dga"
    EndSubSection
EndSection

Section "ServerFlags"
    Option    "AIGLX"        "false"
    Option    "NoAccel"    "True"
    Option    "NoDRI"        "True"
    Option    "DRI"        "False"
    Option    "DRI2"        "False"
EndSection

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "auto"
    Option      "Device"        "/dev/sysmouse"
EndSection

Section "Monitor"
    Identifier  "Monitor"
    Mode "1024x600"
        DotClock        25.175
        HTimings        1024 1048 1148 1200
        VTimings        600 610 620 700
    EndMode
EndSection

Section "Device"
    Identifier  "Generic FB"
    Driver      "scfb"
    Option    "NoAccel"    "True"
EndSection

Section "Screen"
    Identifier  "Screen"
    Device      "Generic FB"
    Monitor     "Monitor"
    DefaultDepth 16
    SubSection "Display"
        Depth           16
        Modes           "1024x600"
    EndSubsection
EndSection

Section "ServerLayout"
    Identifier  "layout"
    Screen      0 "Screen" 0 0
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection
------------------------------------------------------------------------------------------------------------------

Testing :)

Now run:
startx
and you will have:
  1. Best window manager - twm
  2. Best X clock - xclock
  3. and 3 best xterms
Standard startx set :)

2013-02-22

pkgng-ing everything you done some time ago

Just to not forget :)
If you playing with new platform, build many ports and leave it not cleaned, some time later you may find it interesting to share that with other good guys or just to setup same on a different machine.

So how to done that:
1. Find what you build before:
find /usr/ports -name work | sed 's#/usr/ports/##; s#/work##' > ~/work.list

you will get list in format category/name.

2. Load it into shell variable (for /bin/sh)
LIST=$(cat ~/work.list)

3. create shell function (of course you can done it in one command, but it is unreadable)
create ()
{
        pkg=$1; # Only one arg - category/name

        echo "Make package ${pkg}";
        # cd to port dir
        cd "/usr/ports/${pkg}";

        # Remove install and package markers
        rm work/.install* work/.package*;

        # call make to do install and package (it will do build if it not done also)
        make FORCE_PKG_REGISTER=yes package;
}


4. Run over list
for pkg in ${LIST} ; do
        NAME=${pkg##*/};
        # Check if we have such package
        if [ ! -f "/usr/ports/packages/Latest/${NAME}.txz" ]; then
                create "${pkg}";
        fi;
done

5. Time to drink something (coffee, beer, vodka, etc.)

P.S. If you have not broken pkgng database, you may try to just run:
pkg create -a

:)

Good luck with pkgng-ing

2013-02-18

Easy way to do it (try FreeBSD on Efika MX)


I wrote script, just to make your life a bit easy, in case you want to try FreeBSD on Genesi Efika MX of course :)
MAKE_EFIKA_MX.sh                    - script itself
__MAKE_EFIKA_MX_IMAGE.sh    - wrapper to run script on md(memory disk) devices instead of real SD and USB flash.

And here is results:
Efika_MX_SD_card.img.xz        - image for SD (just only U-Boot, but already aligned by 0x1000 for IMX format)
Efika_MX_USB_Flash.img.xz    - full world for 2G+ USB stick (surprisingly small, only 71M in xz)

To make efika mx bootable USB flash (with U-Boot on SD) just run:
./MAKE_EFIKA_MX.sh da0 da4 smartbook

where
    da0    - SD dev
    da4    - USB dev
    smartbook - model (smartbook/smarttop, both have only different
U-Boot binaries)

Let me know anything you have done with that :)

Many thanks to Genesi for hardware and help!
And Genesi's Powerdeveloper program!

2013-01-18

2013-01-13

Hope you like it :-)

XOrg on Efika MX Smartbook.


Xpdf with huge i.MX51 development manual (22MB)

I hope you already run FreeBSD on your Efika MX Smartbook :) (read here

So, you have FreeBSD on Smartbook and want to run Xorg.
You need two not standard items:
1. Patched Xorg port. Extract it over original /usr/ports/x11-servers/xorg-server.
2. Port of new xf86-video-scfb driver. Extract it into /usr/ports/x11-drivers/

Then build/install both.
cd /usr/ports/..../
make install clean

It will take some time, maybe next morning you will find that some port from dependency list asking you some question and it was happen right after you went to sleep last night :))))
To not have such situation, better to read man ports first about BATCH and INTERACTIVE modes. It's good idea to build xinit port also, since project branch still not ready to test ARM EABI and with old ARM ABI I found problems with build gobject-introspection which makes impossible to build many parts of Gnome (maybe not only Gnome apps). IIRC, same happen with KDE/Qt parts. So, don't be so fast, and try xinit with xterm and xclock :)
And xpdf :) (See image in header).

What next?! Ahh! Yeah, /etc/X11/xorg.conf, I make small Xorg.conf, because Xorg fail to autodetect things (maybe it's already fixed by some my fix, but I've not checked it again yet).

Section "Files"
EndSection

Section "Module"
    Load        "dbe"
    Disable    "dri"
    Disable    "dri2"
    Disable    "glx"
    SubSection  "extmod"
        Option  "omit xfree86-dga"
    EndSubSection
EndSection

Section "ServerFlags"
    Option    "AIGLX"        "false"
    Option    "NoAccel"    "True"
    Option    "NoDRI"        "True"
    Option    "DRI"        "False"
    Option    "DRI2"        "False"
EndSection

Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "auto"
    Option      "Device"        "/dev/sysmouse"
EndSection

Section "Monitor"
    Identifier  "Monitor"
    Mode "1024x600"
        DotClock        25.175
        HTimings        1024 1048 1148 1200
        VTimings        600 610 620 700
    EndMode
EndSection

Section "Device"
    Identifier  "Generic FB"
    Driver      "scfb"
    Option    "NoAccel"    "True"
EndSection

Section "Screen"
    Identifier  "Screen"
    Device      "Generic FB"
    Monitor     "Monitor"
    DefaultDepth 16
    SubSection "Display"
        Depth           16
        Modes           "1024x600"
    EndSubsection
EndSection

Section "ServerLayout"
    Identifier  "layout"
    Screen      0 "Screen" 0 0
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Now just do:
startx

Done!

It will be very nice if you will get everything working after first attempt :)
Anyway, glad to hear any opinions! (ray@... )

Thank you very much!


2012-12-27

Your first run of FreeBSD on Genesi Efika MX Smartbook

Hi everyone!

Think you already know, what framebuffer console already works on Genesi Efika MX Smartbook.

So how to done that?

Begin

Now, since SD/MMC support still a bit broken we need not only SD card, but USB flash stick also. So:
1. SD card;
2. USB flash stick;
3. FreeBSD system :)
4. Genesi Efika MX Smartbook :)
5. and U-Boot's mkimage utility;

mkimage utility

Extract, make and install U-Boot mkimage utility.

fetch http://people.freebsd.org/~ray/u-boot.new.tar.gz
tar xvzf u-boot.new.tar.gz
cd u-boot.new
make install

If I remember correct,it will install uboot_mkimage into /usr/local/bin/, otherwise rename it by hand
mv /usr/local/bin/mkimage /usr/local/bin/uboot_mkimage 
I don't think mkimage is good name for such special utility :) 

Build

Get sources

Get your own copy of project files:


mkdir efika_mx
cd efika_mx
svn co svn://svn.freebsd.org/base/projects/efika_mx/

Prepare USB Flash stick

Better to have to slices (while we still not have UFS support in U-Boot)
  1. for small MSDOS filesystem, we will store kernel here
  2. for UFS rootfs
for example, you have empty USB Flash stick as /dev/da0, then do:

# Create MBR partitioning scheme
gpart create -s MBR da0

# Create 128MB fat32 slice
gpart add -t fat32 -i 1 -s 128m da0

# Create space for swap (better at least 1G)
gpart add -t freebsd -i 2 -s 512M da0

# Anything left for FreeBSD filesystems
gpart add -t freebsd -i 3 da0

# BSD partitioning
gpart create -s BSD da0s3

# Give everything to rootfs
gpart add -t freebsd-ufs da0s3

# Make filesystems
newfs /dev/da0s3a
newfs -t msdosfs /dev/da0s1

# Done, now mount filesystems
mount -t msdosfs /dev/da0s1 /mnt/imx/dos
mount -t ufs /dev/da0s3a /mnt/imx/ufs

Don't forget to change mount point in kernel config (sys/arm/conf/EFIKA_MX) to ufs:da0s3a.

Script to build everything

Set environment variables:
SRCDIR - path to your copy of project;
OBJDIR - place to keep object files and other stuff for build, better to have it in your home and run build as regular user (not root) then you will not break your system by wrong install.
TFTPDIR - place to where kernel will be copied, so U-Boot will be able to load it by tftp.
DSTDIR - where to install world, can be NFS directory or root of mounted USB flash

And mandatory:
TARGET - architecture for which we will build everthing
TARGET_ARCH - architecture subtype
TARGET_CPUTYPE - CPU type
KERNCONF - file name of kernel configuration


Example, as build script:

#!/bin/sh

SRCDIR=/usr/home/ray/work/FreeBSD/Projects/Efika_MX/src/efika_mx/
OBJDIR=/usr/obj/
TFTPDIR="/tftpboot/efika_mx/"
DSTDIR=${OBJDIR}/ARMV6

TARGET=arm
TARGET_ARCH=armv6
TARGET_CPUTYPE=armv6
KERNCONF=EFIKA_MX

KERNOBJDIR="${OBJDIR}/${TARGET}.${TARGET_ARCH}/${SRCDIR}/sys/${KERNCONF}"

export TARGET
export TARGET_ARCH
export TARGET_CPUTYPE
# Hope someday somebody fix aicasm to not break builds for special case :)
export WITHOUT_AICASM=yes

echo -n "Start at "
date


# Uncomment next line if don't want to rebuild everithing
#FLAGS=-DNO_CLEAN

make KERNCONF=${KERNCONF} ${FLAGS} toolchain || exit 1
make KERNCONF=${KERNCONF} ${FLAGS} buildworld || exit 1
make KERNCONF=${KERNCONF} ${FLAGS} buildkernel || exit 1
# Kernel we will install into separate place (installkernel)
make DESTDIR=${DSTDIR} ${FLAGS} installworld || exit 1
make DESTDIR=${DSTDIR} ${FLAGS} distribution || exit 1

uboot_mkimage -A ARM -O Linux -T kernel -C none -a 0x90100000 -e 0x90100100 -n "FreeBSD kernel" -d "${KERNOBJDIR}/kernel" "${TFTPDIR}/kernel.uboot"

echo -n "Done at "
date
-------------8<-------------------------------------------------------------

Now you can just run the script:
sh ./script_file_name

Don't forget to enable watchdogd and virtual terminals.

First:
echo 'watchdogd_enable="YES"' >> ${WHERE_IS_NEW_ROOTFS_MOUNTED}/etc/rc.conf

For second one, open ${WHERE_IS_NEW_ROOTFS_MOUNTED}/etc/ttys in your editor and replace "off" with "on" on lines with /dev/ttyv0 - ttyv7

Without first devices will reset after 127 seconds lefts after "run bsd" command in U-Boot.
Without second one - you will not get login prompt.

Prepare card


  1. Fetch U-Boot image here 
  2. Insert unused SD card
  3. WARNING! Check your /dev/da devices first, to not damage other cards, of SCSI HDD, or USB flash stick. Assuming your unused SD is /dev/da0 
  4. dd if=u-boot_efiks_mx_smartbook.imx of=/dev/da0 bs=1k seek=1 conv=sync 
  5. Invert DIP switch under keyboard (1-OFF, 2-OFF, 3-OFF, 4-ON)
  6. Power up device (Press power button)

    \ smarttopsmartbook
DIP normOn|On|On|OffOn|On|On|Off
DIP sd.imxOff|Off|Off|OffOff|Off|Off|On
Linku-boot_st.imxu-boot_sb.imx


If you connect ASIX based USB Ethernet adapter and type "run bsd",
U-Boot will try to assign IP 192.168.10.85 to axe0 and ask
efika_mx/kernel.uboot by TFTP on host 192.168.10.90.


[0] http://people.freebsd.org/~ray/u-boot_efika_mx_smartbook.imx

Currently I use SD card to only boot machine with U-Boot. 

Boot

So after power up, U-Boot will stop and show you command prompt. If you prepare tftp boot for kernel as I say in previous paragraph, then just type:

run bsd

this line do:

setenv ipaddr 192.168.10.85
setenv serverip 192.168.10.85
tftp 0x91000000 efika_mx/kernel.uboot
mw.w 0x73f98000 0xff3c 1
bootm 0x91000000

two top lines already in environment, so they not executed actually.
tftp ... load firnel.uboot from dir efika_mx on tftp server
mw.w ... is simple command for write word (4bytes) into memory, with that args it's enable Watchdog. Watchdog will reset board after 128 seconds, if device will hang or not start watchdogd. So you have two ways: 1) start kernel with
tftp 0x91000000 efika_mx/kernel.uboot ; bootm 0x91000000
or enable watchdogd

That U-Boot binary  also have fat command. This command do:
fat=ide reset
fatload ide 0:1 0x91000000 kernel.uboot
bootm 0x91000000
Reset/init PATA controller, load kernel.uboot from first slice which have FAT fs and boot it.

Overview of boot process


1. If DIP switch set as 1-OFF, 2-OFF, 3-OFF, 4-ON, system try to load image from SD card at offset 1024 bytes (think if we will prepare USB flash same way it will boot also, but not checked it yet) to memory at address 0x97800000.
2. execute program at address 0x97800000. (We get U-Boot prompt)
3. We run U-Boot command to start kernel.
4. If kernel found mountpoint specified in option ROOTDEVNAME of kernel config file, it continue to boot. Otherwise stops and ask you to specify it manually (not sure usb keyboard works here or not). Anyway, better to compile kernel to mount from flash drive "da0s1a" (or "da0s2a" if you make FAT slice first). But then rebuild with "ada0s2a", to get kernel which will mount internal SSD drive.

Ok, enough for now :)
Let me know, if I forget something important.
Mail me ray@...








Поиск по этому блогу

Загрузка...

Readers