Motorola BDM Debugger in DOS QEMU
I have some boards with a Motorola 68332 MCU (which later became Freescale and then NXP) that have a Motorola 68000 core. There is a debugging port on these boards known as "BDM" or "Background Debug Mode" which is very useful.
I have managed to connect to this port using an adapter that can be connected to a standard PC parallel port. There seems to be two versions of this adapter found on the Internet, one using a 74LS74 flip-flop and another using a 74LS76 flip-flop.
I built the 74LS74 variant using a prototype circuit board. To help with this I converted the schematic to another form to show where to connect all the wires using color coding:

Here is a picture of the finished adapter without the logic chips. 14-pin DIP sockets should have been used but I only had 20-pin DIP sockets available:

Here are the signals on the pin header that can be connected to a parallel port on a PC:
|-------|------------|--------| | DB-25 | Signal | Header | |-------|------------|--------| | 17 | STEP_OUT | A | | 10 | PWR_DN/VCC | B | | 14 | RSTOUT | C | | 1 | DSCLK | D | | 15 | FREEZE | E | | 12 | DSO | F | | 16 | DSI | H | | 11+18 | NC/GND | I | |-------|------------|--------|
Here are the signals going to the target BDM port:
|---------|--------| | Signal | Header | |---------|--------| | DSCLK | 4 | | VSS/GND | 5 | | FREEZE | 6 | | RESET | 7 | | DSI | 8 | | VDD/VCC | 9 | | DSO | 10 | |---------|--------|
I have put MS-DOS 6.22 on a QEMU x86 emulator image and then installed the DOS-based "BD32" program from Motorola which can still be found on NXP's pages.
The modern PC I am using has a PCI-express board with a parallel port and enabling passthrough in the QEMU emulator on Linux done by simply passing this on the command line arguments:
-parallel /dev/parport0
It is important to "slow down" the communication speed in BD32 when running on faster hardware, so I have used the setting "1000" which can be configured in the "bd32.cfg" file like so:
lpt1 1000
Here is a screenshot of QEMU running BD32 in DOS:

SPEA Graphiti Painter 3
I have a 2D graphics card from the early 90s typically used for CAD work, manufactured by a now defunct German company named SPEA. The card is the "Graphiti Painter 3". Instead of the regular HD15 VGA connector it uses a DE9 connector.
To be able to connect it to a regular VGA monitor, I made an adapter using the following connection table:
|-------------|-----|-----| | | VGA | DE9 | | Signal | Pin | Pin | |-------------|-----|-----| | Red Video | 1 | 1 | | Green Video | 2 | 2 | | Blue Video | 3 | 3 | | Ground | 5 | 9 | | HSync | 13 | 4 | | VSync | 14 | 5 | |-------------|-----|-----|
I happened to have both connectors available on those cables typically connected to motherboards or SBCs. These can easily be linked together using male pin-header wires. In addition I added a ferrite core which may help with noise:

The only drivers available for the card is for Windows 3.x or certain CAD programs, but here are some graphics generated by the "GDCLOGO.EXE" program run from DOS:

