diff --git a/README.adoc b/README.adoc index 91c2454..b181bbc 100644 --- a/README.adoc +++ b/README.adoc @@ -1704,7 +1704,7 @@ Bibliography: We source the Linux kernel GDB scripts by default for `lx-symbols`, but they also contains some other goodies worth looking into. -Those scripts basically parse some in-kernel datastructures to offer greater visibility with GDB. +Those scripts basically parse some in-kernel data structures to offer greater visibility with GDB. All defined commands are prefixed by `lx-`, so to get a full list just try to tab complete that. @@ -3532,7 +3532,7 @@ and when we connect it shows a message: info: VNC client attached .... -Alternatively, you can also view the frames with `--frame-capture`: +Alternatively, you can also dump each new frame to an image file with `--frame-capture`: .... ./run \ @@ -3543,9 +3543,15 @@ Alternatively, you can also view the frames with `--frame-capture`: ; .... -This option dumps one compressed PNG whenever the screen image changes inside `m5out`, indexed by the cycle ID. This allows for more controlled experiments. +This creates on compressed PNG whenever the screen image changes inside the <> with filename of type: -It is fun to see how we get one new frame whenever the white underscore cursor appears and reappears under the penguin. +.... +frames_system.vncserver/fb...png.gz +.... + +It is fun to see how we get one new frame whenever the white underscore cursor appears and reappears under the penguin! + +The last frame is always available uncompressed at: `system.framebuffer.png`. TODO <> failed on `aarch64` with: @@ -3574,6 +3580,28 @@ git -C "$(./getvar linux_src_dir)" checkout - This is because the gem5 `aarch64` defconfig does not enable HDLCD like the 32 bit one `arm` one for some reason. +==== gem5 graphic mode DP650 + +TODO get working. There is an unmerged patchset at: https://gem5-review.googlesource.com/c/public/gem5/+/11036/1 + +The DP650 is a newer display hardware than HDLCD. TODO is its interface publicly documented anywhere? Since it has a gem5 model and link:https://github.com/torvalds/linux/blob/v4.19/drivers/gpu/drm/arm/Kconfig#L39[in-tree Linux kernel support], that information cannot be secret? + +The key option to enable support in Linux is `DRM_MALI_DISPLAY=y` which we enable at link:linux_config/display[]. + +.... +./build-linux +git -C "$(./getvar linux_src_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15 +git -C "$(./getvar linux_src_dir)" checkout gem5/v4.15 +./build-linux \ + --arch aarch64 \ + --config-fragment linux_config/display \ + --custom-config-file "$(./getvar linux_src_dir)/arch/arm64/configs/gem5_defconfig" \ + --linux-build-id gem5-v4.15 \ +; +git -C "$(./getvar linux_src_dir)" checkout - +./run --arch aarch64 --dp650 --gem5 --linux-build-id gem5-v4.15 +.... + ==== Graphic mode gem5 internals We cannot use mainline Linux because the <> are required at least to provide the `CONFIG_DRM_VIRT_ENCODER` option. @@ -9333,7 +9361,7 @@ since boot has already happened, and the parameters are already in the RAM of th Checkpoints are stored inside the <> at: .... -"$(./getvar --gem5 run_dir)/m5out/cpt." +"$(./getvar --gem5 m5out_dir)/cpt." .... where `` is the cycle number at which the checkpoint was taken. diff --git a/common.py b/common.py index eade24c..eaaff44 100644 --- a/common.py +++ b/common.py @@ -312,6 +312,10 @@ Use the docker download Ubuntu root filesystem instead of the default Buildroot '-L', '--linux-build-id', default=default_build_id, help='Linux build ID. Allows you to keep multiple separate Linux builds. Default: %(default)s' ) + parser.add_argument( + '--linux-build-dir', + help='Select the directory that contains the Linux kernel build. Overrides linux-build-id.' + ) parser.add_argument( '--machine', help='''Machine type. @@ -856,8 +860,11 @@ def setup(parser): # Linux common.linux_buildroot_build_dir = os.path.join(common.buildroot_build_build_dir, 'linux-custom') - common.linux_build_dir = os.path.join(common.out_dir, 'linux', args.linux_build_id, args.arch) - common.lkmc_vmlinux = os.path.join(common.linux_build_dir, "vmlinux") + if args.linux_build_dir is None: + common.linux_build_dir = os.path.join(common.out_dir, 'linux', args.linux_build_id, args.arch) + else: + common.linux_build_dir = args.linux_build_dir + common.lkmc_vmlinux = os.path.join(common.linux_build_dir, 'vmlinux') if args.arch == 'arm': common.linux_arch = 'arm' common.linux_image_prefix = os.path.join('arch', common.linux_arch, 'boot', 'zImage') diff --git a/linux_config/display b/linux_config/display index 14d7c44..6ebdf8d 100644 --- a/linux_config/display +++ b/linux_config/display @@ -5,5 +5,7 @@ CONFIG_DRM_VIRTIO_GPU=y ## gem5 CONFIG_DRM_HDLCD=y +# DP650. +DRM_MALI_DISPLAY=y # Only present in the gem5 fork. CONFIG_DRM_VIRT_ENCODER=y diff --git a/test-gem5-graphics b/test-gem5-graphics new file mode 100755 index 0000000..27d30c6 --- /dev/null +++ b/test-gem5-graphics @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Quick and dirty implementation, relies on configs. +# Check that the third image matches a reference penguin SHA. +# https://softwarerecs.stackexchange.com/questions/9774/command-line-tool-to-check-whether-two-images-are-exactly-the-same-graphically/9779#9779 +set -eux +rm -rf "$(./getvar "$@" m5out_dir)/frames_system.vncserver" +./run --eval 'm5 exit' --tmux "$@" -- --frame-capture +gz="$(echo "$(./getvar m5out_dir)/frames_system.vncserver/fb.000002."*.gz)" +png="${gz%.*}" +gunzip --keep "$gz" +[ "$(identify -format '%#' "$png")" = dc41b947487026acdceae8a757259d5a1a4752fd97c1da9ce6df9b49013babed ]