annotate package-mini-native.sh @ 512:b309dd2a45fe

Project traces back to 2002 (albeit through 2 relaunches), and this is 2008. See http://uclibc.org/lists/uclibc/2002-September/004380.html
author Rob Landley <rob@landley.net>
date Sun, 30 Nov 2008 20:15:51 -0600
parents 909a4921273d
children 15af90157a19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
6b4844b708b9 dash->bash.
Rob Landley <rob@landley.net>
parents: 162
diff changeset
1 #!/bin/bash
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
3 # Create an ext2 root filesystem image from mini-native
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
503
e98ed40c55ef Move include.sh to sources/include.sh. End user doesn't call it directly, shouldn't be at top level.
Rob Landley <rob@landley.net>
parents: 499
diff changeset
5 source sources/include.sh
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
485
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 483
diff changeset
7 echo -e "$PACKAGE_COLOR"
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 483
diff changeset
8 echo "=== Packaging system image from mini-native"
b0438691e9e1 Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents: 483
diff changeset
9
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
10 SYSIMAGE="${BUILD}/system-image-${ARCH}"
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
11 IMAGE="${SYSIMAGE}/image-${ARCH}.ext2"
462
3f3283fb5e1e Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents: 451
diff changeset
12
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
13 # Flush old system-image directory
468
3d2996abb6ea Moving the temp dir broke non-root packaging: fix it.
Rob Landley <rob@landley.net>
parents: 467
diff changeset
14
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
15 rm -rf "${SYSIMAGE}"
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
16 mkdir -p "${SYSIMAGE}" &&
354
d96741481221 User Mode Linux found a new way to break: now when it panics, it sends a kill
Rob Landley <rob@landley.net>
parents: 353
diff changeset
17
508
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
18 # Generate a 64 megabyte filesystem image from the $NATIVE directory, with a
909a4921273d Move genext2fs build to host-tools, remove dead code, add comments.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
19 # temporary file defining the /dev nodes for the new ext2 filesystem.
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
20
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
21 cat > "$WORK/devlist" << EOF &&
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
22 /dev d 755 0 0 - - - - -
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
23 /dev/console c 640 0 0 5 1 0 0 -
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
24 EOF
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
25 genext2fs -z -D "$WORK/devlist" -d "${NATIVE}" -i 1024 -b $[64*1024] "$IMAGE" &&
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
26 rm "$WORK/devlist" || dienow
462
3f3283fb5e1e Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents: 451
diff changeset
27
330
f9ff71c71f9e Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents: 325
diff changeset
28 # Provide qemu's common command line options between architectures. The lack
f9ff71c71f9e Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents: 325
diff changeset
29 # of ending quotes on -append is intentional, callers append more kernel
f9ff71c71f9e Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents: 325
diff changeset
30 # command line arguments and provide their own ending quote.
325
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
31 function qemu_defaults()
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
32 {
330
f9ff71c71f9e Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents: 325
diff changeset
33 echo "-nographic -no-reboot \$WITH_HDB" \
372
37c8a6c9a493 Teach qemu-setup.sh to use oneit so ctrl-c works under the emulator. Also
Rob Landley <rob@landley.net>
parents: 355
diff changeset
34 "-hda \"$1\" -kernel \"$2\"" \
473
eac92c5b7424 Distinguish console setup (qemu vs chroot) based on whether we're running as pid 1, and grep for console= from kernel command line arguments in dmesg, so we don't have to pass CONSOLE= a second time on kernel command line.
Rob Landley <rob@landley.net>
parents: 472
diff changeset
35 "-append \"root=/dev/$ROOT console=$CONSOLE" \
372
37c8a6c9a493 Teach qemu-setup.sh to use oneit so ctrl-c works under the emulator. Also
Rob Landley <rob@landley.net>
parents: 355
diff changeset
36 "rw init=/tools/bin/qemu-setup.sh panic=1" \
482
3e9d715e4a11 Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents: 473
diff changeset
37 'PATH=$DISTCC_PATH_PREFIX/tools/bin $KERNEL_EXTRA"'
325
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
38 }
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
39
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
40 # Write out a script to call the appropriate emulator. We split out the
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
41 # filesystem, kernel, and base kernel command line arguments in case you want
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
42 # to use an emulator other than qemu, but put the default case in qemu_defaults
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
43
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents: 496
diff changeset
44 cp "$SOURCES/toys/run-emulator.sh" "$SYSIMAGE/run-emulator.sh" &&
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents: 496
diff changeset
45 emulator_command image-$ARCH.ext2 zImage-$ARCH >> "$SYSIMAGE/run-emulator.sh" &&
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents: 496
diff changeset
46 ln "$WORK/zImage-$ARCH" "$SYSIMAGE"
306
358ef8a27085 Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents: 300
diff changeset
47
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
48 [ $? -ne 0 ] && dienow
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
49
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
50 # Adjust things before creating tarball.
306
358ef8a27085 Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents: 300
diff changeset
51
496
3cebbc0b0723 Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents: 490
diff changeset
52 if [ -z "$NATIVE_TOOLSDIR" ]
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
53 then
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents: 496
diff changeset
54 sed -i 's@/tools/@/usr/@g' "$SYSIMAGE/run-emulator.sh" || dienow
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
55 fi
306
358ef8a27085 Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents: 300
diff changeset
56
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
57 if [ "$ARCH" == powerpc ]
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
58 then
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
59 cp "$SOURCES"/toys/ppc_rom.bin "$SYSIMAGE" || dienow
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
60 fi
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
61
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
62 # Tar it up.
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
63
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
64 tar -cvj -f "$BUILD"/system-image-$ARCH.tar.bz2 \
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
65 -C "$BUILD" system-image-$ARCH || dienow
267
98c1a2136322 Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents: 264
diff changeset
66
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
67 echo -e "=== Packaging complete\e[0m"
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
68
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
69
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
70 # We used to do this, but updating the squashfs patch for each new kernel
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
71 # was just too much work. If it gets merged someday, we may care again...
395
c2b290c1df40 Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
Rob Landley <rob@landley.net>
parents: 392
diff changeset
72
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
73 #echo -n "Creating tools.sqf"
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
74 #("${WORK}/mksquashfs" "${NATIVE}/tools" "${WORK}/tools.sqf" \
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
75 # -noappend -all-root -info || dienow) | dotprogress
267
98c1a2136322 Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents: 264
diff changeset
76
490
004f9509349b Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents: 486
diff changeset
77