Renesas GCC Toolchains Update
I recently installed Slackware 15.0 on a computer and I noticed that my older script no longer works well. Here is an updated script that compiles GCC version 12 and it's associated tools. The steps are also simplified, mainly because "--enable-maintainer-mode" has been removed when configuring "binutils".
I have tested with the two Renesas target architectures that I use; RX and RL78 so one of these can be selected as the argument for the script. By default the toolchains are installed at /opt/ but this can be changed with the PREFIX variable in the script. Also note that "make" as been set up to run 32 parallel jobs which greatly improves the compilation time if you have enough cores, so adjust this as needed.
Here is the updated script:
#!/bin/bash set -e if [ -z "$1" ]; then echo "Choose a target:" echo "1) rx-elf" echo "2) rl78-elf" exit 0 elif [ "$1" -eq 1 ]; then TARGET="rx-elf" elif [ "$1" -eq 2 ]; then TARGET="rl78-elf" else echo "Unknown target!" exit 1 fi PREFIX="/opt/gcc-${TARGET}/" BUILD_DIR="build-${TARGET}/" export PATH="${PREFIX}bin:$PATH" # 1) Prepare build directories: if [ -d "${BUILD_DIR}" ]; then echo "Old build directory detected, please remove it." exit 1 else mkdir -p "${BUILD_DIR}/binutils" mkdir -p "${BUILD_DIR}/gcc" mkdir -p "${BUILD_DIR}/gdb" mkdir -p "${BUILD_DIR}/newlib" fi # 2) Get sources: if [ ! -d source ]; then mkdir source cd source wget "https://gnuftp.uib.no/gcc/gcc-12.1.0/gcc-12.1.0.tar.xz" wget "https://gnuftp.uib.no/gdb/gdb-12.1.tar.xz" wget "https://gnuftp.uib.no/binutils/binutils-2.38.tar.xz" wget "ftp://sourceware.org/pub/newlib/newlib-4.1.0.tar.gz" tar -xvJf gcc-12.1.0.tar.xz tar -xvJf gdb-12.1.tar.xz tar -xvJf binutils-2.38.tar.xz tar -xvzf newlib-4.1.0.tar.gz cd .. fi # 3) Build binutils: cd "${BUILD_DIR}" cd binutils ../../source/binutils-2.38/configure --target=$TARGET --prefix=$PREFIX --disable-nls --disable-werror make -j32 sudo make install cd .. # 4) Build gcc (step 1): cd gcc ../../source/gcc-12.1.0/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --with-newlib --enable-lto --disable-libstdcxx-pch --disable-nls --disable-werror make -j32 all-gcc sudo make install-gcc cd .. # 5) Build newlib: cd newlib ../../source/newlib-4.1.0/configure --target=$TARGET --prefix=$PREFIX --disable-nls make -j32 sudo make install cd .. # 6) Build gdb: cd gdb ../../source/gdb-12.1/configure --target=$TARGET --prefix=$PREFIX --disable-nls make -j32 sudo make install cd .. # 7) Build gcc (step 2): cd gcc make -j32 sudo make install
XP MCE Keyboard on Raspberry Pi Zero W
I have an old Remote Keyboard for Windows XP Media Center Edition which I have managed to "connect" to a Raspberry Pi Zero W through IR.
To get a IR functionality on the Pi, I followed these instructions and bought a Vishay TSOP38238 IR Receiver. This can be connected (or in my case soldered) directly to the GPIO header of the Pi.
|----------------|---------|---------------| | | TSOP | Raspberry Pi | | Name | 38238 | Zero W Header | |----------------|---|-----|----|----------| | Signal Data | 1 | OUT | 8 | GPIO14 | | Ground | 2 | GND | 6 | Ground | | Supply Voltage | 3 | VS | 1 | 3V3 | |----------------|---|-----|----|----------|

