From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5BFFC433EF for ; Tue, 2 Nov 2021 20:25:15 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40C0C60E08 for ; Tue, 2 Nov 2021 20:25:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 40C0C60E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mi0Ks-0006vR-Lo; Tue, 02 Nov 2021 16:24:46 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1mi0Kq-0006ur-UO for kernelnewbies@kernelnewbies.org; Tue, 02 Nov 2021 16:24:44 -0400 Received: by mail-pf1-x429.google.com with SMTP id y4so118773pfa.5 for ; Tue, 02 Nov 2021 13:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=iYpWtE6FG6ldOAkSK/jcxduaezCU3aQ7HWWLyH4Q+NY=; b=MZ09fUT69yGfdINTr7AqOqEVgDfKPyyEome+R3wPERCPIMjDWloIcflFBwQkHPjnZ6 t65PMkRcH1fmxrSf6QwQjswgMPZlA9L3FNK+yXbzzo9bBigBmWQimWStZlDjVEHHyaBH cdAdf0YFqJB/uUn5zaIHE3WE8qcbiqgr0+L7oGuUPA69cenl6V0Qmjte5i0hvihizroh Obm/Ig+18ZG7DOE1grlvJSVMjf5yTFR7QFKTZYPRpUFYdV8LgYpcBIFAyr6HPTZweeCi tATPi9bsq0VD6eUDZIqJWp6c7J9Y+aCEehQB+EZBaHf7YwriBRNUs8B9pnL4SVLl9/fY CFfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=iYpWtE6FG6ldOAkSK/jcxduaezCU3aQ7HWWLyH4Q+NY=; b=EHzNdo9ZutVFg/ptBOKhho8BWfO8AcPekwS+LTZXu5j8wHIaVE3ME6VOOO41tiynR4 +S6fO4N1MujYNIGLOqkHLJdz3tvj1XJXFpXB0q2+fZcC3okyDESROWLhLyt81CH3egPP DzEbjWfZh+SX7gzDSQsWfJy9F4/D7Sf/XIxrShdGEc5pbR7AyDltJJFWp+T3KbE7sFBO 3X7rfi1FTLATnCKfZfAyGmiGKBJYeHSeG6mLU2IvsgTHRIKdIHHKJnVVXaDhEvZ8ASCP Hf6jqPW9xf0vacq2TmJy1adHKp4IydeaE0gitL6W653YVm6d6tYZYa2aFJgRXambvPhi Hcog== X-Gm-Message-State: AOAM530aj4/rHrFNqwLP1bAjysdWSSh7GnmAamb3X6FB1HUTfv08zmdX j8ruKnN0Lzh1AjJ5gQIkwEs= X-Google-Smtp-Source: ABdhPJzcmhYYtx4X6toM0EdPf+eCkZ9F4AbIfdwSeHqEvMAKS6rIGtjBO42xuLpKfU7FXGlDtfRVWA== X-Received: by 2002:a05:6a00:17a6:b0:481:1503:e629 with SMTP id s38-20020a056a0017a600b004811503e629mr13796719pfg.49.1635884683547; Tue, 02 Nov 2021 13:24:43 -0700 (PDT) Received: from localhost.localdomain (122-60-15-148-adsl.sparkbb.co.nz. [122.60.15.148]) by smtp.gmail.com with ESMTPSA id d20sm19781pfu.189.2021.11.02.13.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 13:24:43 -0700 (PDT) Date: Wed, 3 Nov 2021 09:24:38 +1300 From: Paulo Miguel Almeida To: Mushahid Hussain Subject: Re: Loading a simple "kernel" at the address other than default on Raspberry Pi 4 Message-ID: <20211102202438.GA3466@localhost.localdomain> Mail-Followup-To: Paulo Miguel Almeida , Mushahid Hussain , kernelnewbies@kernelnewbies.org References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Disclaimer: I'm not an expert in ARM, I'm just trying to help because I've been (still am really) in the journey of writing a hobbist OS and know how small suggestions can help sometimes. On Tue, Nov 02, 2021 at 05:13:16PM +0500, Mushahid Hussain wrote: > There's a configuration(config.txt)[1] kernel_address on Raspberry Pi 4 but > whenever I change the load address by even 1 byte, the simple kernel would > not run. It is only able to run at 0x80000. Most likely the stages (and code) that run in previous stages expect your code to be present precisely at this address. Hence, when you change the target address even by 1 byte it doesn't work. Remember that if the CPU reads something that causes it to throw an error/exception, it doesn't go to the next instruction. QEMU + GDB can be great allies when answering these types of questions. Something like this (I haven't tested it but this is a starting point): QEMU cmd: qemu-system-aarch64 -gdb tcp::8864 -drive format=raw,file=$(OUTPUT_RAW_DISK) \ -S -d guest_errors -d int -no-reboot -no-shutdown GDB cmd: gdb -ex 'target remote localhost:8864' \ -ex 'layout asm' \ -ex 'layout regs' \ -ex 'b *0x80000' \ > How is the standard kernel being loaded at 0x200000, but my simple kernel > cannot be loaded at any address except for the default address(0x80000)? > I'm not familiar with that firmware but again if I were you I would be debugging the standard kernel as well. >From my personal experience (I'm developing for x86-64), there were a couple of things that GRUB bootloader did out-of-the-box for the linux kernel to make its life easier that I had to write myself because I wanted to write the bootloader too. My point is, for quite sometime I was looking for the answers in the linux kernel when in reality those were in a different component (grub in this case). Make sure that this isn't the case for you as well. Happy coding :) > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies