Milkymist Linux cheat sheet
From Milkymist Wiki
Contents |
[edit] Kernel compilation
GCC >= 4.4 only! GCC 3 generates corrupt code and the resulting kernel will not boot.
make mrproper ARCH=lm32 make ml401_defconfig ARCH=lm32 make menuconfig ARCH=lm32 CROSS_COMPILE=lm32-elf- make vmlinux lm32-elf-objcopy -O binary vmlinux vmlinux.bin
To boot with flterm: flterm --port /dev/ttyUSB0 --kernel vmlinux.bin --kernel-adr 0x40000000
[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