To enable the GPIO pin 14 as IR the following must be set in /boot/config.txt on the Pi:
dtoverlay=gpio-ir,gpio_pin=14
To be able to configure the IR related mappings in the Linux kernel, the "ir-keytable" program must be installed:
sudo apt-get install ir-keytable
This XP MCE keyboard uses both the RC-6 protocol for multimedia buttons and a custom protocol of the regular keys, to enable both add this to /etc/rc.local on the Pi:
ir-keytable -p rc-6 -p mce_kbd
Now, this should have been enough to get it working, but in my case it didn't. I suspect there might be a bug/mismatch in either the Linux kernel itself or with the ir-keytable program. At the time of writing, the Pi is running kernel version 5.10.17+ and ir-keytable version 1.16.3. The problem I observed is that most of the keys on the keyboard does not send a EV_KEY event when monitoring with the "evtest" program, which in turn causes the key to not really work at all. After some debugging and troubleshooting I discovered that the affected keys are missing from the keybit[] array in the input_dev structure for the driver.
My solution to this is to patch the Linux kernel with a custom "ir-mce_kbd-decoder.ko" kernel module. To build this you will of course need the relevant Linux kernel sources for the Pi. Using this script and instructions seems to be the easiest way. The specific kernel version downloaded in my case was commit 3a33f11c48572b9dd0fecac164b3990fc9234da8.
Here is one way to build that single kernel module, assuming you have the kernel sources and the build tools installed:
mkdir ir-mce_kbd-decoder cd ir-mce_kbd-decoder/ cp /home/pi/linux-3a33f11c48572b9dd0fecac164b3990fc9234da8/drivers/media/rc/ir-mce_kbd-decoder.c . cp /home/pi/linux-3a33f11c48572b9dd0fecac164b3990fc9234da8/drivers/media/rc/rc-core-priv.h . echo "obj-m := ir-mce_kbd-decoder.o" > Makefile make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
The ir-mce_kbd-decoder.c file needs to be patched with the following to set those missing bits in the keybit[] array:
--- ir-mce_kbd-decoder.orig 2021-10-17 12:28:27.991142273 +0200 +++ ir-mce_kbd-decoder.c 2021-10-17 13:18:46.908921902 +0200 @@ -360,11 +360,20 @@ static int ir_mce_kbd_register(struct rc_dev *dev) { + int i; struct mce_kbd_dec *mce_kbd = &dev->raw->mce_kbd; timer_setup(&mce_kbd->rx_timeout, mce_kbd_rx_timeout, 0); spin_lock_init(&mce_kbd->keylock); + for (i = 0; i < 256; i++) { + if (kbd_keycodes[i] != KEY_RESERVED) { + __set_bit(kbd_keycodes[i], dev->input_dev->keybit); + } + } + __set_bit(BTN_LEFT, dev->input_dev->keybit); + __set_bit(BTN_RIGHT, dev->input_dev->keybit); + return 0; }
To load the new module temporarily for test, use the following commands:
sudo modprobe -r ir-mce_kbd-decoder sudo insmod ir-mce_kbd-decoder.ko sudo ir-keytable -p rc-6 -p mce_kbd
If it works fine, the module may be copied (and overwritten) to /usr/lib/modules/5.10.17+/kernel/drivers/media/rc/ir-mce_kbd-decoder.ko
Linux System on a Floppy
Referring to my previous project to build a Linux distribution for LOADLIN. It is actually possible to also boot this directly from a 1.44M floppy disk, which can be quite useful. The output from that build should be the Linux kernel "bzImage" and the root filesystem "rootfs.cramfs". I renamed "rootfs.cramfs" to simply "rootfs" to avoid any conflicts with the 8.3 filename format.
SYSLINUX will be used for booting, and it needs "syslinux.cfg" configuration file with the followng contents:
DEFAULT linux LABEL linux KERNEL bzImage APPEND initrd=rootfs
These are the steps to make the floppy disk image:
dd if=/dev/zero of=floppy.img bs=512 count=2880 mkdosfs floppy.img syslinux --install floppy.img mkdir /tmp/floppy mount -o loop floppy.img /tmp/floppy cp bzImage /tmp/floppy/ cp rootfs /tmp/floppy/ cp syslinux.cfg /tmp/floppy/ umount /tmp/floppy
The floppy disk image can be tested in QEMU with:
qemu-system-i386 -fda floppy.img -boot a
Writing the floppy disk image to an actual floppy disk is typically done like so:
dd if=floppy.img of=/dev/fd0 bs=512
For convenience, download the floppy disk image here.
Amiga 500 with the Framemeister
Here is how I connected the Amiga 500 to the Micomsoft XRGB-mini Framemeister to be able to get color graphics on a modern display through HDMI.
The tricky part is getting a "DB23" connector, but I ended up using a regular DB25 connector (made from plastic) and shaving off part of it to make it fit into the Amiga 500. The mini-DIN connector on the Framemeister only accepts composite sync (not separate horizontal and vertical which is more common) but this is available on one of the pins on the Amiga. However, it is a 5V TTL level signal which is a little bit too hot so it's recommended to reduce this with a resistor. I ended up using two 360 Ohm resistors in series at 720 Ohm since that is what I found in stock at the moment. Some diagrams I found online claim that ground should be taken from pin 16 from the Amiga, but this did NOT work for me. Pin 19 which is composite video ground worked fine.
Here is the cable pin out:
|----------------|-------|---------|--------------| | | Amiga | | Framemeister | | Signal | DB23 | | Mini-DIN | |----------------|-------|---------|--------------| | Red | 3 | | 8 | | Green | 4 | | 7 | | Blue | 5 | | 6 | | Composite Sync | 10 | 720 Ohm | 3 | | Ground | 19 | | 4 | |----------------|-------|---------|--------------|
When testing the connections with clip leads I got some "jail bars" (faint traces of vertical lines) on the display, but these more or less disappeared when I soldered everything together properly. Not sure if that was caused by general noise or by poor clip lead cables.
The finished cable connected:

