NetBSD/Dreamcast: Difference between revisions
(Created page with "'''This article is a WIP. It is subject to rapid change. Beware!''' Before building NetBSD, it's important to undertand [http://www.netbsd.org/releases/release-map.html relea...") |
No edit summary |
||
Line 1: | Line 1: | ||
'''This article is a WIP. It is subject to rapid change. Beware!''' | '''This article is a WIP. It is subject to rapid change. Beware!''' | ||
Before building NetBSD, it's important to undertand [http://www.netbsd.org/releases/release-map.html release types] and pick one of release, stable, or current types. | Before building NetBSD, it's important to undertand [http://www.netbsd.org/releases/release-map.html release types] and pick one of release, stable, or current types. | ||
The example we'll follow here is using is using 10.0-release BETA. | |||
References: [https://www.netbsd.org/docs/guide/en/chap-fetch.html How to fetch NetBSD sources], [https://www.netbsd.org/docs/guide/en/chap-build.html How to build NetBSD] | References: [https://www.netbsd.org/docs/guide/en/chap-fetch.html How to fetch NetBSD sources], [https://www.netbsd.org/docs/guide/en/chap-build.html How to build NetBSD] | ||
Line 7: | Line 9: | ||
==Example== | ==Example== | ||
===Initial folder setup=== | ===Initial folder setup=== | ||
Create a working directory in your home folder and enter it: | Create a working directory in your home folder to hold everything, and enter it: | ||
mkdir ~/netbsd | mkdir ~/netbsd | ||
cd netbsd | cd netbsd | ||
Create additional directories for files: | Create additional directories for files: | ||
mkdir -p | mkdir -p obj toolchain dest release src-tars xsrc-tars | ||
===Download files=== | ===Download files=== | ||
Download from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/src/ and place files into directory src-tars | Download all files from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/src/ and place files into directory src-tars | ||
Download from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/xsrc/ and place files into directory xsrc-tars | Download all files from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/xsrc/ and place files into directory xsrc-tars | ||
===Extract files=== | ===Extract files=== | ||
for file in src-tars/*.tar.gz; do tar -zxf $file | for file in src-tars/*.tar.gz; do tar -zxf $file; done | ||
for file in xsrc-tars/*.tar.gz; do tar -zxf $file | for file in xsrc-tars/*.tar.gz; do tar -zxf $file; done | ||
===Build toolchain=== | ===Build toolchain=== | ||
cd | First, we need to build the cross-compiler to compile SuperH code on your desktop machine. | ||
/build.sh -U -O ~/netbsd/obj -j2 -m dreamcast tools | cd src | ||
(-U is unprivileged, -O is where to store object files, -j is number of threads during build, -m is machine type, tools | ./build.sh -U -O ~/netbsd/obj -T ~/netbsd/toolchain -D ~/netbsd/dest -R ~/netbsd/release -j2 -m dreamcast tools | ||
(-U is unprivileged, -O is where to store object files, -T is your toolchain directory, -D is the directory to place built NetBSD files, -R is the directory to place release files, -j is number of threads during build, -m is machine type, tools indcates you want to build toolchain) | |||
Be sure to adjust -j to the number of threads you want to use depending on how many cores/threads your processor provides. | |||
===Build kernel=== | ===Build kernel=== | ||
Line 44: | Line 41: | ||
~/netbsd/obj/<YOUR_TOOLDIR_NAME>/bin/nbconfig GENERIC | ~/netbsd/obj/<YOUR_TOOLDIR_NAME>/bin/nbconfig GENERIC | ||
Then build dependencies and kernel: | Then build dependencies and kernel: | ||
~/netbsd/ | ~/netbsd/toolchain/bin/nbmake-dreamcast depend | ||
~/netbsd/ | ~/netbsd/toolchain/bin/nbmake-dreamcast | ||
===Build userland=== | ===Build userland=== | ||
cd ~/netbsd | cd ~/netbsd/src | ||
./build.sh -U -u -j2 -O ~/netbsd/obj -m dreamcast release | ./build.sh -U -u -j2 -O ~/netbsd/obj -m dreamcast release | ||
(-u is update-only so we use what we've already built before instead of building another toolchain, and don't forget -j is number of threads during build) | (-u is update-only so we use what we've already built before instead of building another toolchain, and don't forget -j is number of threads during build) | ||
===Build X Server=== | ===Build X Server=== | ||
cd ~/netbsd/src | |||
./build.sh -U -u -O ../../obj -j30 -x -X ../xsrc -m dreamcast release | ./build.sh -U -u -O ../../obj -j30 -x -X ../xsrc -m dreamcast release | ||
(-x is to build the X server, -X is the path of the X source code) | (-x is to build the X server, -X is the path of the X source code) |
Revision as of 01:02, 5 January 2023
This article is a WIP. It is subject to rapid change. Beware!
Before building NetBSD, it's important to undertand release types and pick one of release, stable, or current types.
The example we'll follow here is using is using 10.0-release BETA.
References: How to fetch NetBSD sources, How to build NetBSD
Example
Initial folder setup
Create a working directory in your home folder to hold everything, and enter it:
mkdir ~/netbsd cd netbsd
Create additional directories for files:
mkdir -p obj toolchain dest release src-tars xsrc-tars
Download files
Download all files from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/src/ and place files into directory src-tars
Download all files from ftp.netbsd.org/pub/NetBSD/NetBSD-release-10/tar_files/xsrc/ and place files into directory xsrc-tars
Extract files
for file in src-tars/*.tar.gz; do tar -zxf $file; done for file in xsrc-tars/*.tar.gz; do tar -zxf $file; done
Build toolchain
First, we need to build the cross-compiler to compile SuperH code on your desktop machine.
cd src ./build.sh -U -O ~/netbsd/obj -T ~/netbsd/toolchain -D ~/netbsd/dest -R ~/netbsd/release -j2 -m dreamcast tools
(-U is unprivileged, -O is where to store object files, -T is your toolchain directory, -D is the directory to place built NetBSD files, -R is the directory to place release files, -j is number of threads during build, -m is machine type, tools indcates you want to build toolchain) Be sure to adjust -j to the number of threads you want to use depending on how many cores/threads your processor provides.
Build kernel
cd sys/arch/dreamcast/conf
If your target Dreamcast is modded with 32MB of RAM and you wish to build for that, open std.dreamcast and replace
options IOM_RAM_SIZE=0x01000000 # 16MB
with
options IOM_RAM_SIZE=0x02000000 # 32MB
You can pick GENERIC, GENERIC_MD (memory disk), or G1ATA kernel types, or copy one of them to a new file in the same dir and edit to configure your own kernel options. Run nbconfig on your kernel config, putting in the tooldir you noted before:
~/netbsd/obj/<YOUR_TOOLDIR_NAME>/bin/nbconfig GENERIC
Then build dependencies and kernel:
~/netbsd/toolchain/bin/nbmake-dreamcast depend ~/netbsd/toolchain/bin/nbmake-dreamcast
Build userland
cd ~/netbsd/src ./build.sh -U -u -j2 -O ~/netbsd/obj -m dreamcast release
(-u is update-only so we use what we've already built before instead of building another toolchain, and don't forget -j is number of threads during build)
Build X Server
cd ~/netbsd/src ./build.sh -U -u -O ../../obj -j30 -x -X ../xsrc -m dreamcast release
(-x is to build the X server, -X is the path of the X source code)