Milkymist Linux cheat sheet

From Milkymist Wiki

Jump to: navigation, search

Contents

[edit] Kernel compilation

 make mrproper
 ARCH=lm32 make defconfig
 ARCH=lm32 make menuconfig
 ARCH=lm32 CROSS_COMPILE=lm32-elf- make simpleImage.milkymist_one

To boot with flterm (slow): flterm --port /dev/ttyUSB0 --kernel arch/lm32/boot/simpleImage.milkymist_one

Warning! "vmlinux" images do not contain the DTS and will not boot.

[edit] Building userspace binaries

The following commands should be used. Using the current lm32-linux toolchain, it's VERY easy to produce broken binaries that crash the board when run.

 lm32-linux-gcc -Wl,-q -mmultiply-enabled -mdivide-enabled -mbarrel-shift-enabled -msign-extend-enabled [...]
 lm32-linux-strip --strip-unneeded --strip-debug --remove-section=.note --remove-section=.comment [...]

These commands are kludgy and are necessary to be compatible with Theobroma's f*ed up FDPIC loader, that we need to fix.

[edit] Building SDL

 ./configure --without-x --enable-video-fbcon --disable-shared --enable-static \
 --prefix=/home/lekernel/sdl-lm32 --disable-esd --disable-alsa \
 --disable-video-directfb --disable-sdl-dlopen --disable-arts --host=lm32-linux \
 --build=i686-pc-linux-gnu
 make
 make install

[edit] Building DoPE (Genode FX) SDL-based demo

Edit lib/sdl/scrdrv.c and hardcode your screen resolution:

 static long set_screen(long width, long height, long depth)
 {
   scr_width  = 640;
   scr_height = 480;
   scr_depth  = 16;
   (...)
   screen = SDL_SetVideoMode(scr_width, scr_height, scr_depth, SDL_SWSURFACE);
 CROSS_PREFIX=lm32-linux- CFLAGS=-I/home/lekernel/sdl-lm32/include\ \
 -mmultiply-enabled\ -mdivide-enabled\ -mbarrel-shift-enabled\ \
 -msign-extend-enabled LDFLAGS=-L/home/lekernel/sdl-lm32/lib make sdl
 
 # linking fails, do it manually:
 cd test/sdl
 lm32-linux-gcc -L/home/lekernel/sdl-lm32/lib -L../../lib/sdl \
 -Wl,--start-group  platform.o test.o disp_img.o settings.o grid.o \
 dopecmd.o colors.o slides.o slideshow.o led.o -ldope -Wl,--end-group -Wl,-q \
 -lSDL -lpthread -o dopetest
 lm32-linux-strip --strip-unneeded --strip-debug --remove-section=.note --remove-section=.comment dopetest

[edit] Forcing gigabit Ethernet cards in 100M mode

If you are using a gigabit PHY (ML401) and you are connected in 1000M mode, Minimac does not support it. If the other side is running Linux, this will put its Ethernet interface in 100M mode:

 ethtool -s eth0 advertise 0x008
Personal tools