DVB-T USB Stick Playback
I got one of those DVB-T tuners a while ago, in the form of a USB stick, specifically this one:
15a4:1001 Afatech Technologies, Inc. AF9015/AF9035 DVB-T stick
However, it took me many years to finally get this working on Linux after a lot of trial and error. There are two important things I discovered during this time. The first is that MPlayer is quite bad at handling MPEG TS files (or streams). The second is that, at least in my case with this particular stick, the /dev/dvb/adapter0/dvr0 device would not work as advertised.
The solution I ended up with is w_scan for scanning, v4l-utils for tuning and ffmpeg for playback.
Use these steps to scan and generate the channels list:
w_scan --output-initial > channels.conf dvbv5-scan --input-format=CHANNEL --output=dvb_channel.conf channels.conf
Then use these steps for playback:
mkfifo /tmp/dvb.ts dvbv5-zap -c dvb_channel.conf "name-of-the-channel" -o /tmp/dvb.ts & ffplay /tmp/dvb.ts
I found that TV (video and audio) playback works OK, but radio (audio only) will buffer for a very long time before playback starts, so not very convenient.
Toshiba Satellite Pro 410CDT Tweaks
I got hold of an old Toshiba Satellite Pro 410CDT laptop with a Pentium 90MHz processor, which I have cleaned up and refurbished. Since I already got tons of Linux boxes I figured to use this a "DOS Gaming Laptop" instead. It has a Sound Blaster compatible ESS688 sound chipset and a Adlib compatible FM synthesizer, making this perfect for that use.
Important notice! The internal batteries in this had already started to shown signs of leakage, the typical turquoise spots:

I immediately removed the batteries and cleaned up the spots with vinegar. It will now complain about lost CMOS settings every time, but I can live with that for now.
Another challenge is that this laptop has no floppy drive, since that is swappable with a CD-ROM drive that I (only) got instead. To be able to install DOS I used QEMU to install it on a virtual drive, then removed the original hard drive from the laptop and DD'd over the virtual drive to it.
I knew the hard drive was 815394816 bytes, meaning 1592568 512-byte sectors, so a virtual drive can be made like this:
dd if=/dev/zero of=Toshiba_DOS.dd bs=512 count=1592568
QEMU is launched like this:
qemu-system-i386 -drive format=raw,file=Toshiba.dd -cpu pentium -m 32 -monitor stdio -fda DOS_Floppy_1.dd
One can then use the QEMU monitor to change and eject virtual floppies like so:
change floppy0 DOS_Floppy_2.dd change floppy0 DOS_Floppy_3.dd eject floppy0
Afterwards it is also possible to loopback mount he virtual hard drive to put more stuff on there, like tools and games. Since the first partition starts at sector 63, an offset of 32256 bytes must be used:
sudo mount -o loop,offset=32256 Toshiba_DOS.dd /mnt/loop/
I used one of those USB-to-IDE adapter and the virtual hard drive is typically DD'd back just like this:
dd if=Toshiba_DOS.dd of=/dev/sdd bs=512 status=progress
Finally, for reference, here is the "AUTOEXEC.BAT" file I ended up using for the laptop:
C:\DOS\SMARTDRV.EXE /X @ECHO OFF PROMPT $p$g PATH C:\DOS;C:\VI;C:\MSKERMIT;C:\PKZIP SET TEMP=C:\DOS MODE CON CODEPAGE PREPARE=((850) C:\DOS\EGA.CPI) MODE CON CODEPAGE SELECT=850 LOADHIGH=C:\DOS\KEYB NO,,C:\DOS\KEYBOARD.SYS LOADHIGH=C:\DOS\DOSKEY.COM LOADHIGH=C:\DRIVERS\MOUSE.COM LOADHIGH=C:\DRIVERS\MSCDEX.EXE /D:MSCD001 /L:D C:\ESSUTIL\ESSVOL.EXE /V:8 /L:8 /W:8 /M:0 /C:8 /S:8 SET BLASTER=A220 I7 D1 T6 P330 H5
And the "CONFIG.SYS" file:
DEVICE=C:\DOS\HIMEM.SYS DEVICE=C:\DOS\EMM386.EXE NOEMS DOS=HIGH,UMB COUNTRY=047,,C:\DOS\COUNTRY.SYS DEVICEHIGH=C:\DOS\SETVER.EXE DEVICEHIGH=C:\DOS\DISPLAY.SYS CON=(EGA,,1) FILES=50 BUFFERS=10,0 DEVICEHIGH=C:\DRIVERS\OAKCDROM.SYS /D:MSCD001
Compaq Deskpro XL 5133 with Red Hat 5.2
I decided to install the classic Red Hat Linux 5.2 distribution on my classic Compaq Deskpro XL 5133 machine. The 5.2 version is one of the more well known from the late 90's, and several others have used this to experience the past. It is using the 2.0.36 version of the Linux kernel.
Before any of the SW installation could take place, the on-board battery had to be changed to be able to keep the system configuration intact. Luckily the battery is a Lithium type, so it doesn't leak, but it was soldered in place. I changed it with a CR2032 battery holder, which works fine.

