xref: /minix3/releasetools/x86_ramimage.sh (revision a7a79fa1f56459d4581874d33595a897559e1cda)
1 *a7a79fa1SJean-Baptiste Boric#!/usr/bin/env bash
2 *a7a79fa1SJean-Baptiste Boricset -e
3 *a7a79fa1SJean-Baptiste Boric
4 *a7a79fa1SJean-Baptiste Boric#
5 *a7a79fa1SJean-Baptiste Boric# This script creates a bootable image and should at some point in the future
6 *a7a79fa1SJean-Baptiste Boric# be replaced by the proper NetBSD infrastructure.
7 *a7a79fa1SJean-Baptiste Boric#
8 *a7a79fa1SJean-Baptiste Boric
9 *a7a79fa1SJean-Baptiste Boric: ${ARCH=i386}
10 *a7a79fa1SJean-Baptiste Boric: ${OBJ=../obj.${ARCH}}
11 *a7a79fa1SJean-Baptiste Boric: ${TOOLCHAIN_TRIPLET=i586-elf32-minix-}
12 *a7a79fa1SJean-Baptiste Boric: ${BUILDSH=build.sh}
13 *a7a79fa1SJean-Baptiste Boric
14 *a7a79fa1SJean-Baptiste Boric: ${SETS="minix-base"}
15 *a7a79fa1SJean-Baptiste Boric
16 *a7a79fa1SJean-Baptiste Boricif [ ! -f ${BUILDSH} ]
17 *a7a79fa1SJean-Baptiste Boricthen
18 *a7a79fa1SJean-Baptiste Boric	echo "Please invoke me from the root source dir, where ${BUILDSH} is."
19 *a7a79fa1SJean-Baptiste Boric	exit 1
20 *a7a79fa1SJean-Baptiste Boricfi
21 *a7a79fa1SJean-Baptiste Boric
22 *a7a79fa1SJean-Baptiste Boric#: ${RAMDISK_SIZE=$(( 200*(2**20) ))}
23 *a7a79fa1SJean-Baptiste Boric
24 *a7a79fa1SJean-Baptiste Boric# set up disk creation environment
25 *a7a79fa1SJean-Baptiste Boric. releasetools/image.defaults
26 *a7a79fa1SJean-Baptiste Boric. releasetools/image.functions
27 *a7a79fa1SJean-Baptiste Boric
28 *a7a79fa1SJean-Baptiste Boric# where the kernel & boot modules will be
29 *a7a79fa1SJean-Baptiste BoricMODDIR=${DESTDIR}/boot/minix/.temp
30 *a7a79fa1SJean-Baptiste Boric
31 *a7a79fa1SJean-Baptiste Boricecho "Building work directory..."
32 *a7a79fa1SJean-Baptiste Boricbuild_workdir "$SETS"
33 *a7a79fa1SJean-Baptiste Boric
34 *a7a79fa1SJean-Baptiste Boricecho "Adding extra files..."
35 *a7a79fa1SJean-Baptiste Boricworkdir_add_ramdisk_files
36 *a7a79fa1SJean-Baptiste Boric
37 *a7a79fa1SJean-Baptiste Boric# set correct message of the day (log in and install tip)
38 *a7a79fa1SJean-Baptiste Boriccp releasetools/release/ramdisk/etc/issue ${ROOT_DIR}/etc/issue
39 *a7a79fa1SJean-Baptiste Boricadd_file_spec "etc/issue" extra.cdfiles
40 *a7a79fa1SJean-Baptiste Boric
41 *a7a79fa1SJean-Baptiste Boricecho "Bundling packages..."
42 *a7a79fa1SJean-Baptiste Boricbundle_packages "$BUNDLE_PACKAGES"
43 *a7a79fa1SJean-Baptiste Boric
44 *a7a79fa1SJean-Baptiste Boricecho "Creating specification files..."
45 *a7a79fa1SJean-Baptiste Boriccreate_input_spec
46 *a7a79fa1SJean-Baptiste Boriccreate_protos
47 *a7a79fa1SJean-Baptiste Boric
48 *a7a79fa1SJean-Baptiste Boricecho "Writing ramdisk image..."
49 *a7a79fa1SJean-Baptiste Boric# add the other modules for boot
50 *a7a79fa1SJean-Baptiste Boriccp ${MODDIR}/* ${WORK_DIR}
51 *a7a79fa1SJean-Baptiste Boriccreate_ramdisk_image ${RAMDISK_SIZE}
52 *a7a79fa1SJean-Baptiste Boric
53 *a7a79fa1SJean-Baptiste Boricecho ""
54 *a7a79fa1SJean-Baptiste Boricecho "RAM image modules at ${WORK_DIR}"
55 *a7a79fa1SJean-Baptiste Boricecho ""
56 *a7a79fa1SJean-Baptiste Boricecho "To boot this image on kvm:"
57 *a7a79fa1SJean-Baptiste Boricecho "cd ${WORK_DIR} && qemu-system-i386 --enable-kvm -m 1G -kernel kernel -append \"bootramdisk=1\" -initrd \"${mods}\""
58