After configuring the system with the special Compaq floppy disks (there is no BIOS setup menu!) I was able to install Red Hat 5.2 using the CD-ROM without any trouble. The machine has a Matrox Millennium VGA card which works fine in X Windows and a on-board AMD PCnet32 Ethernet controller working out of the box.
The troublesome part was getting the audio to work, which is classified as "Compaq Deskpro XL Business Audio", but is in reality a "Microsoft Sound System" compatible chip of the AD1847 type:

When playing any audio, it would stutter and the following error would appear:
Sound: DMA (output) timed out - IRQ/DRQ config error?
I tried all kinds of different IRQ and DMA settings, but to no avail. To troubleshoot further I setup a QEMU emulated environment also with Red Hat 5.2 to be able to quickly recompile the ad1848.o module device driver.
I figured out that in vanilla Linux 2.0.36 the sound drivers are not modularized, and Red Hat had actually applied a patch to modularize them. So this exact setup had to be re-recreated. The original sources can be found here as "kernel-2.0.36-0.7.src.rpm". But these still needs to be patched, where I did the following:
tar -xvzf linux-2.0.35.tar.gz gunzip 2.0.36-pre-patch-14.gz gunzip sound.diff.gz patch -p0 < 2.0.36-pre-patch-14 patch -p0 < sound.diff mv linux linux-2.0.36 patch -p0 < kernel-2.0.36-sound-new.patch cp kernel-2.0.36-i386.config linux-2.0.36/.config
Yes, the original sources is actually Linux 2.0.35, but with a patch to bump it up to 2.0.36!
After enabling debugging flags, I eventually found out that this stock driver is detecting the audio chip wrongly as a "OPTi 82C930" chip, which in turn causes the IRQ status to be read from the wrong register!
Here is my own patch to fix this problem and enabling the debug:
--- ad1848.c.orig 2020-08-30 12:42:45.362175159 +0200 +++ ad1848.c 2020-08-30 12:42:52.142175232 +0200 @@ -37,6 +37,9 @@ #include "soundmodule.h" +#define DEBUGXL +#define DDB + #define DEB(x) #define DEB1(x) #include "sound_config.h" @@ -1532,10 +1535,19 @@ { if ((tmp1 = ad_read(devc, i)) != (tmp2 = ad_read(devc, i + 16))) { - DDB(printk("ad1848 detect step F(%d/%x/%x) - OPTi chip???\n", i, tmp1, tmp2)); - if (!ad1847_flag) - optiC930 = 1; - break; + if (deskpro_xl) + { + DDB(printk("Deskpro XL, so assuming AD1847\n")); + ad1847_flag = 1; + break; + } + else + { + DDB(printk("ad1848 detect step F(%d/%x/%x) - OPTi chip???\n", i, tmp1, tmp2)); + if (!ad1847_flag) + optiC930 = 1; + break; + } } } @@ -1688,7 +1700,10 @@ } else { - devc->model = MD_4231; + if (! deskpro_xl) + { + devc->model = MD_4231; + } } } } @@ -1708,6 +1723,7 @@ if (devc->model == MD_1848 && ad1847_flag) devc->chip_name = "AD1847"; + DDB(printk("ad1848_detect() - '%s' (%d)\n", devc->chip_name, devc->model)); return 1; }
Or you can download my recompiled version here.
The /etc/conf.modules section ended up being like this for the driver:
alias sound ad1848 alias midi opl3 options opl3 io=0x388 options ad1848 io=0x530 irq=9 dma=1,0 type=2 deskpro_xl=1

Linux Distribution for LOADLIN
This is a similar project to the Linux Distribution for 386SX but this with some different goals. Most importantly to boot it with LOADLIN directly from DOS and keeping the root filesystem in RAM using Cramfs. In addition, I wanted to have functioning SLIP support.
I ended up using these specific software versions:
* linux-2.4.37.11
* gcc-3.4.6
* busybox-1.19.4
* uClibc-0.9.33.2
* binutils-2.32
Get the necessary scripts, configuration and patches here to make it yourself. Or just get the completed kernel and root filesystem here.
For easy reference, here is the script to compile everything:
#!/bin/bash set -e TARGET="i386-linux-uclibc" PREFIX="${HOME}/opt/gcc-${TARGET}/" SYSROOT="${PREFIX}/${TARGET}/sysroot" GCC_SRC="gcc-3.4.6.tar.bz2" BINUTILS_SRC="binutils-2.32.tar.xz" UCLIBC_SRC="uClibc-0.9.33.2.tar.xz" LINUX_SRC="linux-2.4.37.11.tar.xz" BUSYBOX_SRC="busybox-1.19.4.tar.bz2" export PATH="${PREFIX}bin:$PATH" # Prepare Prefix and System Root if [ -d "$SYSROOT" ]; then echo "Old system root directory detected, please remove it." exit 1 else mkdir -p "$SYSROOT/usr" fi # Prepare Build Directories: if [ -d build ]; then echo "Old build directory detected, please remove it." exit 1 else mkdir -p build/binutils mkdir -p build/gcc-stage1 mkdir -p build/gcc-stage2 mkdir -p build/uclibc mkdir -p build/linux mkdir -p build/busybox fi # Unpack Sources: if [ -d source ]; then cd source tar -xvjf "$GCC_SRC" tar -xvJf "$BINUTILS_SRC" tar -xvJf "$UCLIBC_SRC" -C ../build/uclibc tar -xvJf "$LINUX_SRC" -C ../build/linux tar -xvjf "$BUSYBOX_SRC" -C ../build/busybox cd - else echo "No source directory, please download sources." exit 1 fi # Patch gcc-3.4.6: cd "source/gcc-3.4.6/gcc/config/i386/" if ! fgrep --silent "inhibit_libc" linux.h; then patch -p 0 < ../../../../../gcc-3.4.6-linux.h.patch fi cd - # Patch linux-2.4.37.11: cd "build/linux/linux-2.4.37.11/include/linux/" if ! fgrep --silent "<linux/types.h>" filter.h; then patch -p 0 < ../../../../../linux-2.4.37.11-filter.h.patch fi cd - # Install Linux 2.4 Headers: cd build/linux/linux-* make ARCH=i386 mrproper make ARCH=i386 include/linux/version.h make ARCH=i386 symlinks mkdir -p "$SYSROOT/usr/include/asm" cp -v -R -H include/asm "$SYSROOT/usr/include" cp -v -R include/asm-generic "$SYSROOT/usr/include" cp -v -R include/linux "$SYSROOT/usr/include" touch "${SYSROOT}/usr/include/linux/autoconf.h" cd - # Build binutils: cd build/binutils ../../source/binutils-*/configure --target="$TARGET" --prefix="$PREFIX" --with-sysroot="$SYSROOT" --disable-werror --enable-languages=c,c++ --enable-shared --without-newlib --disable-libgomp --enable-fast-install=N/A make all-{binutils,gas,ld} make install-{binutils,ld,gas} cd - # Build Stage 1 GCC3: cd build/gcc-stage1 ../../source/gcc-3*/configure --target="$TARGET" --prefix="$PREFIX" --with-sysroot="$SYSROOT" --with-cpu=i386 --disable-fast-install --disable-werror --disable-multilib --enable-languages=c --without-headers --disable-shared --disable-libssp --disable-libmudflap --with-newlib --disable-c99 --disable-libgomp --disable-threads make all-gcc make install-gcc cd - # Install uClibc Headers: cd build/uclibc/uClibc-* cp -v ../../../config-uclibc .config sed -i -e "s%KERNEL_HEADERS=.*%KERNEL_HEADERS=\"$SYSROOT/usr/include/\"%" .config make ARCH=i386 PREFIX="$SYSROOT" install_headers cd - # Build uClibc: cd build/uclibc/uClibc-* make ARCH=i386 PREFIX="$SYSROOT" make ARCH=i386 PREFIX="$SYSROOT" install cd - # Build Stage 2 GCC3: cd build/gcc-stage2 ../../source/gcc-3*/configure --target="$TARGET" --prefix="$PREFIX" --with-sysroot="$SYSROOT" --with-cpu=i386 --enable-fast-install=N/A --disable-werror --enable-languages=c,c++ --disable-shared --without-newlib --disable-libgomp --disable-threads make all-gcc make install-gcc cd - # Build Linux 2.4: cd build/linux/linux-* cp -v ../../../config-linux .config make ARCH=i386 CROSS_COMPILE=i386-linux-uclibc- oldconfig make ARCH=i386 CROSS_COMPILE=i386-linux-uclibc- dep make ARCH=i386 CROSS_COMPILE=i386-linux-uclibc- bzImage cd - # Build Busybox: cd build/busybox/busybox-* cp -v ../../../config-busybox .config make CROSS_COMPILE=i386-linux-uclibc- cd -
And here is the script to make the root filesystem:
#!/bin/bash set -e ROOTFS="`pwd`/rootfs/" TARGET="i386-linux-uclibc" PREFIX="${HOME}/opt/gcc-${TARGET}/" SYSROOT="${PREFIX}/${TARGET}/sysroot" export PATH="${PREFIX}bin:$PATH" if [ -d "$ROOTFS" ]; then echo "Old root FS directory detected, please remove it." exit 1 fi mkdir -p "$ROOTFS" # Install Busybox: cd build/busybox/busybox-* make CROSS_COMPILE=i386-linux-uclibc- CONFIG_PREFIX="$ROOTFS" install cd - # Create some essential directories cd "$ROOTFS" mkdir etc mkdir etc/init.d mkdir lib mkdir proc mkdir sys mkdir tmp mkdir root mkdir dev mkdir dev/pts cd - # Initial rc.S: cat > rcS <<EOF #!/bin/sh mount -t proc /proc /proc mount -t devpts /dev/pts /dev/pts mount -t tmpfs /tmp /tmp loadkmap < /etc/no-latin1.bmap hostname busybox EOF mv -v rcS "$ROOTFS/etc/init.d/" # Initial inittab: cat > inittab <<EOF ::sysinit:/etc/init.d/rcS ::respawn:-/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r ::restart:/sbin/init EOF mv -v inittab "$ROOTFS/etc/" # Copy this system's keymap: loadkeys -b /usr/share/kbd/keymaps/i386/qwerty/no-latin1.map.gz > "$ROOTFS/etc/no-latin1.bmap" # Make everything root user: sudo chown -R root:root "$ROOTFS" # Create some critical devices: sudo mknod "$ROOTFS/dev/tty" c 5 0 sudo mknod "$ROOTFS/dev/console" c 5 1 sudo mknod -m 0666 "$ROOTFS/dev/null" c 1 3 # Create some useful devices: sudo mknod "$ROOTFS/dev/rtc" c 10 135 sudo mknod "$ROOTFS/dev/tty0" c 4 0 sudo mknod "$ROOTFS/dev/tty1" c 4 1 sudo mknod "$ROOTFS/dev/tty2" c 4 2 sudo mknod "$ROOTFS/dev/tty3" c 4 3 sudo mknod "$ROOTFS/dev/ttyS0" c 4 64 sudo mknod "$ROOTFS/dev/ttyS1" c 4 65 sudo mknod "$ROOTFS/dev/fd0" b 2 0 sudo mknod "$ROOTFS/dev/fd1" b 2 1 sudo mknod "$ROOTFS/dev/root" b 4 0 sudo mknod "$ROOTFS/dev/lp0" c 6 0 # SetUID on busybox binary: sudo chmod +s "$ROOTFS/bin/busybox" # Make rcS executable: sudo chmod +x "$ROOTFS/etc/init.d/rcS" # Make Compressed ROM archive: mkfs.cramfs rootfs rootfs.cramfs
Instead of using LOADLIN, it is actually easy to start this with QEMU as well, like so:
qemu-system-i386 -kernel bzImage -initrd rootfs.cramfs
Older articles